dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31596
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16129: tracker capture - more synchronization between dashboard widgets
------------------------------------------------------------
revno: 16129
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Tue 2014-07-15 11:20:54 +0200
message:
tracker capture - more synchronization between dashboard widgets
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/dataentry/dataentry-controller.js
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/notes/notes-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report-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-13 13:08:50 +0000
+++ 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
@@ -73,6 +73,15 @@
});
}
+
+ //listen for any change to program selection
+ //it is possible that such could happen during enrollment.
+ $scope.$on('mainDashboard', function(event, args) {
+ var selections = CurrentSelection.get();
+ $scope.selectedProgram = selections.pr;
+ $scope.broadCastSelections();
+ });
+
$scope.broadCastSelections = function(){
var selections = CurrentSelection.get();
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-07-15 09:20:54 +0000
@@ -30,7 +30,7 @@
$scope.invalidDate = false;
//listen for the selected items
- $scope.$on('dashboard', function(event, args) {
+ $scope.$on('dashboardWidgets', function(event, args) {
$scope.showDataEntryDiv = false;
$scope.showEventCreationDiv = false;
$scope.showDummyEventDiv = false;
=== 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-10 13:17:04 +0000
+++ 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
@@ -15,7 +15,7 @@
//listen for the selected items
$scope.$on('selectedItems', function(event, args) {
- //programs for enrollment
+ //programs for enrollment
$scope.enrollments = [];
$scope.showEnrollmentDiv = false;
$scope.showSchedulingDiv = false;
@@ -30,14 +30,14 @@
$scope.selectedOrgUnit = storage.get('SELECTED_OU');
- if($scope.selectedProgram){
+ if($scope.selectedProgram){
EnrollmentService.getByEntityAndProgram($scope.selectedTei.trackedEntityInstance, $scope.selectedProgram.id).then(function(data){
$scope.enrollments = data.enrollmentList;
$scope.loadEnrollmentDetails();
});
}
else{
- $scope.broadCastSelections();
+ $scope.broadCastSelections('dashboardWidgets');
}
});
@@ -84,7 +84,7 @@
}
}
- $scope.broadCastSelections();
+ $scope.broadCastSelections('dashboardWidgets');
};
$scope.showEnrollment = function(){
@@ -157,7 +157,7 @@
enrollment.enrollment = enrollmentResponse.reference;
$scope.selectedEnrollment = enrollment;
- $scope.broadCastSelections();
+ $scope.broadCastSelections('dashboardWidgets');
$scope.outerForm.submitted = false;
});
@@ -174,15 +174,16 @@
});
};
- $scope.broadCastSelections = function(){
+ $scope.broadCastSelections = function(listeners){
CurrentSelection.set({tei: $scope.selectedTei, te: $scope.selectedEntity, pr: $scope.selectedProgram, enrollment: $scope.selectedEnrollment});
$timeout(function() {
- $rootScope.$broadcast('dashboard', {});
- $rootScope.$broadcast('notesController', {});
+ $rootScope.$broadcast(listeners, {});
}, 100);
};
$scope.cancelEnrollment = function(){
- $scope.selectedProgram = '';
+ $scope.selectedProgram = null;
+ $scope.selectedEnrollment = null;
+ $scope.broadCastSelections('mainDashboard');
};
});
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js 2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js 2014-07-15 09:20:54 +0000
@@ -1,6 +1,5 @@
trackerCapture.controller('NotesController',
function($scope,
- $rootScope,
$filter,
storage,
EnrollmentService,
@@ -20,7 +19,7 @@
today = Date.parse(today);
today = $filter('date')(today, 'yyyy-MM-dd');
- $scope.$on('notesController', function(event, args) {
+ $scope.$on('dashboardWidgets', function(event, args) {
$scope.selectedEnrollment = null;
var selections = CurrentSelection.get();
if(selections.enrollment){
@@ -57,14 +56,12 @@
$scope.selectedEnrollment.notes.splice(0,0,{value: $scope.note, storedDate: today, storedBy: storedBy});
}
- var e = $scope.selectedEnrollment;
+ var e = angular.copy($scope.selectedEnrollment);
e.notes = [newNote];
EnrollmentService.update(e).then(function(data){
$scope.note = '';
- $scope.addNoteField = false; //note is added, hence no need to show note field.
- CurrentSelection.set({enrollment: $scope.selectedEnrollment});
- $rootScope.$broadcast('notesController', {});
+ $scope.addNoteField = false; //note is added, hence no need to show note field.
});
}
};
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js 2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js 2014-07-15 09:20:54 +0000
@@ -1,7 +1,6 @@
trackerCapture.controller('ProfileController',
function($rootScope,
$scope,
- orderByFilter,
CurrentSelection,
TEIService,
DialogService,
@@ -21,7 +20,7 @@
});
//listen for the selected entity
- $scope.$on('dashboard', function(event, args) {
+ $scope.$on('dashboardWidgets', function(event, args) {
var selections = CurrentSelection.get();
$scope.selectedTei = angular.copy(selections.tei);
$scope.trackedEntity = selections.te;
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2014-07-15 09:20:54 +0000
@@ -19,7 +19,7 @@
});
//listen for the selected entity
- $scope.$on('dashboard', function(event, args) {
+ $scope.$on('dashboardWidgets', function(event, args) {
$scope.selections = CurrentSelection.get();
$scope.selectedTei = angular.copy($scope.selections.tei);
$scope.trackedEntity = $scope.selections.te;
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js 2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js 2014-07-15 09:20:54 +0000
@@ -187,7 +187,7 @@
});
});
- $scope.$on('dashboard', function(event, args) {
+ $scope.$on('dashboardWidgets', function(event, args) {
var selections = CurrentSelection.get();
$scope.selectedOrgUnit = storage.get('SELECTED_OU');
$scope.selectedTei = selections.tei;