=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2015-03-06 16:27:25 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2015-03-09 15:56:34 +0000 @@ -199,6 +199,8 @@ $scope.selectedProgram = pr; } }); + + $scope.applySelectedProgram(); }); //watch for widget sorting === 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 2015-03-06 09:37:05 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-03-09 15:56:34 +0000 @@ -61,8 +61,7 @@ $scope.optionSets = selections.optionSets; $scope.selectedProgramWithStage = []; - if($scope.selectedOrgUnit && $scope.selectedProgram && $scope.selectedEntity && $scope.selectedEnrollment){ - + if($scope.selectedOrgUnit && $scope.selectedProgram && $scope.selectedProgram.id && $scope.selectedEntity && $scope.selectedEnrollment && $scope.selectedEnrollment.enrollment){ ProgramStageFactory.getByProgram($scope.selectedProgram).then(function(stages){ $scope.programStages = stages; angular.forEach(stages, function(stage){ === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2015-03-03 16:55:58 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2015-03-09 15:56:34 +0000 @@ -24,7 +24,7 @@ -
+
@@ -40,8 +40,7 @@ - - + @@ -63,7 +62,8 @@
-
{{'not_yet_enrolled_data_entry'| translate}}
+ +
{{'not_yet_enrolled_data_entry'| translate}}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2015-03-09 14:38:11 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2015-03-09 15:56:34 +0000 @@ -17,9 +17,7 @@ DialogService) { $scope.today = DateUtils.getToday(); - $scope.selectedOrgUnit = storage.get('SELECTED_OU'); - - + $scope.selectedOrgUnit = storage.get('SELECTED_OU'); //listen for the selected items var selections = {}; @@ -88,10 +86,11 @@ $scope.showEnrollmentHistoryDiv = false; $scope.selectedEnrollment = enrollment; - if(!$scope.selectedEnrollment.enrollment){//prepare for possible enrollment - AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){ - $scope.attributes = atts; - $scope.customFormExists = false; + AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){ + $scope.attributes = atts; + $scope.customFormExists = false; + + if($scope.selectedProgram && $scope.selectedProgram.id){ TEFormService.getByProgram($scope.selectedProgram, atts).then(function(teForm){ if(angular.isObject(teForm)){ $scope.customFormExists = true; @@ -100,22 +99,16 @@ } $scope.broadCastSelections('dashboardWidgets'); }); - }); - } - else{ - $scope.broadCastSelections('dashboardWidgets'); - } + } + else{ + $scope.broadCastSelections('dashboardWidgets'); + } + }); }; - $scope.showNewEnrollment = function(){ - if($scope.showEnrollmentDiv){ - $scope.hideEnrollmentDiv(); - } - + $scope.showNewEnrollment = function(){ + $scope.showEnrollmentDiv = !$scope.showEnrollmentDiv; - $timeout(function() { - $rootScope.$broadcast('enrollmentEditing', {enrollmentEditing: $scope.showEnrollmentDiv}); - }, 100); if($scope.showEnrollmentDiv){ $scope.showEnrollmentHistoryDiv = false; @@ -123,18 +116,9 @@ //load new enrollment details $scope.selectedEnrollment = {}; $scope.loadEnrollmentDetails($scope.selectedEnrollment); - - //check custom form for enrollment - $scope.customFormExists = false; - $scope.registrationForm = ''; - TEFormService.getByProgram($scope.selectedProgram, $scope.attributes).then(function(teForm){ - if(angular.isObject(teForm)){ - $scope.customFormExists = true; - $scope.registrationForm = teForm; - } - $scope.customFormExists = $scope.customFormExists ? true:false; - $scope.broadCastSelections('dashboardWidgets'); - }); + } + else{ + hideEnrollmentDiv(); } }; @@ -224,15 +208,15 @@ $scope.broadCastSelections = function(listeners){ var selections = CurrentSelection.get(); var tei = selections.tei; - var pr = selections.pr;; - var enrollment = null; - if($scope.selectedEnrollment && $scope.selectedEnrollment.enrollment){ - enrollment = $scope.selectedEnrollment; - } - CurrentSelection.set({tei: tei, te: $scope.selectedEntity, prs: $scope.programs, pr: pr, prNames: $scope.programNames, prStNames: $scope.programStageNames, enrollments: $scope.enrollments, selectedEnrollment: enrollment, optionSets: $scope.optionSets}); + + CurrentSelection.set({tei: tei, te: $scope.selectedEntity, prs: $scope.programs, pr: $scope.selectedProgram, prNames: $scope.programNames, prStNames: $scope.programStageNames, enrollments: $scope.enrollments, selectedEnrollment: $scope.selectedEnrollment, optionSets: $scope.optionSets}); $timeout(function() { $rootScope.$broadcast(listeners, {}); }, 100); + + $timeout(function() { + $rootScope.$broadcast('enrollmentEditing', {enrollmentEditing: $scope.showEnrollmentDiv}); + }, 100); }; var getProcessedForm = function(){ @@ -257,7 +241,7 @@ delete $scope.selectedTei.attributes; }; - $scope.hideEnrollmentDiv = function(){ + var hideEnrollmentDiv = function(){ /*currently the only way to cancel enrollment window is by going through * the main dashboard controller. Here I am mixing program and programId, === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js 2015-01-05 10:20:46 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js 2015-03-09 15:56:34 +0000 @@ -19,12 +19,11 @@ $scope.$on('dashboardWidgets', function() { $scope.selectedEnrollment = null; - var selections = CurrentSelection.get(); - $scope.selectedTei = angular.copy(selections.tei); - $scope.selectedProgram = selections.pr; + var selections = CurrentSelection.get(); + $scope.selectedTei = selections.tei; var selections = CurrentSelection.get(); - if(selections.selectedEnrollment){ + if(selections.selectedEnrollment && selections.selectedEnrollment.enrollment){ EnrollmentService.get(selections.selectedEnrollment.enrollment).then(function(data){ $scope.selectedEnrollment = data; if(!angular.isUndefined( $scope.selectedEnrollment.notes)){ === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js 2015-03-06 14:43:54 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js 2015-03-09 15:56:34 +0000 @@ -10,6 +10,7 @@ $scope.editingDisabled = true; $scope.enrollmentEditing = false; + $scope.widget = 'PROFILE'; //listen for the selected entity var selections = {}; @@ -24,7 +25,7 @@ $scope.customForm = null; $scope.attributes = []; $scope.attributesById = CurrentSelection.getAttributesById(); - + //display only those attributes that belong to the selected program //if no program, display attributesInNoProgram angular.forEach($scope.selectedTei.attributes, function(att){ @@ -34,15 +35,17 @@ delete $scope.selectedTei.attributes; AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){ - $scope.attributes = atts; - $scope.customFormExists = false; - TEFormService.getByProgram($scope.selectedProgram, atts).then(function(teForm){ - if(angular.isObject(teForm)){ - $scope.customFormExists = true; - $scope.trackedEntityForm = teForm; - $scope.customForm = CustomFormService.getForTrackedEntity($scope.trackedEntityForm, 'PROFILE'); - } - }); + $scope.attributes = atts; + $scope.customFormExists = false; + if($scope.selectedProgram && $scope.selectedProgram.id){ + TEFormService.getByProgram($scope.selectedProgram, atts).then(function(teForm){ + if(angular.isObject(teForm)){ + $scope.customFormExists = true; + $scope.trackedEntityForm = teForm; + $scope.customForm = CustomFormService.getForTrackedEntity($scope.trackedEntityForm, 'PROFILE'); + } + }); + } }); });