← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16290: event-capture - feature for printing event capture form

 

------------------------------------------------------------
revno: 16290
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-08-01 11:14:13 +0200
message:
  event-capture - feature for printing event capture form
modified:
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json	2014-07-15 20:46:26 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json	2014-08-01 09:14:13 +0000
@@ -35,6 +35,8 @@
     "are_you_sure_to_remove": "Are you sure you want to remove the selected item?",
     "use_custom_form": "Custom form",
     "use_default_form": "Default form",
+    "print": "Print",
+    "print_blank": "Print blank form",
     "show_hide_columns": "Show/hide columns",
     "show_all": "Show all",
     "hide": "Hide",

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html	2014-07-07 05:26:09 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html	2014-08-01 09:14:13 +0000
@@ -67,8 +67,8 @@
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.menu.ui.js"></script>
 
         <link type="text/css" rel="stylesheet" href="../dhis-web-commons/font-awesome/css/font-awesome.min.css"/>
-        <link type="text/css" rel="stylesheet" media="screen,print" href="../dhis-web-commons/css/light_blue/light_blue.css"/>
-        <link type="text/css" rel="stylesheet" media="screen,print" href="../dhis-web-commons/css/widgets.css"/>     
+        <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/light_blue/light_blue.css"/>
+        <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/widgets.css"/>     
         <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/menu.css">
         
         <link type="text/css" rel="stylesheet" href="styles/style.css">
@@ -134,7 +134,7 @@
                                 </select>      
                             </td>
                             <td style='padding-left: 10px;'>
-                                <button class="button button-std"
+                                <button class="button button-std not-printable"
                                         ng-show="selectedProgramStage" 
                                         ng-click="showEventRegistration()" 
                                         ng-disabled="eventRegistration || editingEventInFull || editingEventInGrid">
@@ -142,11 +142,17 @@
                                 </button>  
                             </td>
                             <td ng-if="(editingEventInFull || eventRegistration) && customForm" style='padding-left: 10px;'>
-                                <button class="button button-std"
+                                <button class="button button-std not-printable"
                                         ng-click="switchDataEntryForm()">
                                     {{displayCustomForm ? 'use_default_form' : 'use_custom_form'| translate}}
                                 </button>  
-                            </td>                            
+                            </td>
+                            <td ng-if="editingEventInFull || eventRegistration" style='padding-left: 10px;'>
+                                <button class="button button-std not-printable"
+                                        onclick="javascript:window.print()">
+                                    {{'print'| translate}}
+                                </button>  
+                            </td> 
                         </tr>                       
                     </table>
                 </div>
@@ -157,39 +163,40 @@
                 <!-- event grid ends -->
 
                 <!-- event update in full / registration begins-->
-                <form name="outerForm" novalidate>
-                    <div ng-if="editingEventInFull || eventRegistration">
-                        <h3>
-                            <span ng-if="editingEventInFull">{{'update_event'| translate}}</span>                       
-                            <span ng-if="eventRegistration">{{'new_event'| translate}}</span>                            
-                        </h3>
-
-                        <div class="bordered-div" ng-if="displayCustomForm">
-                            <div ng-include="'views/customForm.html'"></div>  
-                        </div>
-
-                        <div class="bordered-div" style="width:50%;" ng-if="!displayCustomForm">
-                            <div ng-include="'views/defaultForm.html'"></div>                
-                        </div>
-                        
-                        <!-- buttons for event registration / update begins -->
-                        <div style="clear: both;">                        
-                            <span ng-if="editingEventInFull">
-                                <button ng-click="updateEvent()" class="button">{{'update'| translate}}</button>
-                                <button ng-click="showEventList()" class="button">{{'go_back'| translate}}</button>
-                            </span>
-                            <span ng-if="eventRegistration">
-                                <button ng-click="addEvent(true)" class="button">{{'save_and_add_new'| translate}}</button>
-                                <button ng-click="addEvent()" class="button">{{'save_and_back'| translate}}</button>
-                                <button ng-click="showEventList(null)" class="button">{{'go_back'| translate}}</button>
-                            </span> 
-                        </div>
-                        <!-- buttons for event registration / update ends -->
-                        
-                    </div>
-                </form>    
-                <!-- event update / registration ends -->
-                
+                <div>                
+                    <form name="outerForm" novalidate>
+                        <div ng-if="editingEventInFull || eventRegistration">
+                            <h3>
+                                <span ng-if="editingEventInFull">{{'update_event'| translate}}</span>                       
+                                <span ng-if="eventRegistration">{{'new_event'| translate}}</span>                            
+                            </h3>
+
+                            <div class="bordered-div" ng-if="displayCustomForm">
+                                <div ng-include="'views/customForm.html'"></div>  
+                            </div>
+
+                            <div class="bordered-div container-default-form" ng-if="!displayCustomForm">
+                                <div ng-include="'views/defaultForm.html'"></div>                
+                            </div>
+
+                            <!-- buttons for event registration / update begins -->
+                            <div style="clear: both;">                        
+                                <span ng-if="editingEventInFull">
+                                    <button ng-click="updateEvent()" class="button not-printable">{{'update'| translate}}</button>
+                                    <button ng-click="showEventList()" class="button not-printable">{{'go_back'| translate}}</button>
+                                </span>
+                                <span ng-if="eventRegistration">
+                                    <button ng-click="addEvent(true)" class="button not-printable">{{'save_and_add_new'| translate}}</button>
+                                    <button ng-click="addEvent()" class="button not-printable">{{'save_and_back'| translate}}</button>
+                                    <button ng-click="showEventList(null)" class="button not-printable">{{'go_back'| translate}}</button>
+                                </span> 
+                            </div>
+                            <!-- buttons for event registration / update ends -->
+
+                        </div>
+                    </form>  
+                </div>
+                <!-- event update / registration ends -->                
             </div>            
         </div>
     </body>

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-08-01 09:14:13 +0000
@@ -583,6 +583,14 @@
         });        
     };
     
+    $scope.printForm = function(){
+        var printContents = document.getElementById('printableForm').innerHTML;
+        var originalContents = document.body.innerHTML;        
+        document.body.innerHTML = printContents;
+        window.print();
+        document.body.innerHTML = originalContents;
+    };
+    
     $scope.showNotes = function(dhis2Event){
         
         var modalInstance = $modal.open({

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css	2014-07-06 12:46:18 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css	2014-08-01 09:14:13 +0000
@@ -31,28 +31,12 @@
 /* App specific
 /*----------------------------------------------------------------------------*/
 
-/* Block level inputs */
-.container-filters {
-    display: block;
-    width: 100%;    
-}
-
 .container-heading {
     color: white;
 }
 
-.container-1-4 {
-    width: 25%;
-    float: left;
-    margin-top: 1em;
-    margin-bottom: 1em;
-}
-
-.container-1-2 {
+.container-default-form {
     width: 50%;
-    float: left;
-    margin-top: 1em;
-    margin-bottom: 1em;
 }
 
 .container-1-1 {
@@ -358,122 +342,122 @@
 
 
 .popover {
-	position: absolute;
-	top: 0;
-	left: 0;
-	z-index: 1010;
-	display: none;
-	max-width: 276px;
-	padding: 1px;
-	text-align: left;
-	white-space: normal;
-	background-color: #fff;
-	border: 1px solid #ccc;
-	border: 1px solid rgba(0,0,0,0.2);
-	border-radius: 6px;
-	-webkit-box-shadow: 0 5px 10px rgba(0,0,0,0.2);
-	box-shadow: 0 5px 10px rgba(0,0,0,0.2);
-	background-clip: padding-box
+    position: absolute;
+    top: 0;
+    left: 0;
+    z-index: 1010;
+    display: none;
+    max-width: 276px;
+    padding: 1px;
+    text-align: left;
+    white-space: normal;
+    background-color: #fff;
+    border: 1px solid #ccc;
+    border: 1px solid rgba(0,0,0,0.2);
+    border-radius: 6px;
+    -webkit-box-shadow: 0 5px 10px rgba(0,0,0,0.2);
+    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
+    background-clip: padding-box
 }
 .popover.top {
-	margin-top: -10px
+    margin-top: -10px
 }
 .popover.right {
-	margin-left: 10px
+    margin-left: 10px
 }
 .popover.bottom {
-	margin-top: 10px
+    margin-top: 10px
 }
 .popover.left {
-	margin-left: -10px
+    margin-left: -10px
 }
 .popover-title {
-	padding: 5px;;
-	margin: 0;
-	font-size: 14px;
-	font-weight: normal;
-	line-height: 18px;
-	background-color: #f7f7f7;
-	border-bottom: 1px solid #ebebeb;
-	border-radius: 5px 5px 0 0
+    padding: 5px;;
+    margin: 0;
+    font-size: 14px;
+    font-weight: normal;
+    line-height: 18px;
+    background-color: #f7f7f7;
+    border-bottom: 1px solid #ebebeb;
+    border-radius: 5px 5px 0 0
 }
 .popover-content {
-	padding: 5px;
+    padding: 5px;
 }
 .popover .arrow, .popover .arrow:after {
-	position: absolute;
-	display: block;
-	width: 0;
-	height: 0;
-	border-color: transparent;
-	border-style: solid
+    position: absolute;
+    display: block;
+    width: 0;
+    height: 0;
+    border-color: transparent;
+    border-style: solid
 }
 .popover .arrow {
-	border-width: 11px
+    border-width: 11px
 }
 .popover .arrow:after {
-	border-width: 10px;
-	content: ""
+    border-width: 10px;
+    content: ""
 }
 .popover.top .arrow {
-	bottom: -11px;
-	left: 50%;
-	margin-left: -11px;
-	border-top-color: #999;
-	border-top-color: rgba(0,0,0,0.25);
-	border-bottom-width: 0
+    bottom: -11px;
+    left: 50%;
+    margin-left: -11px;
+    border-top-color: #999;
+    border-top-color: rgba(0,0,0,0.25);
+    border-bottom-width: 0
 }
 .popover.top .arrow:after {
-	bottom: 1px;
-	margin-left: -10px;
-	border-top-color: #fff;
-	border-bottom-width: 0;
-	content: " "
+    bottom: 1px;
+    margin-left: -10px;
+    border-top-color: #fff;
+    border-bottom-width: 0;
+    content: " "
 }
 .popover.right .arrow {
-	top: 50%;
-	left: -11px;
-	margin-top: -11px;
-	border-right-color: #999;
-	border-right-color: rgba(0,0,0,0.25);
-	border-left-width: 0
+    top: 50%;
+    left: -11px;
+    margin-top: -11px;
+    border-right-color: #999;
+    border-right-color: rgba(0,0,0,0.25);
+    border-left-width: 0
 }
 .popover.right .arrow:after {
-	bottom: -10px;
-	left: 1px;
-	border-right-color: #fff;
-	border-left-width: 0;
-	content: " "
+    bottom: -10px;
+    left: 1px;
+    border-right-color: #fff;
+    border-left-width: 0;
+    content: " "
 }
 .popover.bottom .arrow {
-	top: -11px;
-	left: 50%;
-	margin-left: -11px;
-	border-bottom-color: #999;
-	border-bottom-color: rgba(0,0,0,0.25);
-	border-top-width: 0
+    top: -11px;
+    left: 50%;
+    margin-left: -11px;
+    border-bottom-color: #999;
+    border-bottom-color: rgba(0,0,0,0.25);
+    border-top-width: 0
 }
 .popover.bottom .arrow:after {
-	top: 1px;
-	margin-left: -10px;
-	border-bottom-color: #fff;
-	border-top-width: 0;
-	content: " "
+    top: 1px;
+    margin-left: -10px;
+    border-bottom-color: #fff;
+    border-top-width: 0;
+    content: " "
 }
 .popover.left .arrow {
-	top: 50%;
-	right: -11px;
-	margin-top: -11px;
-	border-left-color: #999;
-	border-left-color: rgba(0,0,0,0.25);
-	border-right-width: 0
+    top: 50%;
+    right: -11px;
+    margin-top: -11px;
+    border-left-color: #999;
+    border-left-color: rgba(0,0,0,0.25);
+    border-right-width: 0
 }
 .popover.left .arrow:after {
-	right: 1px;
-	bottom: -10px;
-	border-left-color: #fff;
-	border-right-width: 0;
-	content: " "
+    right: 1px;
+    bottom: -10px;
+    border-left-color: #fff;
+    border-right-width: 0;
+    content: " "
 }
 
 
@@ -629,4 +613,28 @@
 
 .clear {
     clear: both
+}
+
+
+@media print {
+    #header, #leftBar, .not-printable {
+        display: none;
+    }
+    
+    .container-default-form {
+        width: 80%;
+    }
+
+    ::-webkit-input-placeholder { /* WebKit browsers */
+        color: transparent;
+    }
+    :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
+        color: transparent;
+    }
+    ::-moz-placeholder { /* Mozilla Firefox 19+ */
+        color: transparent;
+    }
+    :-ms-input-placeholder { /* Internet Explorer 10+ */
+        color: transparent;
+    }
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html	2014-07-06 12:46:18 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html	2014-08-01 09:14:13 +0000
@@ -183,7 +183,7 @@
                                 </ng-form>                                                
                             </td>
                             <td ng-if='noteExists'>                                
-                                <a href ng-click="showNotes(dhis2Event)" title="{{'show_comments'| translate}}"><i class="fa fa-info-circle"></i></a>
+                                <a href ng-click="showNotes(dhis2Event)" title="{{'show_comments'| translate}}" ng-if="dhis2Event.notes"><i class="fa fa-info-circle"></i></a>
                             </td>
                         </tr>
                     </tbody>