← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10683: wip, only show offline data that has same ou and pid

 

------------------------------------------------------------
revno: 10683
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-04-24 20:07:12 +0700
message:
  wip, only show offline data that has same ou and pid
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js


--
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-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-04-24 08:54:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-04-24 13:07:12 +0000
@@ -57,6 +57,9 @@
 
 function showOfflineEvents() {
     DAO.offlineData.fetchAll(function(store, arr) {
+        var orgUnitId = selection.getSelected();
+        var programId = $('#programId').val();
+
         var target = $( '#offlineEventList' );
         target.children().remove();
 
@@ -65,10 +68,13 @@
 
             $.each( arr, function ( idx, item ) {
                 var event = item.executionDate;
-                event.index = idx + 1;
-                var tmpl = _.template( template.html() );
-                var html = tmpl(event);
-                target.append( html );
+
+                if ( event.organisationUnitId == orgUnitId && event.programId == programId ) {
+                    event.index = idx + 1;
+                    var tmpl = _.template( template.html() );
+                    var html = tmpl( event );
+                    target.append( html );
+                }
             } );
 
             $( "#offlineListDiv table" ).removeClass( 'hidden' );
@@ -276,6 +282,8 @@
 
         updateProgramList( programs );
     } );
+
+    showOfflineEvents();
 }
 
 function updateProgramList( arr ) {
@@ -366,6 +374,8 @@
         } ).fail(function() {
             enable( 'addBtn' );
         });
+
+    showOfflineEvents();
 }
 
 function dataElementOnChange( this_ ) {