=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js 2015-03-06 15:15:45 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js 2015-03-06 16:00:30 +0000 @@ -11,6 +11,7 @@ AttributesFactory, ProgramFactory, CurrentSelection, + OptionSetService, storage) { $scope.today = DateUtils.getToday(); @@ -19,6 +20,32 @@ $scope.displayMode = {}; $scope.printMode = false; + //get optionsets + $scope.optionSets = CurrentSelection.getOptionSets(); + if(!$scope.optionSets){ + $scope.optionSets = []; + OptionSetService.getAll().then(function(optionSets){ + angular.forEach(optionSets, function(optionSet){ + $scope.optionSets[optionSet.id] = optionSet; + }); + + CurrentSelection.setOptionSets($scope.optionSets); + }); + } + + //get attributes + $scope.attributesById = CurrentSelection.getAttributesById(); + if(!$scope.attributesById){ + AttributesFactory.getAll().then(function(atts){ + $scope.attributes = []; + $scope.attributesById = []; + angular.forEach(atts, function(att){ + $scope.attributesById[att.id] = att; + }); + CurrentSelection.setAttributesById($scope.attributesById); + }); + } + //Paging $scope.pager = {pageSize: 50, page: 1, toolBarDisplay: 5}; @@ -31,17 +58,6 @@ } }); - - AttributesFactory.getAll().then(function(atts){ - $scope.attributes = []; - $scope.attributesById = []; - angular.forEach(atts, function(att){ - $scope.attributesById[att.id] = att; - }); - - CurrentSelection.setAttributesById($scope.attributesById); - }); - //load programs associated with the selected org unit. $scope.loadPrograms = function(orgUnit) { $scope.selectedOrgUnit = orgUnit;