← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13282: support completeDate in smartphone data-entry

 

------------------------------------------------------------
revno: 13282
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-12-17 16:17:33 +0100
message:
  support completeDate in smartphone data-entry
modified:
  dhis-2/dhis-web/dhis-web-mobile/src/main/resources/org/hisp/dhis/web/mobile/i18n_module.properties
  dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm


--
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-mobile/src/main/resources/org/hisp/dhis/web/mobile/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/resources/org/hisp/dhis/web/mobile/i18n_module.properties	2013-10-09 10:43:45 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/resources/org/hisp/dhis/web/mobile/i18n_module.properties	2013-12-17 15:17:33 +0000
@@ -9,4 +9,5 @@
 none_selected=None selected
 no_organisation_units_for_data_entry=No organisation units available for data entry
 change_to_invalid_page=Tried changing to invalid page
-logout=Log out
\ No newline at end of file
+logout=Log out
+send_and_complete=Send and Complete
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm	2013-12-17 14:41:36 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm	2013-12-17 15:17:33 +0000
@@ -172,7 +172,8 @@
 
             $( '#data-entry-page' ).trigger( 'pagecreate' );
             $( '#data-entry-list' ).listview( 'refresh' );
-            $( '#send_button' ).bind( 'click', saveValues );
+            $( '#send_button' ).bind( 'click', saveValuesNotCompleted );
+            $( '#send_and_complete_button' ).bind( 'click', saveValuesCompleted );
         }
 
         var dvs = {
@@ -213,7 +214,20 @@
         }
     }
 
-    function saveValues() {
+    function getCurrentDate() {
+        var d = new Date();
+        return d.getFullYear() + '-' + (d.getMonth()+1) + '-' + d.getDate();
+    }
+
+    function saveValuesCompleted() {
+        saveValues(true);
+    }
+
+    function saveValuesNotCompleted() {
+        saveValues(false);
+    }
+
+    function saveValues(completed) {
         $.mobile.loading( 'show' );
 
         var fields = $('#data-entry-form :input[name]');
@@ -224,6 +238,10 @@
           period: Selected.period.toString()
         };
 
+        if( completed ) {
+            dataValueSet.completeDate = getCurrentDate();
+        }
+
         var dataValues = [];
 
         _.each(fields, function(field) {
@@ -368,6 +386,7 @@
         <% }); %>
 
         <li><input type="button" id="send_button" value="$i18n.getString("send")" /></li>
+        <li><input type="button" id="send_and_complete_button" value="$i18n.getString("send_and_complete")" /></li>
     </ul>
     </form>
 </script>