dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30456
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15453: synchronization between program selections and dashboard contents
------------------------------------------------------------
revno: 15453
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Wed 2014-05-28 15:51:22 +0200
message:
synchronization between program selections and dashboard contents
modified:
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/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-05-28 13:36:26 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2014-05-28 13:51:22 +0000
@@ -37,22 +37,22 @@
EnrollmentService.get($scope.selectedEntity.trackedEntityInstance).then(function(data){
$scope.enrollments = data.enrollmentList;
- });
+ if(selections.pr){
+ angular.forEach($scope.programs, function(program){
+ if(selections.pr.id === program.id){
+ $scope.selectedProgram = program;
+ $scope.loadEvents();
+ }
+ });
+ }
+ });
- if(selections.pr){
- angular.forEach($scope.programs, function(program){
- if(selections.pr.id === program.id){
- $scope.selectedProgram = program;
- $scope.loadEvents();
- }
- });
- }
});
$scope.loadEvents = function() {
if($scope.selectedProgram){
-
+
//check for possible enrollment
$scope.selectedEnrollment = '';
angular.forEach($scope.enrollments, function(enrollment){
@@ -71,14 +71,14 @@
$scope.programStages = [];
var incidentDate = $scope.selectedEnrollment ? $scope.selectedEnrollment.dateOfIncident : new Date();
- angular.forEach($scope.selectedProgram.programStages, function(stage){
+ angular.forEach($scope.selectedProgram.programStages, function(stage){
var ps = storage.get(stage.id);
ps.dueDate = moment(moment(incidentDate).add('d', ps.minDaysFromStart), 'YYYY-MM-DD')._d;
ps.dueDate = Date.parse(ps.dueDate);
ps.dueDate= $filter('date')(ps.dueDate, 'yyyy-MM-dd');
$scope.programStages.push(ps);
});
-
+
$rootScope.$broadcast('dashboard', {selectedEntity: $scope.selectedEntity,
selectedOrgUnit: $scope.selectedOrgUnit,
selectedProgramId: $scope.selectedProgram.id,
@@ -96,14 +96,10 @@
$scope.showEnrollment = function(){
$scope.showEnrollmentDiv = !$scope.showEnrollmentDiv;
-
- console.log('Enrollment', $scope.selectedEntity, ' ', $scope.selectedProgram);
};
$scope.showScheduling = function(){
$scope.showSchedulingDiv = !$scope.showSchedulingDiv;
-
- console.log('Scheduling', $scope.selectedEntity, ' ', $scope.selectedProgram);
};
$scope.enroll = function(){
@@ -171,9 +167,6 @@
return;
}
});
-
- console.log('tei', tei, ' ');
- console.log('scope', $scope.selectedEntity, ' ');
};
$scope.cancelEnrollment = function(){