dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42392
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21676: Bugfix - program stage ordering in rules. Some refactor and cleanup
------------------------------------------------------------
revno: 21676
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2016-01-08 18:45:04 +0100
message:
Bugfix - program stage ordering in rules. Some refactor and cleanup
modified:
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/default-form.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.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 2016-01-08 13:43:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2016-01-08 17:45:04 +0000
@@ -53,6 +53,7 @@
$scope.hiddenSections = {};
$scope.tableMaxNumberOfDataElements = 7;
$scope.xVisitScheduleDataElement = false;
+ $scope.reSortStageEvents = true;
$scope.eventsLoaded = false;
@@ -268,15 +269,15 @@
$scope.executeRules = function () {
//$scope.allEventsSorted cannot be used, as it is not reflecting updates that happened within the current session
- /*var allSorted = [];
+ var allSorted = [];
for(var ps = 0; ps < $scope.programStages.length; ps++ ) {
- for(var e = 0; e < $scope.eventsByStageAsc[$scope.programStages[ps].id].length; e++) {
- allSorted.push($scope.eventsByStageAsc[$scope.programStages[ps].id][e]);
+ for(var e = 0; e < $scope.eventsByStage[$scope.programStages[ps].id].length; e++) {
+ allSorted.push($scope.eventsByStage[$scope.programStages[ps].id][e]);
}
}
- allSorted = orderByFilter(allSorted, '-sortingDate').reverse();*/
+ allSorted = orderByFilter(allSorted, '-sortingDate').reverse();
- var evs = {all: $scope.allEventsSorted, byStage: $scope.eventsByStageAsc};
+ var evs = {all: allSorted, byStage: $scope.eventsByStage};
var flag = {debug: true, verbose: true};
//If the events is displayed in a table, it is necessary to run the rules for all visible events.
@@ -304,7 +305,7 @@
$scope.allowEventCreation = false;
$scope.repeatableStages = [];
$scope.eventsByStage = [];
- $scope.eventsByStageAsc = [];
+ $scope.eventsByStageDesc = [];
$scope.programStages = [];
$rootScope.ruleeffects = {};
$scope.prStDes = [];
@@ -571,87 +572,45 @@
return;
}
- }
-
- var modalInstance = $modal.open({
- templateUrl: 'components/dataentry/new-event.html',
- controller: 'EventCreationController',
- resolve: {
- eventsByStage: function () {
- return $scope.eventsByStage;
- },
- stage: function () {
- return stage;
- },
- stages: function(){
- return availableStages;
- },
- allStages: function(){
- return $scope.programStages;
- },
- tei: function(){
- return $scope.selectedEntity;
- },
- program: function(){
- return $scope.selectedProgram;
- },
- orgUnit: function(){
- return $scope.selectedOrgUnit;
- },
- enrollment: function(){
- return $scope.selectedEnrollment;
- },
- autoCreate: function () {
- //In case the programstage is a table, autocreate
- return stage && stage.displayEventsInTable ? stage.displayEventsInTable : false;
- },
- eventCreationAction: function(){
- return eventCreationAction;
- },
- events: function(){
- return $scope.allEventsSorted;
- },
- suggestedStage: function(){
- return suggestedStage;
- }
- }
- });
-
- modalInstance.result.then(function (eventContainer) {
-
- if(angular.isDefined(eventContainer)){
- var ev = eventContainer.ev;
- var dummyEvent = eventContainer.dummyEvent;
-
- if (angular.isObject(ev) && angular.isObject(dummyEvent)) {
-
- var newEvent = ev;
- newEvent.orgUnitName = dummyEvent.orgUnitName;
- newEvent.name = dummyEvent.name;
- newEvent.excecutionDateLabel = dummyEvent.excecutionDateLabel;
- newEvent.sortingDate = ev.eventDate ? ev.eventDate : ev.dueDate,
- newEvent.statusColor = EventUtils.getEventStatusColor(ev);
- newEvent.eventDate = DateUtils.formatFromApiToUser(ev.eventDate);
- newEvent.dueDate = DateUtils.formatFromApiToUser(ev.dueDate);
- newEvent.enrollmentStatus = dummyEvent.enrollmentStatus;
-
- if (dummyEvent.coordinate) {
- newEvent.coordinate = {};
+ }
+ var autoCreate = stage && stage.displayEventsInTable ? stage.displayEventsInTable : false;
+ EventCreationService.showModal($scope.eventsByStage, stage, availableStages, $scope.programStages, $scope.selectedEntity, $scope.selectedProgram, $scope.selectedOrgUnit, $scope.selectedEnrollment, autoCreate, eventCreationAction, $scope.allEventsSorted,suggestedStage)
+ .then(function (eventContainer) {
+ if(angular.isDefined(eventContainer)){
+ var ev = eventContainer.ev;
+ var dummyEvent = eventContainer.dummyEvent;
+
+ if (angular.isObject(ev) && angular.isObject(dummyEvent)) {
+
+ var newEvent = ev;
+ newEvent.orgUnitName = dummyEvent.orgUnitName;
+ newEvent.name = dummyEvent.name;
+ newEvent.excecutionDateLabel = dummyEvent.excecutionDateLabel;
+ newEvent.sortingDate = ev.eventDate ? ev.eventDate : ev.dueDate,
+ newEvent.statusColor = EventUtils.getEventStatusColor(ev);
+ newEvent.eventDate = DateUtils.formatFromApiToUser(ev.eventDate);
+ newEvent.dueDate = DateUtils.formatFromApiToUser(ev.dueDate);
+ newEvent.enrollmentStatus = dummyEvent.enrollmentStatus;
+
+ if (dummyEvent.coordinate) {
+ newEvent.coordinate = {};
+ }
+
+ //get stage from created event
+ $scope.currentStage = $scope.stagesById[dummyEvent.programStage];
+
+ $scope.addNewEvent(newEvent);
+
+ $scope.currentEvent = null;
+ $scope.showDataEntry(newEvent, true);
+
+
+ //show page with event in event-layout
+ $scope.getEventPageForEvent(newEvent);
+ }
}
-
- //get stage from created event
- $scope.currentStage = $scope.stagesById[dummyEvent.programStage];
-
- $scope.addNewEvent(newEvent);
-
- $scope.currentEvent = null;
- $scope.showDataEntry(newEvent, true);
- //show page with event in event-layout
- $scope.getEventPageForEvent(newEvent);
- }
- }
- }, function () {
- });
+ }, function () {
+ });
};
$scope.showDataEntry = function (event, suppressToggling) {
@@ -713,8 +672,7 @@
$scope.tableEditModes = { form: 0, table: 1, tableAndForm: 2 };
$scope.tableEditMode = $scope.tableEditModes.form;
- $scope.toggleTableEditMode = function(){
- $scope.currentEvent = {};
+ $scope.toggleTableEditMode = function(){
$scope.tableEditMode = $scope.tableEditMode === $scope.tableEditModes.tableAndForm ? $scope.tableEditModes.form : $scope.tableEditModes.tableAndForm;
};
@@ -723,12 +681,12 @@
if($scope.currentEvent !== event){
$scope.eventRowChanged = true;
+ $scope.switchToEventRow(event);
}
else {
$scope.eventRowChanged = false;
- }
-
- $scope.switchToEventRow(event);
+ }
+
if($scope.tableEditMode === $scope.tableEditModes.form){
$scope.openEventEditFormModal(event);
}
@@ -764,14 +722,16 @@
$scope.switchToEventRowDeselected = function(event){
if($scope.currentEvent !== event) {
- $scope.showDataEntry(event,true);
+ $scope.showDataEntry(event,false);
}
$scope.currentEvent = {};
};
$scope.switchToEventRow = function (event) {
if($scope.currentEvent !== event) {
- $scope.showDataEntry(event,true);
+ $scope.reSortStageEvents = false;
+ $scope.showDataEntry(event,false);
+ $scope.reSortStageEvents = true;
}
};
@@ -786,11 +746,11 @@
//Build a list of datavalues OUTSIDE the current event.
angular.forEach($scope.currentStage.programStageDataElements, function(programStageDataElement) {
angular.forEach($scope.programStages, function(stage) {
- for(var i = 0; i < $scope.eventsByStageAsc[stage.id].length; i++) {
+ for(var i = 0; i < $scope.eventsByStage[stage.id].length; i++) {
//We are not interested in the values from the current stage:
- if($scope.eventsByStageAsc[stage.id][i] !== $scope.currentEvent) {
+ if($scope.eventsByStage[stage.id][i] !== $scope.currentEvent) {
var currentId = programStageDataElement.dataElement.id;
- if ( $scope.eventsByStageAsc[stage.id][i][currentId] ) {
+ if ( $scope.eventsByStage[stage.id][i][currentId] ) {
//The current stage has a dataelement of the type in question
//Init the list if not already done:
@@ -800,12 +760,12 @@
//Decorate and push the alternate value to the list:
- var alternateValue = $scope.eventsByStageAsc[stage.id][i][currentId];
+ var alternateValue = $scope.eventsByStage[stage.id][i][currentId];
alternateValue = CommonUtils.displayBooleanAsYesNo(alternateValue, programStageDataElement.dataElement);
+
//Else decorate with the event date:
- alternateValue = $scope.eventsByStageAsc[stage.id][i].eventDate + ': ' + alternateValue;
-
+ alternateValue = $scope.eventsByStage[stage.id][i].eventDate + ': ' + alternateValue;
otherValues[currentId].push(alternateValue);
}
}
@@ -850,13 +810,21 @@
angular.forEach($scope.currentStage.programStageSections, function (section) {
section.open = true;
});
-
+
+ $scope.setDisplayTypeForStage($scope.currentStage);
+
$scope.customForm = CustomFormService.getForProgramStage($scope.currentStage, $scope.prStDes);
$scope.displayCustomForm = "DEFAULT";
if ($scope.customForm) {
$scope.displayCustomForm = "CUSTOM";
}
else if ($scope.currentStage.displayEventsInTable) {
+ if($scope.reSortStageEvents === true){
+ sortStageEvents($scope.currentStage);
+ if($scope.eventsByStage.hasOwnProperty($scope.currentStage.id)){
+ $scope.currentStageEvents = $scope.eventsByStage[$scope.currentStage.id];
+ }
+ }
$scope.displayCustomForm = "TABLE";
}
@@ -867,7 +835,6 @@
var period = {event: $scope.currentEvent.event, stage: $scope.currentEvent.programStage, name: $scope.currentEvent.sortingDate};
$scope.currentPeriod[$scope.currentEvent.programStage] = period;
- $scope.setDisplayTypeForStage($scope.currentStage);
//Execute rules for the first time, to make the initial page appear correctly.
//Subsequent calls will be made from the "saveDataValue" function.
$scope.executeRules();
@@ -965,8 +932,8 @@
//check for input validity
$scope.updateSuccess = false;
}
-
- if (field && field.$invalid) {
+ if (field && field.$invalid && angular.isDefined(value) && value !== "") {
+ $scope.currentElement = {id: prStDe.dataElement.id, saved: false, event: eventToSave.event};
return false;
}
@@ -1107,7 +1074,11 @@
$scope.invalidDate = false;
$scope.eventDateSaved = eventToSave.event;
eventToSave.statusColor = EventUtils.getEventStatusColor(eventToSave);
- sortEventsByStage('UPDATE');
+
+ if(angular.isUndefined($scope.currentStage.displayEventsInTable) || $scope.currentStage.displayEventsInTable === false){
+ sortEventsByStage('UPDATE');
+ }
+
$scope.validatedDateSetForEvent = {date: eventToSave.eventDate, event: eventToSave};
$scope.currentElement = {id: "eventDate", event: eventToSave.event, saved: true};
$scope.executeRules();
@@ -1480,7 +1451,8 @@
$scope.executeCompleteIncompleteEvent = function(dhis2Event, backToDashboard){
- DHIS2EventFactory.update(dhis2Event).then(function (data) {
+ return DHIS2EventFactory.update(dhis2Event).then(function (data) {
+
if(backToDashboard){
selection.load();
$location.path('/').search({program: $scope.selectedProgramId});
@@ -1676,6 +1648,29 @@
var d = dhis2Event.sortingDate;
return DateUtils.getDate(d);
};
+
+ var sortStageEvents = function(stage){
+ var key = stage.id;
+ if ($scope.eventsByStage.hasOwnProperty(key)){
+ var sortedEvents = $filter('orderBy')($scope.eventsByStage[key], function (event) {
+ if(angular.isDefined(stage.displayEventsInTable) && stage.displayEventsInTable === true){
+ return DateUtils.getDate(event.eventDate);
+ }
+ else{
+ return DateUtils.getDate(event.sortingDate);
+ }
+ }, false);
+ $scope.eventsByStage[key] = sortedEvents;
+ $scope.eventsByStageDesc[key] = [];
+
+ //Reverse the order of events, but keep the objects within the array.
+ //angular.copy and reverse did not work - this messed up databinding.
+ angular.forEach(sortedEvents, function(sortedEvent) {
+ $scope.eventsByStageDesc[key].splice(0,0,sortedEvent);
+ });
+ return sortedEvents;
+ }
+ }
var sortEventsByStage = function (operation, newEvent) {
@@ -1683,22 +1678,10 @@
for (var key in $scope.eventsByStage) {
- var stage = $scope.stagesById[key];
-
+ var stage = $scope.stagesById[key];
+ var sortedEvents = sortStageEvents(stage);
if ($scope.eventsByStage.hasOwnProperty(key) && stage) {
-
- var sortedEvents = $filter('orderBy')($scope.eventsByStage[key], function (event) {
- return DateUtils.getDate(event.sortingDate);
- }, true);
-
- $scope.eventsByStage[key] = sortedEvents;
- $scope.eventsByStageAsc[key] = [];
- //Reverse the order of events, but keep the objects within the array.
- //angular.copy and reverse did not work - this messed up databinding.
- angular.forEach(sortedEvents, function(sortedEvent) {
- $scope.eventsByStageAsc[key].splice(0,0,sortedEvent);
- });
-
+
var periods = PeriodService.getPeriods(sortedEvents, stage, $scope.selectedEnrollment).occupiedPeriods;
$scope.eventPeriods[key] = periods;
@@ -1849,7 +1832,9 @@
$scope.deselectCurrent = function(id){
if($scope.currentEvent && $scope.currentEvent.event === id){
- $scope.currentEvent = {};
+ $scope.currentEvent = {};
+ sortStageEvents($scope.currentStage);
+ $scope.currentStageEvents = $scope.eventsByStage[$scope.currentStage.id];
}
};
@@ -1866,8 +1851,7 @@
DialogService.showDialog({}, dialogOptions);
};
})
-
-.controller('EventOptionsInTableController', function($scope){
+.controller('EventOptionsInTableController', function($scope, $translate){
var COMPLETE = "Complete";
var INCOMPLETE = "Incomplete";
@@ -1979,4 +1963,4 @@
$scope.eventTableOptionsArr[$scope.eventTableOptions[key].sort] = $scope.eventTableOptions[key];
}
}
-});
\ No newline at end of file
+});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2016-01-08 13:43:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2016-01-08 17:45:04 +0000
@@ -1,5 +1,5 @@
-<form name="outerForm" novalidate>
- <table class="dhis2-list-table-striped dhis2-table-hover" ng-if='currentEvent && !currentStage.programStageSections.length'>
+<form name="outerForm" novalidate>
+ <table class="dhis2-list-table-striped default-form-table dhis2-table-hover" ng-if='currentEvent && !currentStage.programStageSections.length'>
<thead>
<tr>
<th ng-bind="dataElementLabel">
@@ -10,7 +10,7 @@
</th>
</tr>
</thead>
- <tr class="col-md-12" ng-repeat="prStDe in currentStage.programStageDataElements" ng-if="!isHidden(prStDe.dataElement.id, currentEvent)">
+ <tr class="col-md-12" ng-repeat="prStDe in currentStage.programStageDataElements" ng-if="!isHidden(prStDe.dataElement.id, currentEvent)">
<td>
<span ng-bind="prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name"></span>
<span class="hideInPrint">
@@ -196,6 +196,9 @@
dh-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id] === true"
dh-value="currentEvent[prStDe.dataElement.id]"
dh-name="foo"
+ dh-current-element="currentElement"
+ dh-event="currentEvent.event"
+ dh-id="prStDe.dataElement.id"
dh-click="saveDataValueForRadio(prStDe, currentEvent, value)">
</dhis2-radio-button>
</div>
@@ -309,14 +312,14 @@
<div class="alert alert-warning">{{'section'| translate}} {{section.name}} {{'has_no_dataelements'| translate}}</div>
</div>
- <table class="dhis2-list-table-striped dhis2-table-hover" ng-if="section.programStageDataElements && section.programStageDataElements.length > 0">
+ <table class="dhis2-list-table-striped default-form-table dhis2-table-hover" ng-if="section.programStageDataElements && section.programStageDataElements.length > 0">
<thead>
<tr>
<th ng-bind="dataElementLabel">
</th>
<th class="" ng-bind="valueLabel">
</th>
- <th class="form-narrow-column" class="" ng-if="allowProvidedElsewhereExists[currentStage.id]" ng-bind="providedElsewhereLabel">
+ <th class="form-narrow-column" ng-if="allowProvidedElsewhereExists[currentStage.id]" ng-bind="providedElsewhereLabel">
</th>
</tr>
</thead>
@@ -477,6 +480,9 @@
dh-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id] === true"
dh-value="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
dh-name="foo"
+ dh-current-element="currentElement"
+ dh-event="currentEvent.event"
+ dh-id="de.dataElement.id"
dh-click="saveDataValueForRadio(prStDes[de.dataElement.id], currentEvent, value)">
</dhis2-radio-button>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2015-12-17 16:15:10 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2016-01-08 17:45:04 +0000
@@ -51,7 +51,8 @@
'EventUtils',
'DHIS2EventFactory',
'DialogService',
- function($scope, $element, $attrs, $q, EventUtils, DHIS2EventFactory, DialogService){
+ '$translate',
+ function($scope, $element, $attrs, $q, EventUtils, DHIS2EventFactory, DialogService, $translate){
$scope.EVENTSTATUSCOMPLETELABEL = "COMPLETED";
$scope.EVENTSTATUSSKIPPEDLABEL = "SKIPPED";
@@ -426,8 +427,11 @@
required: '=dhRequired',
value: '=dhValue',
disabled: '=dhDisabled',
- name: '@dhName',
- customOnClick: '&dhClick'
+ name: '@dhName',
+ customOnClick: '&dhClick',
+ currentElement: '=dhCurrentElement',
+ event: '=dhEvent',
+ id: '=dhId'
},
controller: [
'$scope',
@@ -437,7 +441,7 @@
'CommonUtils',
function($scope, $element, $attrs, $q, CommonUtils){
- $scope.status = "";
+ $scope.status = "";
$scope.clickedButton = "";
$scope.valueClicked = function (buttonValue){
@@ -455,7 +459,7 @@
if(angular.isDefined(promise) && angular.isDefined(promise.then)){
promise.then(function(status){
if(angular.isUndefined(status) || status !== "notSaved"){
- $scope.status = "saved";
+ $scope.status = "saved";
}
$scope.value = tempValue;
}, function(){
@@ -501,19 +505,31 @@
if(scope.value !== ""){
if(scope.status === "saved"){
- if(scope.clickedButton === buttonValue){
- return 'radio-save-success';
- }
- }
+ if(angular.isUndefined(scope.currentElement) || (scope.currentElement.id === scope.id && scope.currentElement.event === scope.event)){
+ if(scope.clickedButton === buttonValue){
+ return 'radio-save-success';
+ }
+ }
//different solution with text chosen
/*else if(scope.status === "error"){
if(scope.clickedButton === buttonValue){
return 'radio-save-error';
}
}*/
+ }
}
return 'radio-white';
};
+
+ scope.errorStatus = function(){
+
+ if(scope.status === 'error'){
+ if(angular.isUndefined(scope.currentElement) || (scope.currentElement.id === scope.id && scope.currentElement.event === scope.event)){
+ return true;
+ }
+ }
+ return false;
+ };
scope.radioButtonImage = function(buttonValue){
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2016-01-07 17:56:29 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2016-01-08 17:45:04 +0000
@@ -1705,7 +1705,8 @@
//generate grid column for the selected program/attributes
angular.forEach(columns, function(column){
column.attribute = angular.isUndefined(column.attribute) ? true : false;
- column.show = false;
+ column.show = false;
+
if( (column.id === 'orgUnitName' && ouMode !== 'SELECTED') ||
column.displayInListNoProgram ||
column.displayInList){
@@ -1870,7 +1871,7 @@
},
autoGenerateEvents: function(teiId, program, orgUnit, enrollment){
var dhis2Events = {events: []};
- if(teiId && program && orgUnit && enrollment){
+ if(teiId && program && orgUnit && enrollment){
angular.forEach(program.programStages, function(stage){
if(stage.autoGenerateEvent){
var newEvent = {
@@ -1906,7 +1907,7 @@
}
return dhis2Events;
- },
+ },
reconstruct: function(dhis2Event, programStage, optionSets){
var e = {dataValues: [],
@@ -1980,26 +1981,49 @@
.service('EventCreationService', function($modal){
- this.showModal = function(stage, dummyEvent,eventCreationAction, autoCreate){
+ this.showModal = function(eventsByStage, stage, availableStages,programStages,selectedEntity,selectedProgram,selectedOrgUnit,selectedEnrollment, autoCreate, eventCreationAction,allEventsSorted, suggestedStage){
var modalInstance = $modal.open({
templateUrl: 'components/dataentry/new-event.html',
controller: 'EventCreationController',
resolve: {
- dummyEvent: function () {
- return dummyEvent;
+ eventsByStage: function () {
+ return eventsByStage;
+ },
+ stage: function () {
+ return stage;
+ },
+ stages: function(){
+ return availableStages;
+ },
+ allStages: function(){
+ return programStages;
+ },
+ tei: function(){
+ return selectedEntity;
+ },
+ program: function(){
+ return selectedProgram;
+ },
+ orgUnit: function(){
+ return selectedOrgUnit;
+ },
+ enrollment: function(){
+ return selectedEnrollment;
},
autoCreate: function () {
- //In case the programstage is a table, autocreate
return autoCreate;
},
- eventCreationAction: function() {
+ eventCreationAction: function(){
return eventCreationAction;
- },
- stage: function(){
- return stage;
+ },
+ events: function(){
+ return allEventsSorted;
+ },
+ suggestedStage: function(){
+ return suggestedStage;
}
}
- });
+ }).result;
return modalInstance;
};
this.eventCreationActions = { add: 'ADD', schedule: 'SCHEDULE', referral: 'REFERRAL'};
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2016-01-02 08:44:30 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2016-01-08 17:45:04 +0000
@@ -983,7 +983,6 @@
programVariables = programVariables.concat(allProgramRules.programIndicators.variables);
angular.forEach(programVariables, function(programVariable) {
-
var dataElementId = programVariable.dataElement;
if(programVariable.dataElement && programVariable.dataElement.id) {
dataElementId = programVariable.dataElement.id;