dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36231
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18548: tracker-capture: always (re)sort events when their due/event-date is changed
------------------------------------------------------------
revno: 18548
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-10 11:07:03 +0100
message:
tracker-capture: always (re)sort events when their due/event-date is changed
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 2015-03-09 15:56:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-03-10 10:07:03 +0000
@@ -109,12 +109,12 @@
dhis2Event.statusColor = EventUtils.getEventStatusColor(dhis2Event);
dhis2Event = processEvent(dhis2Event, eventStage);
+ $scope.eventsByStage[dhis2Event.programStage].push(dhis2Event);
if($scope.currentStage && $scope.currentStage.id === dhis2Event.programStage){
$scope.currentEvent = dhis2Event;
$scope.showDataEntry($scope.currentEvent, true);
}
- $scope.eventsByStage[dhis2Event.programStage].push(dhis2Event);
}
}
});
@@ -401,6 +401,7 @@
$scope.invalidDate = false;
$scope.eventDateSaved = true;
$scope.currentEvent.statusColor = EventUtils.getEventStatusColor($scope.currentEvent);
+ sortEventsByStage();
});
};
@@ -436,6 +437,7 @@
$scope.currentEvent.sortingDate = $scope.currentEvent.dueDate;
$scope.currentEvent.statusColor = EventUtils.getEventStatusColor($scope.currentEvent);
$scope.schedulingEnabled = !$scope.schedulingEnabled;
+ sortEventsByStage();
});
};
@@ -641,6 +643,7 @@
}
$scope.eventsByStage[$scope.currentEvent.programStage].splice(index,1);
$scope.currentEvent = null;
+ sortEventsByStage();
});
});
};
@@ -669,6 +672,11 @@
if($scope.eventsByStage.hasOwnProperty(key)){
$scope.eventsByStage[key] = orderByFilter($scope.eventsByStage[key], '-sortingDate').reverse();
$scope.totalEvents += $scope.eventsByStage[key].length <=1 ? 1:$scope.eventsByStage[key].length;
+
+ console.log('the stage: ', key);
+ angular.forEach($scope.eventsByStage[key], function(stage){
+ console.log('event: ', stage.sortingDate);
+ });
}
}
};