← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16130: tracker capture - more synch between enrollment widget and tei dashboard

 

------------------------------------------------------------
revno: 16130
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Tue 2014-07-15 12:04:47 +0200
message:
  tracker capture - more synch between enrollment widget and tei dashboard
modified:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2014-07-15 09:20:54 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2014-07-15 10:04:47 +0000
@@ -78,7 +78,12 @@
     //it is possible that such could happen during enrollment.
     $scope.$on('mainDashboard', function(event, args) { 
         var selections = CurrentSelection.get();
-        $scope.selectedProgram = selections.pr;
+        $scope.selectedProgram = null;
+        angular.forEach($scope.programs, function(pr){
+            if(pr.id === selections.pr){
+                $scope.selectedProgram = pr;
+            }
+        });
         $scope.broadCastSelections(); 
     }); 
     
@@ -87,7 +92,6 @@
         var selections = CurrentSelection.get();
         $scope.selectedTei = selections.tei;
         $scope.trackedEntity = selections.te;
-        $scope.selectedEnrollment = selections.enrollment;
         CurrentSelection.set({tei: $scope.selectedTei, te: $scope.trackedEntity, pr: $scope.selectedProgram, enrollment: null});
         $timeout(function() { 
             $rootScope.$broadcast('selectedItems', {programExists: $scope.programs.length > 0});            

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2014-07-15 09:20:54 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2014-07-15 10:04:47 +0000
@@ -3,6 +3,7 @@
                 $scope,  
                 $filter,
                 $timeout,
+                $location,
                 storage,
                 AttributesFactory,
                 CurrentSelection,
@@ -182,8 +183,14 @@
     };
     
     $scope.cancelEnrollment = function(){
-        $scope.selectedProgram = null;
-        $scope.selectedEnrollment = null;
+        
+        /*currently the only way to cancel enrollment window is by going through
+         * the main dashboard controller. Here I am mixing program and programId, 
+         * as I didn't want to refetch program from server, the main dashboard
+         * has already fetched the programs. With the ID passed to it, it will
+         * pass back the actual program than ID. 
+         */
+        $scope.selectedProgram = ($location.search()).program;
         $scope.broadCastSelections('mainDashboard'); 
     };
 });
\ No newline at end of file