← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21904: tracker-capture: load program attribute categories in data entry widget

 

------------------------------------------------------------
revno: 21904
committer: Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-02-08 09:54:46 +0100
message:
  tracker-capture: load program attribute categories in data entry widget
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-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-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2016-02-04 10:43:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2016-02-08 08:54:46 +0000
@@ -541,6 +541,7 @@
         $scope.prStDes = [];
         $scope.allProgramRules = [];
         $scope.allowProvidedElsewhereExists = [];
+        $scope.optionsReady = false;
         
         var selections = CurrentSelection.get();
         $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
@@ -599,12 +600,23 @@
                 $scope.setDisplayTypeForStages();
                 $scope.getHeaderStages();
                 
+                $scope.selectedCategories = [];
+                if($scope.selectedProgram.categoryCombo && 
+                        !$scope.selectedProgram.categoryCombo.isDefault &&
+                        $scope.selectedProgram.categoryCombo.categories){
+                    $scope.selectedCategories = $scope.selectedProgram.categoryCombo.categories;                    
+                }
+                else{
+                    $scope.optionsReady = true;
+                }
+                
                 TrackerRulesFactory.getRules($scope.selectedProgram.id).then(function(rules){                    
                     $scope.allProgramRules = rules;
                     $scope.getEvents();                    
                     broadcastDataEntryControllerData();
                     executeRulesOnInit();
-                });           
+                });    
+                
             });
         }
     });