dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42061
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21487: Merge of the dataentry changes made in folkehelsa branch
------------------------------------------------------------
revno: 21487
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-12-17 16:00:48 +0100
message:
Merge of the dataentry changes made in folkehelsa branch
added:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/eventstatus-in-table.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/modal-default-form.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/referral-modal.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dhis2-radio-button.html
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-buttons.html
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.html
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/event-details.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-layout.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/new-event.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-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-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css
--
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-buttons.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-buttons.html 2015-12-16 10:52:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-buttons.html 2015-12-17 15:00:48 +0000
@@ -1,3 +1,4 @@
+<!-- data entry/event buttons begins -->
<div class="form-group hideInPrint" ng-if="displayCustomForm !== 'TABLE'">
<div class='row'><hr></div>
<a href ng-click="completeIncompleteEvent()"
@@ -6,8 +7,12 @@
ng-if="currentEvent.eventDate && (currentEvent.status === 'SCHEDULE' || currentEvent.status === 'ACTIVE' || currentEvent.status === 'VISITED')">{{'complete'| translate}}</a>
<a href ng-click="completeIncompleteEvent()"
class="btn btn-warning"
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed && currentEvent.status !== 'COMPLETED' || currentEvent.orgUnit !== selectedOrgUnit.id"
- ng-if="currentEvent.eventDate && currentEvent.status === 'COMPLETED'">{{'incomplete'| translate}}</a>
+ ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed && currentEvent.status !== 'COMPLETED' || currentEvent.orgUnit !== selectedOrgUnit.id"
+ ng-if="currentEvent.eventDate && currentEvent.status === 'COMPLETED'">{{'incomplete'| translate}}</a>
+ <!--<a href ng-click="validateEvent()"
+ class="btn btn-info"
+ ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id"
+ ng-if="currentEvent.eventDate">{{'validate'| translate}}</a> -->
<a href ng-click="skipUnskipEvent()"
class="btn btn-warning"
ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id"
=== 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-12-16 14:44:28 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-12-17 15:00:48 +0000
@@ -23,7 +23,9 @@
TrackerRulesExecutionService,
CustomFormService,
PeriodService,
- TrackerRulesFactory) {
+ TrackerRulesFactory,
+ EventCreationService,
+ $q) {
$scope.maxOptionSize = 30;
$scope.dashboardReady = false;
@@ -36,7 +38,7 @@
$scope.eventPeriods = [];
$scope.currentPeriod = [];
$scope.filterEvents = true;
- $scope.showEventsAsTables = false;
+ $scope.showEventsAsTables = true;
//variable is set while looping through the program stages later.
$scope.stagesCanBeShownAsTable = false;
$scope.showHelpText = {};
@@ -46,6 +48,8 @@
$scope.warningMessages = {};
$scope.hiddenSections = {};
$scope.tableMaxNumberOfDataElements = 10;
+ $scope.xVisitScheduleDataElement = false;
+
//Labels
$scope.dataElementLabel = $translate.instant('data_element');
@@ -58,7 +62,8 @@
$scope.EVENTSTATUSACTIVELABEL = "ACTIVE";
$scope.EVENTSTATUSSCHEDULELABEL = "SCHEDULE";
$scope.validatedDateSetForEvent = {};
-
+ $scope.eventCreationActions = EventCreationService.eventCreationActions;
+
var userProfile = SessionStorageService.get('USER_PROFILE');
var storedBy = userProfile && userProfile.username ? userProfile.username : '';
@@ -80,6 +85,7 @@
//listen for new events created
$scope.$on('eventcreated', function (event, args) {
+ //TODO: Sort this out:
$scope.addNewEvent(args.event);
});
@@ -92,10 +98,22 @@
//listen for rule effect changes
$scope.$on('ruleeffectsupdated', function (event, args) {
if ($rootScope.ruleeffects[args.event]) {
- processRuleEffect(args.event);
+ processRuleEffect(args.event);
}
});
+ $scope.showReferral = false;
+ //Check if user is allowed to make referrals
+ var roles = SessionStorageService.get('USER_ROLES');
+ if( roles && roles.userCredentials && roles.userCredentials.userRoles){
+ var userRoles = roles.userCredentials.userRoles;
+ for(var i=0; i<userRoles.length; i++){
+ if(userRoles[i].authorities.indexOf('ALL') !== -1 || userRoles[i].authorities.indexOf('F_TRACKED_ENTITY_INSTANCE_SEARCH_IN_ALL_ORGUNITS') !== -1 ){
+ $scope.showReferral = true;
+ i=userRoles.length;
+ }
+ }
+ }
$scope.model= {};
$scope.print = function(divName){
@@ -115,12 +133,12 @@
};
-
var processRuleEffect = function(event){
//Establish which event was affected:
var affectedEvent = $scope.currentEvent;
//In most cases the updated effects apply to the current event. In case the affected event is not the current event, fetch the correct event to affect:
- if(event==='registration') return;
+ if(event === 'registration') return;
+
if (event !== affectedEvent.event) {
angular.forEach($scope.currentStageEvents, function (searchedEvent) {
if (searchedEvent.event === event) {
@@ -129,16 +147,18 @@
});
}
- $scope.assignedFields = [];
- $scope.hiddenSections = [];
- $scope.warningMessages = [];
- $scope.errorMessages = [];
- $scope.hiddenFields = [];
+ $scope.assignedFields[event] = [];
+ $scope.hiddenSections[event] = [];
+ $scope.warningMessages[event] = [];
+ $scope.errorMessages[event] = [];
+ $scope.hiddenFields[event] = [];
+
angular.forEach($rootScope.ruleeffects[event], function (effect) {
if (effect.dataElement) {
//in the data entry controller we only care about the "hidefield", showerror and showwarning actions
- if (effect.action === "HIDEFIELD") {
+ if (effect.action === "HIDEFIELD") {
if (effect.dataElement) {
+
if (effect.ineffect && affectedEvent[effect.dataElement.id]) {
//If a field is going to be hidden, but contains a value, we need to take action;
if (effect.content) {
@@ -154,9 +174,14 @@
affectedEvent[effect.dataElement.id] = "";
$scope.saveDatavalueForEvent($scope.prStDes[effect.dataElement.id], null, affectedEvent);
}
+
if(effect.ineffect) {
- $scope.hiddenFields[effect.dataElement.id] = true;
+ $scope.hiddenFields[event][effect.dataElement.id] = true;
+ }
+ else if( !$scope.hiddenFields[event][effect.dataElement.id]) {
+ $scope.hiddenFields[event][effect.dataElement.id] = false;
}
+
}
else {
$log.warn("ProgramRuleAction " + effect.id + " is of type HIDEFIELD, bot does not have a dataelement defined");
@@ -164,10 +189,10 @@
} else if (effect.action === "SHOWERROR") {
if (effect.ineffect) {
- if(effect.dataElement) {
- var message = effect.content + (effect.data ? effect.data : "");
- $scope.errorMessages[effect.dataElement.id] = message;
- $scope.errorMessages.push($translate.instant($scope.prStDes[effect.dataElement.id].dataElement.name) + ": " + message);
+ if(effect.dataElement) {
+ var message = effect.content;
+ $scope.errorMessages[event][effect.dataElement.id] = message;
+ $scope.errorMessages[event].push($translate.instant($scope.prStDes[effect.dataElement.id].dataElement.name) + ": " + message);
}
else
{
@@ -180,19 +205,19 @@
} else if (effect.action === "SHOWWARNING") {
if (effect.ineffect) {
if(effect.dataElement) {
- var message = effect.content + (effect.data ? effect.data : "");
- $scope.warningMessages[effect.dataElement.id] = message;
- $scope.warningMessages.push($translate.instant($scope.prStDes[effect.dataElement.id].dataElement.name) + ": " + message);
+ var message = effect.content;
+ $scope.warningMessages[event][effect.dataElement.id] = message;
+ $scope.warningMessages[event].push($translate.instant($scope.prStDes[effect.dataElement.id].dataElement.name) + ": " + message);
} else {
- $scope.warningMessages.push(message);
+ $scope.warningMessages[event].push(message);
}
}
} else if (effect.action === "HIDESECTION"){
if(effect.programStageSection){
if(effect.ineffect){
- $scope.hiddenSections[effect.programStageSection] = true;
+ $scope.hiddenSections[event][effect.programStageSection] = true;
} else{
- $scope.hiddenSections[effect.programStageSection] = false;
+ $scope.hiddenSections[event][effect.programStageSection] = false;
}
}
else {
@@ -202,8 +227,9 @@
if(effect.ineffect && effect.dataElement) {
//For "ASSIGN" actions where we have a dataelement, we save the calculated value to the dataelement:
//Blank out the value:
- affectedEvent[effect.dataElement.id] = effect.data;
- $scope.assignedFields[effect.dataElement.id] = true;
+ var processedValue = $filter('trimquotes')(effect.data);
+ affectedEvent[effect.dataElement.id] = processedValue;
+ $scope.assignedFields[event][effect.dataElement.id] = true;
$scope.saveDatavalueForEvent($scope.prStDes[effect.dataElement.id], null, affectedEvent);
}
}
@@ -212,18 +238,26 @@
};
//check if field is hidden
- $scope.isHidden = function (id) {
+ $scope.isHidden = function (id, event) {
//In case the field contains a value, we cant hide it.
//If we hid a field with a value, it would falsely seem the user was aware that the value was entered in the UI.
- if ($scope.currentEvent[id]) {
+ var EventToCheck = angular.isDefined(event) ? event : $scope.currentEvent;
+
+ if (EventToCheck[id]) {
return false;
}
- else {
- return $scope.hiddenFields[id];
+ else {
+ if(angular.isDefined($scope.hiddenFields[EventToCheck.event])){
+ return $scope.hiddenFields[EventToCheck.event][id];
+ }
+ else {
+ return false;
+ }
}
};
- $scope.executeRules = function () {
+ $scope.executeRules = function () {
+
//$scope.allEventsSorted cannot be used, as it is not reflecting updates that happened within the current session
var allSorted = [];
for(var ps = 0; ps < $scope.programStages.length; ps++ ) {
@@ -234,11 +268,13 @@
allSorted = orderByFilter(allSorted, '-sortingDate').reverse();
var evs = {all: allSorted, byStage: $scope.eventsByStageAsc};
- var flag = {debug: true, verbose: false};
- //If the events is displayed in a table, it is necessary to run the rules for all visible events.
- if ($scope.currentStage.displayEventsInTable) {
+ 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.
+ if ($scope.currentStage.displayEventsInTable && angular.isUndefined($scope.currentStage.rulesExecuted)){
angular.forEach($scope.currentStageEvents, function (event) {
TrackerRulesExecutionService.executeRules($scope.allProgramRules, event, evs, $scope.prStDes, $scope.selectedTei, $scope.selectedEnrollment, flag);
+ $scope.currentStage.rulesExecuted = true;
});
} else {
TrackerRulesExecutionService.executeRules($scope.allProgramRules, $scope.currentEvent, evs, $scope.prStDes, $scope.selectedTei, $scope.selectedEnrollment, flag);
@@ -265,17 +301,18 @@
$scope.prStDes = [];
$scope.allProgramRules = [];
$scope.allowProvidedElsewhereExists = [];
-
+
var selections = CurrentSelection.get();
- $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
+ $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
$scope.selectedEntity = selections.tei;
$scope.selectedProgram = selections.pr;
- $scope.selectedEnrollment = selections.selectedEnrollment;
+ $scope.selectedEnrollment = selections.selectedEnrollment;
$scope.optionSets = selections.optionSets;
$scope.stagesById = [];
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) {
if (stage.openAfterEnrollment) {
@@ -303,9 +340,12 @@
$scope.currentStage = $scope.programStages[0];
}
+ $scope.setDisplayTypeForStages();
+
TrackerRulesFactory.getRules($scope.selectedProgram.id).then(function(rules){
- $scope.allProgramRules = rules;
- $scope.getEvents();
+ $scope.allProgramRules = rules;
+ $scope.getEvents();
+ $rootScope.$broadcast('dataEntryControllerData', {programStages: $scope.programStages, eventsByStage: $scope.eventsByStage, addNewEvent: $scope.addNewEvent });
});
});
}
@@ -315,9 +355,9 @@
var events = CurrentSelection.getSelectedTeiEvents();
events = $filter('filter')(events, {program: $scope.selectedProgram.id});
-
if (angular.isObject(events)) {
angular.forEach(events, function (dhis2Event) {
+ var multiSelectsFound = [];
if (dhis2Event.enrollment === $scope.selectedEnrollment.enrollment && dhis2Event.orgUnit) {
if (dhis2Event.notes) {
dhis2Event.notes = orderByFilter(dhis2Event.notes, '-storedDate');
@@ -343,7 +383,23 @@
dhis2Event.statusColor = EventUtils.getEventStatusColor(dhis2Event);
dhis2Event = EventUtils.processEvent(dhis2Event, eventStage, $scope.optionSets, $scope.prStDes);
$scope.eventsByStage[dhis2Event.programStage].push(dhis2Event);
-
+ angular.forEach($scope.programStages, function(programStage) {
+ if(dhis2Event.programStage === programStage.id) {
+ angular.forEach(programStage.programStageDataElements, function(dataElement) {
+ if(dataElement.dataElement.dataElementGroups && dataElement.dataElement.dataElementGroups.length > 0){
+ angular.forEach(dataElement.dataElement.dataElementGroups, function(dataElementGroup){
+ if(multiSelectsFound.indexOf(dataElementGroup.id)< 0) {
+ dhis2Event[dataElementGroup.id] = {selections:[]};
+ multiSelectsFound.push(dataElementGroup.id);
+ }
+ if(dhis2Event[dataElement.dataElement.id]){
+ dhis2Event[dataElementGroup.id].selections.push(dataElement.dataElement);
+ }
+ });
+ }
+ });
+ }
+ });
if ($scope.currentStage && $scope.currentStage.id === dhis2Event.programStage) {
$scope.currentEvent = dhis2Event;
}
@@ -355,6 +411,7 @@
$scope.showDataEntry($scope.currentEvent, true);
}
};
+
var setEventEditing = function (dhis2Event, stage) {
return dhis2Event.editingNotAllowed = dhis2Event.orgUnit !== $scope.selectedOrgUnit.id && dhis2Event.eventDate || (stage.blockEntryForm && dhis2Event.status === 'COMPLETED') || $scope.selectedEntity.inactive;
@@ -371,8 +428,10 @@
return false;
};
- $scope.toggleEventsTableDisplay = function () {
- $scope.showEventsAsTables = !$scope.showEventsAsTables;
+ $scope.toggleEventsTableDisplay = function () {
+
+ $scope.showEventsAsTables = !$scope.showEventsAsTables;
+
angular.forEach($scope.programStages, function (stage) {
if (stage.programStageDataElements.length < $scope.tableMaxNumberOfDataElements) {
stage.displayEventsInTable = $scope.showEventsAsTables;
@@ -382,9 +441,20 @@
}
});
};
+
+ $scope.setDisplayTypeForStages = function(){
+ angular.forEach($scope.programStages, function (stage) {
+ $scope.setDisplayTypeForStage(stage);
+ });
+ }
+
+ $scope.setDisplayTypeForStage = function(stage){
+ if (stage.programStageDataElements.length < $scope.tableMaxNumberOfDataElements) {
+ stage.displayEventsInTable = $scope.showEventsAsTables;
+ }
+ }
$scope.stageNeedsEvent = function (stage) {
-
//In case the event is a table, we sould always allow adding more events(rows)
if (stage.displayEventsInTable) {
return true;
@@ -410,36 +480,36 @@
newEvent = EventUtils.processEvent(newEvent, $scope.stagesById[newEvent.programStage], $scope.optionSets, $scope.prStDes);
$scope.eventsByStage[newEvent.programStage].push(newEvent);
- $scope.currentEvent = newEvent;
- sortEventsByStage('ADD');
+
+ sortEventsByStage('ADD', newEvent);
};
- $scope.showCreateEvent = function (stage) {
-
+ $scope.showCreateEvent = function (stage,eventCreationAction) {
var dummyEvent = EventUtils.createDummyEvent($scope.eventsByStage[stage.id], $scope.selectedEntity, $scope.selectedProgram, stage, $scope.selectedOrgUnit, $scope.selectedEnrollment);
-
+
var modalInstance = $modal.open({
templateUrl: 'components/dataentry/new-event.html',
controller: 'EventCreationController',
resolve: {
- stagesById: function () {
- return $scope.stagesById;
+ stage: function () {
+ return $scope.stagesById[stage.id];
},
dummyEvent: function () {
return dummyEvent;
},
- eventPeriods: function () {
- return $scope.eventPeriods;
- },
autoCreate: function () {
//In case the programstage is a table, autocreate
return stage.displayEventsInTable;
- }
+ },
+ eventCreationAction: function(){
+ return eventCreationAction;
+ }
}
});
modalInstance.result.then(function (ev) {
if (angular.isObject(ev)) {
+
var newEvent = ev;
newEvent.orgUnitName = dummyEvent.orgUnitName;
newEvent.name = dummyEvent.name;
@@ -453,7 +523,8 @@
if (dummyEvent.coordinate) {
newEvent.coordinate = {};
}
-
+
+ $scope.currentStage = stage;
$scope.addNewEvent(newEvent);
$scope.currentEvent = null;
@@ -465,7 +536,7 @@
$scope.showDataEntry = function (event, rightAfterEnrollment) {
if (event) {
-
+
Paginator.setItemCount($scope.eventsByStage[event.programStage].length);
Paginator.setPage($scope.eventsByStage[event.programStage].indexOf(event));
Paginator.setPageCount(Paginator.getItemCount());
@@ -510,6 +581,80 @@
}
};
+ $scope.tableRowIsEditable = function(eventRow){
+ if( eventRow === $scope.currentEvent &&
+ eventRow.status !== $scope.EVENTSTATUSCOMPLETELABEL &&
+ eventRow.status !== $scope.EVENTSTATUSSKIPPEDLABEL &&
+ $scope.tableEditMode !== $scope.tableEditModes.form){
+
+ return true;
+ }
+ return false;
+ };
+
+ $scope.tableRowStatusButtonsEnabled = function(event){
+ return event.orgUnit === $scope.selectedOrgUnit.id && $scope.selectedEntity.inactive === false && $scope.selectedEnrollment.status === 'ACTIVE';
+ };
+
+ $scope.tableEditModes = { form: 0, table: 1, tableAndForm: 2 };
+ $scope.tableEditMode = $scope.tableEditModes.form;
+
+ $scope.toggleTableEditMode = function(){
+ $scope.currentEvent = {};
+ $scope.tableEditMode = $scope.tableEditMode === $scope.tableEditModes.tableAndForm ? $scope.tableEditModes.form : $scope.tableEditModes.tableAndForm;
+ };
+
+ $scope.eventRowChanged = false;
+ $scope.eventRowClicked = function(event){
+
+ if($scope.currentEvent !== event){
+ $scope.eventRowChanged = true;
+ }
+ else {
+ $scope.eventRowChanged = false;
+ }
+
+ $scope.switchToEventRow(event);
+ if($scope.tableEditMode === $scope.tableEditModes.form){
+ $scope.openEventEditFormModal(event);
+ }
+
+ };
+
+ $scope.eventRowDblClicked = function(event){
+
+ if($scope.currentEvent === event &&
+ $scope.tableEditMode === $scope.tableEditModes.tableAndForm &&
+ $scope.eventRowChanged === false){
+ $scope.openEventEditFormModal(event);
+ }
+ };
+
+ $scope.openEventEditFormModal = function(event){
+
+ //setEventEditing
+ setEventEditing(event, $scope.currentStage);
+
+ $scope.eventEditFormModalInstance = modalInstance = $modal.open({
+ templateUrl: 'components/dataentry/modal-default-form.html',
+ scope: $scope
+ });
+
+ $scope.eventEditFormModalInstance.result.then(function (status) {
+ //completed, deleted or skipped
+ $scope.currentEvent = {};
+ }, function(){
+ //closed
+ });
+ };
+
+ $scope.switchToEventRowDeselected = function(event){
+ if($scope.currentEvent !== event) {
+ $scope.showDataEntry(event,false);
+ }
+ $scope.currentEvent = {};
+ };
+
$scope.switchToEventRow = function (event) {
if($scope.currentEvent !== event) {
$scope.showDataEntry(event,false);
@@ -519,11 +664,74 @@
$scope.switchDataEntryForm = function () {
$scope.displayCustomForm = !$scope.displayCustomForm;
};
+
+ $scope.buildOtherValuesLists = function () {
+ var otherValues = {};
+ //Only default forms need to build an other values list.
+ if($scope.displayCustomForm === "DEFAULT" || $scope.displayCustomForm === false) {
+ //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++) {
+ //We are not interested in the values from the current stage:
+ if($scope.eventsByStageAsc[stage.id][i] !== $scope.currentEvent) {
+ var currentId = programStageDataElement.dataElement.id;
+ if ( $scope.eventsByStageAsc[stage.id][i][currentId] ) {
+ //The current stage has a dataelement of the type in question
+ //Init the list if not already done:
+ if(!otherValues[currentId]) {
+ otherValues[currentId] = [];
+ }
+
+ //Decorate and push the alternate value to the list:
+
+ var alternateValue = $scope.eventsByStageAsc[stage.id][i][currentId];
+ alternateValue = CommonUtils.displayBooleanAsYesNo(alternateValue, programStageDataElement.dataElement);
+
+ //Else decorate with the event date:
+ alternateValue = $scope.eventsByStageAsc[stage.id][i].eventDate + ': ' + alternateValue;
+
+ otherValues[currentId].push(alternateValue);
+ }
+ }
+ }
+ });
+ });
+ }
+
+ return otherValues;
+ };
+
$scope.getDataEntryForm = function () {
-
$scope.currentStage = $scope.stagesById[$scope.currentEvent.programStage];
$scope.currentStageEvents = $scope.eventsByStage[$scope.currentEvent.programStage];
+ if(!$scope.currentStage.multiSelectGroups) {
+ $scope.currentStage.multiSelectGroups = {};
+ }
+
+ for(var i = $scope.currentStage.programStageDataElements.length-1;i >=0;i--) {
+ var s = $scope.currentStage.programStageDataElements[i].dataElement;
+
+ //If the datatype is a boolean, and there is a list of dataElementGropus, put the boolean into the group:
+ var s = $scope.currentStage.programStageDataElements[i].dataElement;
+ if($scope.currentStage.programStageDataElements[i].dataElement.dataElementGroups
+ && $scope.currentStage.programStageDataElements[i].dataElement.valueType === "TRUE_ONLY") {
+ angular.forEach($scope.currentStage.programStageDataElements[i].dataElement.dataElementGroups, function(dataElementGroup) {
+ //if the element it grouped, we only add a prStDe for the group element:
+ if( !$scope.currentStage.multiSelectGroups[dataElementGroup.id] ) {
+ $scope.currentStage.multiSelectGroups[dataElementGroup.id] =
+ {dataElement:{valueType:'MULTI_SELECT_GROUP',name:dataElementGroup.name,id:dataElementGroup.id},
+ dataElements: []};
+ $scope.currentStage.programStageDataElements.push($scope.currentStage.multiSelectGroups[dataElementGroup.id]);
+ }
+
+ $scope.currentStage.multiSelectGroups[dataElementGroup.id].dataElements.push($scope.currentStage.programStageDataElements[i]);
+ $scope.currentStage.programStageDataElements.splice(i,1);
+ });
+ }
+ }
+
angular.forEach($scope.currentStage.programStageSections, function (section) {
section.open = true;
@@ -543,22 +751,101 @@
$scope.currentStageEventsOriginal = angular.copy($scope.currentStageEvents);
var period = {event: $scope.currentEvent.event, stage: $scope.currentEvent.programStage, name: $scope.currentEvent.sortingDate};
- $scope.currentPeriod[$scope.currentEvent.programStage] = period;
-
+ $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();
};
- $scope.saveDatavalue = function (prStDe, field) {
+ $scope.saveDatavalue = function (prStDe, field) {
$scope.saveDatavalueForEvent(prStDe, field, $scope.currentEvent);
};
-
+
+ $scope.saveDataValueForRadio = function(prStDe, event, value){
+
+ var def = $q.defer();
+
+ event[prStDe.dataElement.id] = value;
+
+ var saveReturn = $scope.saveDatavalueForEvent(prStDe, null, event);
+ if(angular.isDefined(saveReturn)){
+ if(saveReturn === true){
+ def.resolve("saved");
+ }
+ else if(saveReturn === false){
+ def.reject("error");
+ }
+ else{
+ saveReturn.then(function(){
+ def.resolve("saved");
+ }, function(){
+ def.reject("error");
+ });
+ }
+ }
+ else {
+ def.resolve("notSaved");
+ }
+
+
+ return def.promise;
+ };
+
+ $scope.saveMultiSelectState = function (prStDe, eventToSave, currentElement, value) {
+ //Called when a new option is added or removed from a multiselect list
+ $scope.updateSuccess = false;
+
+ $scope.currentElement = {id: currentElement.dataElement.id, event: eventToSave.event, saved: false};
+
+ value = CommonUtils.formatDataValue(value, prStDe.dataElement, $scope.optionSets, 'API');
+ var dataValue = {
+ dataElement: prStDe.dataElement.id,
+ value: value,
+ providedElsewhere: false
+ };
+
+ var ev = {event: eventToSave.event,
+ orgUnit: eventToSave.orgUnit,
+ program: eventToSave.program,
+ programStage: eventToSave.programStage,
+ status: eventToSave.status,
+ trackedEntityInstance: eventToSave.trackedEntityInstance,
+ dataValues: [
+ dataValue
+ ]
+ };
+ DHIS2EventFactory.updateForSingleValue(ev).then(function (response) {
+
+ $scope.currentElement.saved = true;
+ if(value){
+ $scope.currentEvent[dataValue.dataElement] = dataValue;
+ }else{
+ $scope.currentEvent[dataValue.dataElement] = null;
+ }
+ $scope.currentEventOriginal = angular.copy($scope.currentEvent);
+ $scope.currentStageEventsOriginal = angular.copy($scope.currentStageEvents);
+ //Run rules on updated data:
+ $scope.executeRules();
+ });
+ };
+
+ $scope.initMultiSelect = function (eventRow) {
+ if(!eventRow.multiSelectGroupSelection) {
+ eventRow.multiSelectGroupSelection = {selections:[]};
+ }
+ };
+
+ $scope.degub = function(item) {
+ var i = item;
+ };
+
$scope.saveDatavalueForEvent = function (prStDe, field, eventToSave) {
//Blank out the input-saved class on the last saved due date:
$scope.eventDateSaved = false;
$scope.currentElement = {};
-
+
//check for input validity
$scope.updateSuccess = false;
if (field && field.$invalid) {
@@ -598,7 +885,7 @@
}
]
};
- DHIS2EventFactory.updateForSingleValue(ev).then(function (response) {
+ return DHIS2EventFactory.updateForSingleValue(ev).then(function (response) {
$scope.currentElement.saved = true;
@@ -607,7 +894,7 @@
$scope.currentStageEventsOriginal = angular.copy($scope.currentStageEvents);
//Run rules on updated data:
- $scope.executeRules();
+ $scope.executeRules();
});
}
@@ -646,11 +933,11 @@
};
$scope.saveEventDateForEvent = function (eventToSave) {
-
$scope.eventDateSaved = false;
- if (eventToSave.eventDate === '') {
+ if (angular.isUndefined(eventToSave.eventDate) || eventToSave.eventDate === '') {
$scope.invalidDate = eventToSave.event;
$scope.validatedDateSetForEvent = {date: '', event: eventToSave};
+ $scope.currentElement = {id: "eventDate", saved: false};
return false;
}
@@ -658,11 +945,14 @@
var convertedDate = DateUtils.format(eventToSave.eventDate);
if (rawDate !== convertedDate) {
- $scope.invalidDate = true;
+ $scope.invalidDate = eventToSave.event;
$scope.validatedDateSetForEvent = {date: '', event: eventToSave};
+ $scope.currentElement = {id: "eventDate", saved: false};
return false;
}
-
+
+ $scope.currentElement = {id: "eventDate", event: eventToSave.event, saved: false};
+
var e = {event: eventToSave.event,
enrollment: eventToSave.enrollment,
dueDate: DateUtils.formatFromUserToApi(eventToSave.dueDate),
@@ -681,7 +971,10 @@
eventToSave.statusColor = EventUtils.getEventStatusColor(eventToSave);
sortEventsByStage('UPDATE');
$scope.validatedDateSetForEvent = {date: eventToSave.eventDate, event: eventToSave};
+ $scope.currentElement = {id: "eventDate", event: eventToSave.event, saved: true};
$scope.executeRules();
+ }, function(error){
+
});
};
@@ -690,7 +983,7 @@
$scope.dueDateSaved = false;
if ($scope.currentEvent.dueDate === '') {
- $scope.invalidDate = true;
+ $scope.invalidDueDate = $scope.currentEvent.event;
return false;
}
@@ -698,7 +991,7 @@
var convertedDate = DateUtils.format($scope.currentEvent.dueDate);
if (rawDate !== convertedDate) {
- $scope.invalidDate = true;
+ $scope.invalidDueDate = $scope.currentEvent.event;
return false;
}
@@ -721,7 +1014,7 @@
}
DHIS2EventFactory.update(e).then(function (data) {
- $scope.invalidDate = false;
+ $scope.invalidDueDate = false;
$scope.dueDateSaved = true;
if (e.eventDate && !$scope.currentEvent.eventDate && $scope.currentStage.periodType) {
@@ -756,7 +1049,7 @@
}
//valid coordinate(s), proceed with the saving
- var dhis2Event = EventUtils.reconstruct($scope.currentEvent, $scope.currentStage, $scope.optionSets);
+ var dhis2Event = $scope.makeDhis2EventToUpdate();
DHIS2EventFactory.update(dhis2Event).then(function (response) {
$scope.currentEventOriginal = angular.copy($scope.currentEvent);
@@ -772,9 +1065,10 @@
};
$scope.addNote = function () {
+
if ($scope.note.value !== "" || !angular.isUndefined($scope.note.value)) {
var newNote = {value: $scope.note.value};
-
+
if (angular.isUndefined($scope.currentEvent.notes)) {
$scope.currentEvent.notes = [{value: newNote.value, storedDate: today, storedBy: storedBy}];
}
@@ -791,6 +1085,7 @@
};
DHIS2EventFactory.updateForNote(e).then(function (data) {
+
$scope.note = {};
});
}
@@ -799,6 +1094,7 @@
$scope.notesModal = function(){
var bodyList = [];
+
if($scope.currentEvent.notes) {
for(i = 0; i < $scope.currentEvent.notes.length; i++){
var currentNote = $scope.currentEvent.notes[i];
@@ -819,7 +1115,7 @@
var dialogDefaults = {
templateUrl: 'views/list-with-textarea-modal.html',
- controller: function ($scope, $modalInstance, DHIS2EventFactory) {
+ controller: function ($scope, $modalInstance, DHIS2EventFactory, DateUtils) {
$scope.modalOptions = dialogOptions;
$scope.formSubmitted = false;
$scope.currentEvent = $scope.modalOptions.currentEvent;
@@ -835,23 +1131,18 @@
else {
$scope.formSubmitted = true;
}
- }
+ };
+
$scope.modalOptions.close = function(){
- $modalInstance.close();
+ $modalInstance.close($scope.currentEvent);
};
$scope.addNote = function(){
newNote = {value: $scope.note};
-
- if (angular.isUndefined($scope.modalOptions.bodyList) || $scope.modalOptions.bodyList.length === 0) {
- $scope.modalOptions.bodyList = [{value1: today, value2: $scope.note}];
- }
- else {
- $scope.modalOptions.bodyList.splice(0, 0, {value1: today, value2: $scope.note});
- }
-
+ var date = DateUtils.formatToHrsMins(new Date());
+
var e = {event: $scope.currentEvent.event,
program: $scope.currentEvent.program,
programStage: $scope.currentEvent.programStage,
@@ -859,17 +1150,26 @@
trackedEntityInstance: $scope.currentEvent.trackedEntityInstance,
notes: [newNote]
};
-
DHIS2EventFactory.updateForNote(e).then(function (data) {
- $scope.note = '';
- });
-
- $scope.note = $scope.textAreaValues["note"] = "";
+ if (angular.isUndefined($scope.modalOptions.bodyList) || $scope.modalOptions.bodyList.length === 0) {
+ $scope.modalOptions.bodyList = [{value1: date, value2: newNote.value}];
+ $scope.modalOptions.currentEvent.notes = [{storedDate: date, value: newNote.value}];
+ }
+ else {
+ $scope.modalOptions.bodyList.splice(0, 0, {value1: date, value2: newNote.value});
+ $scope.modalOptions.currentEvent.notes.splice(0,0,{storedDate: date, value: newNote.value});
+ }
+ $scope.note = $scope.textAreaValues["note"] = "";
+ });
+
};
}
};
- DialogService.showDialog(dialogDefaults, dialogOptions);
+ DialogService.showDialog(dialogDefaults, dialogOptions).then(function(e){
+
+ $scope.currentEvent.notes = e.notes;
+ });
};
@@ -938,10 +1238,36 @@
});
});
};
-
- $scope.completeIncompleteEvent = function () {
+
+ $scope.makeDhis2EventToUpdate = function(){
+ var dhis2Event = EventUtils.reconstruct($scope.currentEvent, $scope.currentStage, $scope.optionSets);
+ var dhis2EventToUpdate = angular.copy(dhis2Event);
+ dhis2EventToUpdate.dataValues = [];
+
+ if(dhis2Event.dataValues){
+ angular.forEach(dhis2Event.dataValues, function(dataValue){
+ if(dataValue.value && dataValue.value.selections){
+ angular.forEach(dataValue.value.selections, function(selection){
+ var dv = {
+ dataElement: selection.id,
+ value: true,
+ providedElsewhere: false
+ };
+ dhis2EventToUpdate.dataValues.push(dv);
+ });
+ }else{
+ dhis2EventToUpdate.dataValues.push(dataValue);
+ }
+ });
+ };
+ return dhis2EventToUpdate;
+ };
+
+ $scope.completeIncompleteEvent = function (inTableView) {
+
var modalOptions;
- var dhis2Event = EventUtils.reconstruct($scope.currentEvent, $scope.currentStage, $scope.optionSets);
+ var dhis2Event = $scope.makeDhis2EventToUpdate();
+
if ($scope.currentEvent.status === 'COMPLETED') {//activiate event
modalOptions = {
closeButtonText: 'cancel',
@@ -952,15 +1278,21 @@
dhis2Event.status = 'ACTIVE';
}
else {//complete event
+ if(angular.isUndefined(inTableView) || inTableView === false){
+ $scope.outerForm.$setSubmitted();
+ if($scope.outerForm.$invalid){
+ return;
+ }
+ }
- if($scope.errorMessages && $scope.errorMessages.length > 0) {
+ if(angular.isDefined($scope.errorMessages[$scope.currentEvent.event]) && $scope.errorMessages[$scope.currentEvent.event].length > 0) {
//There is unresolved program rule errors - show error message.
var dialogOptions = {
headerText: 'errors',
bodyText: 'please_fix_errors_before_completing',
- bodyList: $scope.errorMessages
- };
-
+ bodyList: $scope.errorMessages[$scope.currentEvent.event]
+ };
+
DialogService.showDialog({}, dialogOptions);
return;
@@ -975,57 +1307,69 @@
};
dhis2Event.status = 'COMPLETED';
}
- }
-
- ModalService.showModal({}, modalOptions).then(function (result) {
+ }
+
+ ModalService.showModal({}, modalOptions).then(function (result) {
+ $scope.executeCompleteIncompleteEvent(dhis2Event);
+ });
+ };
+
+ $scope.executeCompleteIncompleteEvent = function(dhis2Event){
- DHIS2EventFactory.update(dhis2Event).then(function (data) {
-
- if ($scope.currentEvent.status === 'COMPLETED') {//activiate event
- $scope.currentEvent.status = 'ACTIVE';
- }
- else {//complete event
- $scope.currentEvent.status = 'COMPLETED';
- }
-
- setStatusColor();
-
- setEventEditing($scope.currentEvent, $scope.currentStage);
-
- if ($scope.currentEvent.status === 'COMPLETED') {
-
- if ($scope.currentStage.remindCompleted) {
- completeEnrollment($scope.currentStage);
- }
- else {
- if ($scope.currentStage.allowGenerateNextVisit) {
- if($scope.currentStage.repeatable){
- $scope.showCreateEvent($scope.currentStage);
- }
- else{
- var index = -1, stage = null;
- for(var i=0; i<$scope.programStages.length && index===-1; i++){
- if($scope.currentStage.id === $scope.programStages[i].id){
- index = i;
- stage = $scope.programStages[i+1];
- }
- }
- if(stage ){
- if(!$scope.eventsByStage[stage.id] || $scope.eventsByStage[stage.id] && $scope.eventsByStage[stage.id].length === 0){
- $scope.showCreateEvent(stage);
- }
- }
- }
- }
- }
- }
- });
+ DHIS2EventFactory.update(dhis2Event).then(function (data) {
+
+ if ($scope.currentEvent.status === 'COMPLETED') {//activiate event
+ $scope.currentEvent.status = 'ACTIVE';
+ }
+ else {//complete event
+ $scope.currentEvent.status = 'COMPLETED';
+
+ }
+
+ setStatusColor();
+
+ setEventEditing($scope.currentEvent, $scope.currentStage);
+
+ if ($scope.currentEvent.status === 'COMPLETED') {
+
+ if ($scope.currentStage.remindCompleted) {
+ completeEnrollment($scope.currentStage);
+ }
+ else {
+ if ($scope.currentStage.allowGenerateNextVisit) {
+ if($scope.currentStage.repeatable){
+ $scope.showCreateEvent($scope.currentStage, $scope.eventCreationActions.add);
+ }
+ else{
+ var index = -1, stage = null;
+ for(var i=0; i<$scope.programStages.length && index===-1; i++){
+ if($scope.currentStage.id === $scope.programStages[i].id){
+ index = i;
+ stage = $scope.programStages[i+1];
+ }
+ }
+ if(stage ){
+ if(!$scope.eventsByStage[stage.id] || $scope.eventsByStage[stage.id] && $scope.eventsByStage[stage.id].length === 0){
+ $scope.showCreateEvent(stage, $scope.eventCreationActions.add);
+ }
+ }
+ }
+ }
+ }
+
+ if($scope.displayCustomForm !== "TABLE") {
+ //Close the event when the event is completed, to make it
+ //more clear that the completion went through.
+ $scope.showDataEntry($scope.currentEvent, false);
+ }
+ }
});
};
+
$scope.skipUnskipEvent = function () {
var modalOptions;
- var dhis2Event = EventUtils.reconstruct($scope.currentEvent, $scope.currentStage, $scope.optionSets);
+ var dhis2Event = $scope.makeDhis2EventToUpdate();
if ($scope.currentEvent.status === 'SKIPPED') {//unskip event
modalOptions = {
@@ -1047,8 +1391,15 @@
}
ModalService.showModal({}, modalOptions).then(function (result) {
-
- DHIS2EventFactory.update(dhis2Event).then(function (data) {
+
+ $scope.executeSkipUnskipEvent(dhis2Event);
+
+ });
+ };
+
+ $scope.executeSkipUnskipEvent = function(dhis2Event){
+
+ return DHIS2EventFactory.update(dhis2Event).then(function (data) {
if ($scope.currentEvent.status === 'SKIPPED') {//activiate event
$scope.currentEvent.status = 'SCHEDULE';
@@ -1060,8 +1411,9 @@
setStatusColor();
setEventEditing($scope.currentEvent, $scope.currentStage);
});
- });
+
};
+
var setStatusColor = function () {
var statusColor = EventUtils.getEventStatusColor($scope.currentEvent);
@@ -1076,7 +1428,7 @@
};
$scope.deleteEvent = function () {
-
+
var modalOptions = {
closeButtonText: 'cancel',
actionButtonText: 'delete',
@@ -1085,8 +1437,13 @@
};
ModalService.showModal({}, modalOptions).then(function (result) {
-
- DHIS2EventFactory.delete($scope.currentEvent).then(function (data) {
+ $scope.executeDeleteEvent();
+ });
+ };
+
+ $scope.executeDeleteEvent = function(){
+
+ return DHIS2EventFactory.delete($scope.currentEvent).then(function (data) {
var continueLoop = true, index = -1;
for (var i = 0; i < $scope.eventsByStage[$scope.currentEvent.programStage].length && continueLoop; i++) {
@@ -1109,8 +1466,9 @@
$scope.eventsByStage[programStageID].splice(index, 1);
$scope.currentStageEvents = $scope.eventsByStage[programStageID];
sortEventsByStage('REMOVE');
- });
- });
+ }, function(error){
+ return $q.reject(error);
+ });
};
$scope.toggleLegend = function () {
@@ -1137,7 +1495,7 @@
return DateUtils.getDate(d);
};
- var sortEventsByStage = function (operation) {
+ var sortEventsByStage = function (operation, newEvent) {
$scope.eventFilteringRequired = false;
@@ -1170,11 +1528,10 @@
$scope.allEventsSorted = CurrentSelection.getSelectedTeiEvents();
if (operation) {
-
if (operation === 'ADD') {
- var ev = EventUtils.reconstruct($scope.currentEvent, $scope.currentStage, $scope.optionSets);
- ev.enrollment = $scope.currentEvent.enrollment;
- ev.visited = $scope.currentEvent.visited;
+ var ev = EventUtils.reconstruct(newEvent, $scope.currentStage, $scope.optionSets);
+ ev.enrollment = newEvent.enrollment;
+ ev.visited = newEvent.visited;
$scope.allEventsSorted.push(ev);
}
if (operation === 'UPDATE') {
@@ -1259,34 +1616,69 @@
});
};
- $scope.interacted = function (field) {
+ $scope.interacted = function (field, form) {
+
var status = false;
if (field) {
- status = $scope.outerForm.submitted || field.$dirty;
+ if(angular.isDefined(form)){
+ status = form.$submitted || field.$dirty;
+ }
+ else {
+ status = $scope.outerForm.$submitted || field.$dirty;
+ }
}
return status;
};
+ $scope.deselectCurrent = function(id){
+
+ if($scope.currentEvent.event === id){
+ $scope.currentEvent = {};
+ }
+ };
+ $scope.showCompleteErrorMessageInModal = function(message, fieldName, isWarning){
+ var messages = [message];
+ var headerPrefix = angular.isDefined(isWarning) && isWarning === true ? "Warning in " : "Error in ";
+
+ var dialogOptions = {
+ headerText: headerPrefix + fieldName,
+ bodyText: '',
+ bodyList: messages
+ };
+
+ DialogService.showDialog({}, dialogOptions);
+ };
})
.controller('EventCreationController',
function ($scope,
$modalInstance,
+ $timeout,
DateUtils,
DHIS2EventFactory,
+ OrgUnitFactory,
DialogService,
- stagesById,
+ EventCreationService,
+ stage,
dummyEvent,
- eventPeriods,
+ eventCreationAction,
autoCreate) {
- $scope.stagesById = stagesById;
- $scope.programStageId = dummyEvent.programStage;
- $scope.eventPeriods = eventPeriods;
- $scope.selectedStage = $scope.stagesById[dummyEvent.programStage];
-
- $scope.dhis2Event = {eventDate: '', dueDate: dummyEvent.dueDate, excecutionDateLabel: dummyEvent.excecutionDateLabel, name: dummyEvent.name, invalid: true};
-
+ $scope.eventCreationAction = eventCreationAction;
+ $scope.eventCreationActions = EventCreationService.eventCreationActions;
+
+ $scope.selectedStage = stage;
+ $scope.isNewEvent = (eventCreationAction === $scope.eventCreationActions.add);
+ $scope.isScheduleEvent = (eventCreationAction === $scope.eventCreationActions.schedule || eventCreationAction === $scope.eventCreationActions.referral);
+ $scope.isReferralEvent = (eventCreationAction === $scope.eventCreationActions.referral);
+
+ $scope.dhis2Event = {eventDate: $scope.isScheduleEvent ? '' : DateUtils.getToday(), dueDate: dummyEvent.dueDate, excecutionDateLabel : dummyEvent.excecutionDateLabel, name: dummyEvent.name, invalid: true};
+
+ ////custom code for folkehelsa. Set empty eventDate if selectedStage is previous pregnancies
+ if($scope.selectedStage.id === 'PUZaKR0Jh2k'){
+ $scope.dhis2Event.eventDate = '';
+ }
+
if ($scope.selectedStage.periodType) {
$scope.dhis2Event.eventDate = dummyEvent.dueDate;
$scope.dhis2Event.periodName = dummyEvent.periodName;
@@ -1297,6 +1689,7 @@
$scope.dueDateInvalid = false;
$scope.eventDateInvalid = false;
+
//watch for changes in due/event-date
$scope.$watchCollection('[dhis2Event.dueDate, dhis2Event.eventDate]', function () {
if (angular.isObject($scope.dhis2Event)) {
@@ -1324,12 +1717,17 @@
if ($scope.dueDateInvalid || $scope.eventDateInvalid) {
return false;
}
-
+ if($scope.isReferralEvent && !$scope.selectedSearchingOrgUnit){
+ $scope.orgUnitError = true;
+ return false;
+ }
+ $scope.orgUnitError = false;
+
if ($scope.selectedStage.periodType) {
$scope.dhis2Event.eventDate = $scope.dhis2Event.selectedPeriod.endDate;
$scope.dhis2Event.dueDate = $scope.dhis2Event.selectedPeriod.endDate;
}
-
+
var eventDate = DateUtils.formatFromUserToApi($scope.dhis2Event.eventDate);
var dueDate = DateUtils.formatFromUserToApi($scope.dhis2Event.dueDate);
var newEvents = {events: []};
@@ -1354,7 +1752,7 @@
newEvent.event = response.response.importSummaries[0].reference;
$modalInstance.close(newEvent);
}
- else {
+ else {
var dialogOptions = {
headerText: 'event_creation_error',
bodyText: response.message
@@ -1365,6 +1763,123 @@
});
};
+ //Start referral logic
+ $scope.setSelectedSearchingOrgUnit = function(orgUnit){
+ $scope.selectedSearchingOrgUnit = orgUnit;
+ dummyEvent.orgUnit = orgUnit.id;
+ dummyEvent.orgUnitName = orgUnit.name;
+ };
+
+ var orgPath = [dummyEvent.orgUnit];
+ function initOrgUnits(uid){
+ $scope.orgUnitsLoading =true;
+ $timeout(function(){
+ OrgUnitFactory.getWithParents(uid).then(function(ou){
+ if(ou.organisationUnits && ou.organisationUnits[0] && ou.organisationUnits[0].parent){
+ orgPath.push(ou.organisationUnits[0].parent.id);
+ var parent = ou.organisationUnits[0].parent;
+ var lastId = ou.organisationUnits[0].id;
+ while(parent){
+ orgPath.push(parent.id);
+ lastId = parent.id;
+ parent = parent.parent;
+ }
+ initOrgUnits(lastId);
+ }else{
+ OrgUnitFactory.getSearchTreeRoot().then(function(response) {
+ $scope.orgUnits = response.organisationUnits;
+ angular.forEach($scope.orgUnits, function(ou){
+ ou.show = true;
+ angular.forEach(ou.children, function(o){
+ o.hasChildren = o.children && o.children.length > 0 ? true : false;
+ initExpand(o);
+ });
+ });
+ });
+ }
+ });
+ },150);
+
+ };
+
+ function initExpand(orgUnit){
+ if(orgPath.indexOf(orgUnit.id)>-1){
+ if(orgUnit.hasChildren){
+ //Get children for the selected orgUnit
+ OrgUnitFactory.get(orgUnit.id).then(function(ou) {
+ orgUnit.show = true;
+ orgUnit.hasChildren = false;
+ orgUnit.children = ou.organisationUnits[0].children;
+ angular.forEach(orgUnit.children, function(ou){
+ ou.hasChildren = ou.children && ou.children.length > 0 ? true : false;
+ initExpand(ou);
+ });
+ });
+ }else{
+ setDefaultOrgUnit();
+ }
+ }
+ };
+
+ var defaultOrgUnitGroup = 'hrc';
+ function setDefaultOrgUnit(){
+ if(orgPath && orgPath.length>1){
+ OrgUnitFactory.getWithGroups(orgPath[1]).then(function(ou){
+ if(ou.organisationUnits && ou.organisationUnits[0]){
+ var o = ou.organisationUnits[0];
+ angular.forEach(o.children, function(oo){
+ angular.forEach(oo.organisationUnitGroups, function(oug){
+ var shortNameLC = oug.shortName.toLowerCase();
+ if(shortNameLC === defaultOrgUnitGroup){
+ $scope.setSelectedSearchingOrgUnit(oo);
+ }
+ });
+ });
+
+ }
+ $scope.orgUnitsLoading = false;
+ });
+ }else{
+ $scope.orgUnitsLoading = false;
+ }
+ };
+
+ if($scope.isReferralEvent){
+ initOrgUnits(orgPath[0]);
+ }
+
+ $scope.expandCollapse = function(orgUnit) {
+ if( orgUnit.hasChildren ){
+ //Get children for the selected orgUnit
+ OrgUnitFactory.get(orgUnit.id).then(function(ou) {
+ orgUnit.show = !orgUnit.show;
+ orgUnit.hasChildren = false;
+ orgUnit.children = ou.organisationUnits[0].children;
+ angular.forEach(orgUnit.children, function(ou){
+ ou.hasChildren = ou.children && ou.children.length > 0 ? true : false;
+ });
+ });
+ }
+ else{
+ orgUnit.show = !orgUnit.show;
+ }
+ };
+
+
+ /*if($scope.isReferralEvent){
+ OrgUnitFactory.getSearchTreeRoot().then(function(response) {
+ $scope.orgUnits = response.organisationUnits;
+ angular.forEach($scope.orgUnits, function(ou){
+ ou.show = true;
+ angular.forEach(ou.children, function(o){
+ o.hasChildren = o.children && o.children.length > 0 ? true : false;
+ });
+ });
+ });
+ }*/
+ //end referral logic
+
+
//If the caller wants to create right away, go ahead and save.
if (autoCreate) {
$scope.save();
@@ -1374,6 +1889,8 @@
$scope.cancel = function () {
$modalInstance.close();
};
+
+
})
.controller('EventOptionsInTableController', function($scope){
@@ -1386,21 +1903,35 @@
var UNSKIP = "Unskip";
var NOTE = "Note";
+
+ $scope.completeIncompleteEventFromTable = function(){
+
+ if ($scope.currentEvent.status !== 'COMPLETED'){
+ $scope.currentEvent.submitted = true;
+ var formData = $scope.$eval('eventRowForm' + $scope.eventRow.event);
+ if(formData.$valid){
+ $scope.completeIncompleteEvent(true);
+ }
+ }
+ else{
+ $scope.completeIncompleteEvent(true);
+ }
+ };
+
+
$scope.eventTableOptions = {};
- $scope.eventTableOptions[COMPLETE] = {text: "Complete", tooltip: 'Complete', icon: "<span class='glyphicon glyphicon-check'></span>", value: COMPLETE, onClick: $scope.completeIncompleteEvent, sort: 0};
- $scope.eventTableOptions[INCOMPLETE] = {text: "Reopen", tooltip: 'Reopen', icon: "<span class='glyphicon glyphicon-pencil'></span>", value: INCOMPLETE, onClick: $scope.completeIncompleteEvent, sort: 1};
- $scope.eventTableOptions[VALIDATE] = {text: "Validate", tooltip: 'Validate', icon: "<span class='glyphicon glyphicon-cog'></span>", value: VALIDATE, onClick: $scope.validateEvent, sort: 2};
- $scope.eventTableOptions[DELETE] = {text: "Delete", tooltip: 'Delete', icon: "<span class='glyphicon glyphicon-floppy-remove'></span>", value: DELETE, onClick: $scope.deleteEvent, sort: 3};
- $scope.eventTableOptions[SKIP] = {text: "Skip", tooltip: 'Skip', icon: "<span class='glyphicon glyphicon-step-forward'></span>", value: SKIP, onClick: $scope.skipUnskipEvent, sort: 4};
- $scope.eventTableOptions[UNSKIP] = {text: "Schedule back", tooltip: 'Schedule back', icon: "<span class='glyphicon glyphicon-step-backward'></span>", value: UNSKIP, onClick: $scope.skipUnskipEvent, sort: 5};
- $scope.eventTableOptions[NOTE] = {text: "Notes", tooltip: 'Show notes', icon: "<span class='glyphicon glyphicon-list-alt'></span>", value: NOTE, onClick: $scope.notesModal, sort: 6};
-
- $scope.eventRow.validatedEventDate = $scope.eventRow.eventDate;
-
+ $scope.eventTableOptions[COMPLETE] = {text: "Complete", tooltip: 'Complete', icon: "<span class='glyphicon glyphicon-check'></span>", value: COMPLETE, onClick: $scope.completeIncompleteEventFromTable, sort: 0};
+ $scope.eventTableOptions[INCOMPLETE] = {text: "Reopen", tooltip: 'Reopen', icon: "<span class='glyphicon glyphicon-pencil'></span>", value: INCOMPLETE, onClick: $scope.completeIncompleteEventFromTable, sort: 1};
+ //$scope.eventTableOptions[VALIDATE] = {text: "Validate", tooltip: 'Validate', icon: "<span class='glyphicon glyphicon-cog'></span>", value: VALIDATE, onClick: $scope.validateEvent, sort: 6};
+ $scope.eventTableOptions[DELETE] = {text: "Delete", tooltip: 'Delete', icon: "<span class='glyphicon glyphicon-floppy-remove'></span>", value: DELETE, onClick: $scope.deleteEvent, sort: 2};
+ $scope.eventTableOptions[SKIP] = {text: "Skip", tooltip: 'Skip', icon: "<span class='glyphicon glyphicon-step-forward'></span>", value: SKIP, onClick: $scope.skipUnskipEvent, sort: 3};
+ $scope.eventTableOptions[UNSKIP] = {text: "Schedule back", tooltip: 'Schedule back', icon: "<span class='glyphicon glyphicon-step-backward'></span>", value: UNSKIP, onClick: $scope.skipUnskipEvent, sort: 4};
+ //$scope.eventTableOptions[NOTE] = {text: "Notes", tooltip: 'Show notes', icon: "<span class='glyphicon glyphicon-list-alt'></span>", value: NOTE, onClick: $scope.notesModal, sort: 5};
+
+ $scope.eventRow.validatedEventDate = $scope.eventRow.eventDate;
updateEventTableOptions();
- $scope.$watch("eventRow.status", function(newValue, oldValue){
-
+ $scope.$watch("eventRow.status", function(newValue, oldValue){
if(newValue !== oldValue){
updateEventTableOptions();
}
@@ -1408,7 +1939,6 @@
});
$scope.$watch("validatedDateSetForEvent", function(newValue, oldValue){
-
if(angular.isDefined(newValue)){
if(!angular.equals(newValue, {})){
var updatedEvent = newValue.event;
@@ -1437,13 +1967,13 @@
$scope.eventTableOptions[COMPLETE].show = false;
$scope.eventTableOptions[SKIP].show = false;
$scope.eventTableOptions[DELETE].show = false;
- $scope.eventTableOptions[VALIDATE].show = false;
+ //$scope.eventTableOptions[VALIDATE].show = false;
$scope.defaultOption = $scope.eventTableOptions[INCOMPLETE];
break;
case $scope.EVENTSTATUSSKIPPEDLABEL:
$scope.eventTableOptions[COMPLETE].show = false;
$scope.eventTableOptions[INCOMPLETE].show = false;
- $scope.eventTableOptions[VALIDATE].show = false;
+ //$scope.eventTableOptions[VALIDATE].show = false;
$scope.eventTableOptions[SKIP].show = false;
$scope.eventTableOptions[UNSKIP].show = true;
@@ -1452,11 +1982,12 @@
default:
if(eventRow.validatedEventDate){
$scope.eventTableOptions[INCOMPLETE].show = false;
+ $scope.eventTableOptions[SKIP].show = false;
$scope.defaultOption = $scope.eventTableOptions[COMPLETE];
}
else {
$scope.eventTableOptions[INCOMPLETE].show = false;
- $scope.eventTableOptions[VALIDATE].show = false;
+ //$scope.eventTableOptions[VALIDATE].show = false;
$scope.eventTableOptions[COMPLETE].disabled = true;
$scope.defaultOption = $scope.eventTableOptions[COMPLETE];
}
@@ -1474,6 +2005,134 @@
$scope.eventTableOptionsArr[$scope.eventTableOptions[key].sort] = $scope.eventTableOptions[key];
}
}
-});
-
-
+})
+.controller('MakeReferralController', function($scope, $modalInstance, stage, OrgUnitFactory){
+ $scope.stage = stage;
+ $scope.cancel = function(){
+ $modalInstance.close();
+ };
+
+ $scope.makeReferral = function(){
+ if(!$scope.referralDate){
+ $scope.dateError = true;
+ }else{
+ $scope.dateError = false;
+ }
+
+ if(!$scope.selectedSearchingOrgUnit){
+ $scope.orgError = true;
+ }else{
+ $scope.orgError = false;
+ }
+ if(!$scope.dateError && !$scope.orgError){
+ $modalInstance.close();
+ }
+ };
+
+ $scope.setSelectedSearchingOrgUnit = function(orgUnit){
+ $scope.selectedSearchingOrgUnit = orgUnit;
+ };
+
+ OrgUnitFactory.getSearchTreeRoot().then(function(response) {
+ $scope.orgUnits = response.organisationUnits;
+ angular.forEach($scope.orgUnits, function(ou){
+ ou.show = true;
+ angular.forEach(ou.children, function(o){
+ o.hasChildren = o.children && o.children.length > 0 ? true : false;
+ });
+ });
+ });
+
+ $scope.expandCollapse = function(orgUnit) {
+ if( orgUnit.hasChildren ){
+ //Get children for the selected orgUnit
+ OrgUnitFactory.get(orgUnit.id).then(function(ou) {
+ orgUnit.show = !orgUnit.show;
+ orgUnit.hasChildren = false;
+ orgUnit.children = ou.organisationUnits[0].children;
+ angular.forEach(orgUnit.children, function(ou){
+ ou.hasChildren = ou.children && ou.children.length > 0 ? true : false;
+ });
+ });
+ }
+ else{
+ orgUnit.show = !orgUnit.show;
+ }
+ };
+})
+.controller('ModalDefaultFormController', function($scope){
+
+ var defaultRequestError = "Server error. Please try again later.";
+
+ $scope.completeIncompleteEventModal = function(){
+
+ $scope.requestError = "";
+ debugger;
+ if ($scope.currentEvent.status === 'COMPLETED'){
+ var dhis2Event = $scope.makeDhis2EventToUpdate();
+ dhis2Event.status = 'ACTIVE';
+ }
+ else{
+ $scope.modalForm.$setSubmitted();
+ $scope.modalForm.outerForm.$setSubmitted();
+
+ if($scope.modalForm.$invalid){
+ return;
+ }
+
+ //check for errors!
+ if(angular.isDefined($scope.errorMessages[$scope.currentEvent.event]) && $scope.errorMessages[$scope.currentEvent.event].length > 0) {
+ //There is unresolved program rule errors - show error message.
+ return;
+ }
+
+ var dhis2Event = $scope.makeDhis2EventToUpdate();
+ dhis2Event.status = 'COMPLETED';
+ }
+
+ $scope.executeCompleteIncompleteEvent(dhis2Event).then(function(){
+ if(dhis2Event.status === 'COMPLETED'){
+ $scope.eventEditFormModalInstance.close();
+ }
+ }, function(error){
+ $scope.requestError = defaultRequestError;
+ });
+ };
+
+ $scope.deleteEventModal = function(){
+
+ $scope.executeDeleteEvent().then(function(){
+
+ $scope.eventEditFormModalInstance.close();
+ }, function(){
+
+ $scope.requestError = defaultRequestError;
+ });
+ };
+
+ $scope.skipUnskipEventModal = function(){
+
+ var dhis2Event = $scope.makeDhis2EventToUpdate();
+
+ if ($scope.currentEvent.status === 'SKIPPED') {//unskip event
+ dhis2Event.status = 'ACTIVE';
+ }
+ else {//skip event
+ dhis2Event.status = 'SKIPPED';
+ }
+
+
+ $scope.executeSkipUnskipEvent(dhis2Event).then(function(){
+ if(dhis2Event.status === 'SKIPPED'){
+ $scope.eventEditFormModalInstance.close();
+ }
+ }, function(){
+ $scope.requestError = defaultRequestError;
+ });
+ };
+
+ $scope.closeEventModal = function(){
+ $scope.eventEditFormModalInstance.dismiss();
+ };
+})
+;
\ No newline at end of file
=== 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-12-16 14:44:28 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2015-12-17 15:00:48 +0000
@@ -4,6 +4,7 @@
<div class="panel-heading handle bold">
{{dataentryWidget.title| translate}}
<span class="pull-right widget-link">
+ <a href ng-click="toggleTableEditMode()" title="{{tableEditMode === tableEditModes.form ? 'use combined table edit mode' : 'use form only table edit mode'}}"><span ng-if="tableEditMode === tableEditModes.form"><i class="fa fa-clipboard vertical-center"></i></span><span ng-if="tableEditMode !== tableEditModes.form"><i class="fa fa-external-link vertical-center"></i></span></a>
<a href ng-click="toggleEventsTableDisplay()" title="{{showEventsAsTables ? 'toggle_table_view_off' : 'toggle_table_view_on'| translate}}" ng-show="stagesCanBeShownAsTable"><span ng-if="!showEventsAsTables"><i class="fa fa-bars vertical-center"></i></span><span ng-if="showEventsAsTables"><i class="fa fa-square vertical-center"></i></span></a>
<a href ng-click="filterEvents = !filterEvents" title="{{filterEvents ? 'list_events' : 'filter_events'| translate}}" ng-show="eventFilteringRequired"><span ng-if="!filterEvents"><i class="fa fa-filter vertical-center"></i></span><span ng-if="filterEvents"><i class="fa fa-list vertical-center"></i></span></a>
<a href ng-click="toggleLegend()" title="{{'event_color_legend'| translate}}" class="small-horizonal-spacing"><i class="fa fa-info-circle vertical-center"></i></a>
@@ -20,8 +21,7 @@
<div ng-if="!dashboardReady">
<img id="ouwt_loader" src="../images/ajax-loader-bar.gif" alt="{{'loading'| translate}}"/>
</div>
- <div ng-if="dashboardReady">
-
+ <div ng-if="dashboardReady">
<div ng-if="showEventColors">
<span class='bold'>{{'legend'| translate}}</span>
<table class="table table-bordered" style="width: 100%;">
@@ -32,7 +32,7 @@
</tr>
</table>
</div>
-
+ <!--TREE-->
<div class="table-responsive hideInPrint" ng-if="selectedEnrollment && selectedEnrollment.enrollment">
<div ng-include="'components/dataentry/event-layout.html'"></div>
</div>
@@ -41,9 +41,7 @@
<form name="outerForm" novalidate>
<div ng-if="currentEvent">
-
<div ng-include="'components/dataentry/event-details.html'"></div>
-
<!-- data entry form begins -->
<div ng-if="currentEvent.eventDate">
<div class="clear vertical-spacing" ng-if="displayCustomForm === 'CUSTOM'" ng-include="'../dhis-web-commons/angular-forms/custom-form.html'"></div>
@@ -63,8 +61,6 @@
<div ng-if="displayCustomForm !== 'TABLE'">
<div ng-include="'components/dataentry/dataentry-notes.html'"></div>
</div>
-
</div>
-
- </div>
+ </div>
</div>
=== 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 2015-12-14 10:14:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2015-12-17 15:00:48 +0000
@@ -1,22 +1,26 @@
-<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" ng-if='currentEvent && !currentStage.programStageSections.length'>
<thead>
<tr>
<th ng-bind="dataElementLabel">
</th>
- <th class="align-center" ng-bind="valueLabel">
+ <th class="" ng-bind="valueLabel">
</th>
- <th class="align-center" ng-if="allowProvidedElsewhereExists[currentStage.id]" ng-bind="providedElsewhereLabel">
+ <th class="" ng-if="allowProvidedElsewhereExists[currentStage.id]" ng-bind="providedElsewhereLabel">
</th>
</tr>
</thead>
- <tr class="col-md-12" ng-repeat="prStDe in currentStage.programStageDataElements" ng-if="!isHidden(prStDe.dataElement.id)">
+ <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>
<a ng-if="prStDe.dataElement.description" Title="{{prStDe.dataElement.description}}" ng-init="showHelpText[prStDe.dataElement.id] = false;" ng-click="showHelpText[prStDe.dataElement.id] = !showHelpText[prStDe.dataElement.id]">
<span class="glyphicon glyphicon-info-sign" ></span>
<span ng-show="showHelpText[prStDe.dataElement.id]" ><br>{{prStDe.dataElement.description}}</span>
- </a>
+ </a>
+ <span ng-if="otherValuesLists[prStDe.dataElement.id] && currentStage.id !== 'PUZaKR0Jh2k'" ng-repeat="altValue in otherValuesLists[prStDe.dataElement.id] track by $index">
+ <span class="label label-default">{{altValue | translate}}</span>
+ </span>
+
</td>
<td>
<ng-form name="innerForm">
@@ -25,7 +29,7 @@
<ui-select ng-model="currentEvent[prStDe.dataElement.id]"
theme="select2"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
name="foo"
on-select="saveDatavalue(prStDe, innerForm.foo)"
style="width:100%;">
@@ -42,7 +46,7 @@
ng-class="getInputNotifcationClass(prStDe.dataElement.id,false, currentEvent)"
name={{prStDe.dataElement.id}}
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-change="saveDatavalue(prStDe, innerForm.foo)"
value=""> {{'no_value' | translate}}<br>
@@ -54,7 +58,7 @@
ng-class="getInputNotifcationClass(prStDe.dataElement.id,false, currentEvent)"
name={{prStDe.dataElement.id}}
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-change="saveDatavalue(prStDe, innerForm.foo)"
value={{option.name}}> {{option.name}}
@@ -71,7 +75,7 @@
ng-model="currentEvent[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -83,7 +87,7 @@
ng-model="currentEvent[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -95,7 +99,7 @@
ng-model="currentEvent[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -107,7 +111,7 @@
ng-model="currentEvent[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -119,7 +123,7 @@
ng-model="currentEvent[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -129,7 +133,7 @@
class="form-control"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo">
</textarea>
@@ -140,38 +144,18 @@
class="form-control"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
- <div ng-switch-when="BOOLEAN" class="form-control">
- <label class="radio-inline">
- <input type="radio"
- ng-model="currentEvent[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
- ng-change="saveDatavalue(prStDe, innerForm.foo)"
- value="">
- {{'no_value'| translate}}
- </label>
- <label class="radio-inline">
- <input type="radio"
- ng-model="currentEvent[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
- ng-change="saveDatavalue(prStDe, innerForm.foo)"
- value="true">
- {{'yes'| translate}}
- </label>
- <label class="radio-inline">
- <input type="radio"
- ng-model="currentEvent[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
- ng-change="saveDatavalue(prStDe, innerForm.foo)"
- value="false">
- {{'no'| translate}}
- </label>
+ <div ng-switch-when="BOOLEAN">
+ <dhis2-radio-button
+ dh-required="prStDe.compulsory"
+ dh-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id] === true"
+ dh-value="currentEvent[prStDe.dataElement.id]"
+ dh-name="foo"
+ dh-click="saveDataValueForRadio(prStDe, currentEvent, value)">
+ </dhis2-radio-button>
</div>
<div ng-switch-when="DATE">
<input type="text"
@@ -183,7 +167,7 @@
ng-class="getInputNotifcationClass(prStDe.dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
blur-or-change="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -193,31 +177,56 @@
ng-class="getInputNotifcationClass(prStDe.dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-change="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
+
+ <div ng-switch-when="MULTI_SELECT_GROUP">
+ <ui-select ng-model="currentEvent[prStDe.dataElement.id].selections"
+ id="multiSelectGroup"
+ ng-init="initMultiSelect(currentEvent)"
+ theme="select2"
+ ng-required={{prStDe.compulsory}}
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ name="foo"
+ multiple
+ on-remove="saveMultiSelectState($item,currentEvent,prStDe,false)"
+ on-select="saveMultiSelectState($item,currentEvent,prStDe,true)"
+ style="width:100%; overflow:visible">
+ <ui-select-match allow-clear="true" ng-class={{getInputNotifcationClass(prStDe.dataElement.id,false)}} class="form-control-ui-select" placeholder="{{'select_or_search' | translate}}" >{{$item.dataElement.formName ? $item.dataElement.formName : $item.dataElement.name }}</ui-select-match>
+ <ui-select-choices repeat="prStDe.dataElement as prStDe in currentStage.multiSelectGroups[prStDe.dataElement.id].dataElements | filter: $select.search | limitTo:maxOptionSize">
+ <span ng-bind-html="prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name | highlight: $select.search"></span>
+ </ui-select-choices>
+ <!--<ui-select-choices repeat="option.nameo.name as option in optionsTest | filter: $select.search | limitTo:maxOptionSize">
+ <span ng-bind-html="option.nameo.name | highlight: $select.search"></span>
+ </ui-select-choices>-->
+ </ui-select>
+ </div>
+
+
<div ng-switch-default>
<input type="text"
class="form-control"
ng-class="getInputNotifcationClass(prStDe.dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
</div>
- <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
- </div>
- <div class="alert alert-warning alert-dismissible" role="alert" ng-if="warningMessages[prStDe.dataElement.id]">
- <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- {{warningMessages[prStDe.dataElement.id]}}
- </div>
- <div class="alert alert-danger alert-dismissible" role="alert" ng-if="errorMessages[prStDe.dataElement.id]">
- <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- {{errorMessages[prStDe.dataElement.id]}}
- </div>
+
+ <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo, outerForm)" class="error-text" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ </div>
+ <div class="alert alert-warning alert-dismissible" role="alert" ng-if="warningMessages[currentEvent.event][prStDe.dataElement.id]">
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
+ {{warningMessages[currentEvent.event][prStDe.dataElement.id]}}
+ </div>
+ <div class="alert alert-danger alert-dismissible" role="alert" ng-if="errorMessages[currentEvent.event][prStDe.dataElement.id]">
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
+ {{errorMessages[currentEvent.event][prStDe.dataElement.id]}}
+ </div>
</ng-form>
</td>
<td ng-if="allowProvidedElsewhereExists[currentStage.id]">
@@ -235,20 +244,20 @@
<div ng-if='currentEvent && currentStage.programStageSections.length'>
<accordion close-others='false'>
<!-- The inline style was needed to override overflow:hidden in the css. Can possibly be replaced with a CSS update. -->
- <accordion-group heading="{{section.name}}" is-open="section.open" ng-repeat='section in currentStage.programStageSections' ng-if="!hiddenSections[section.id]" style="overflow:visible">
+ <accordion-group heading="{{section.name}}" is-open="section.open" ng-repeat='section in currentStage.programStageSections' ng-if="!hiddenSections[currentEvent.event][section.id]" style="overflow:visible">
<div class="vertical-spacing" ng-if="!section.programStageDataElements || section.programStageDataElements.length === 0">
<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" ng-if="section.programStageDataElements && section.programStageDataElements.length > 0">
<thead>
<tr>
<th ng-bind="dataElementLabel">
</th>
- <th class="align-center" ng-bind="valueLabel">
+ <th class="" ng-bind="valueLabel">
</th>
- <th class="align-center" ng-if="allowProvidedElsewhereExists[currentStage.id]" ng-bind="providedElsewhereLabel">
+ <th class="" ng-if="allowProvidedElsewhereExists[currentStage.id]" ng-bind="providedElsewhereLabel">
</th>
</tr>
</thead>
@@ -259,7 +268,10 @@
<a ng-if="prStDes[de.dataElement.id].dataElement.description" Title="{{prStDes[de.dataElement.id].dataElement.description}}" ng-init="showHelpText[de.dataElement.id] = false;" ng-click="showHelpText[de.dataElement.id] = !showHelpText[de.dataElement.id]">
<span class="glyphicon glyphicon-info-sign" ></span>
<span ng-show="showHelpText[de.dataElement.id]" ><br>{{prStDes[de.dataElement.id].dataElement.description}}</span>
- </a>
+ </a>
+ <span ng-if="otherValuesLists[de.dataElement.id]" ng-repeat="altValue in otherValuesLists[de.dataElement.id]">
+ <span class="label label-default">{{altValue | translate}}</span>
+ </span>
</td>
<td>
<ng-form name="innerForm">
@@ -268,7 +280,7 @@
<ui-select ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
theme="select2"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
name="foo"
on-select="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
style="width:100%;">
@@ -285,7 +297,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
name={{currentEvent[prStDes[de.dataElement.id].dataElement.id]}}
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-change="saveDatavalue(prStDes[de.dataElement.id])"
value=""> {{'no_value' | translate}}<br>
@@ -297,7 +309,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
name={{currentEvent[prStDes[de.dataElement.id].dataElement.id]}}
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-change="saveDatavalue(prStDes[de.dataElement.id])"
value={{option.name}}> {{option.name}}
@@ -314,7 +326,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -326,7 +338,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -338,7 +350,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -350,7 +362,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -362,38 +374,20 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
- <div ng-switch-when="BOOLEAN" class="form-control">
- <label class="radio-inline">
- <input type="radio"
- ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
- ng-change="saveDatavalue(prStDes[de.dataElement.id])"
- value="">
- {{'no_value'| translate}}
- </label>
- <label class="radio-inline">
- <input type="radio"
- ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
- ng-change="saveDatavalue(prStDes[de.dataElement.id])"
- value="true">
- {{'yes'| translate}}
- </label>
- <label class="radio-inline">
- <input type="radio"
- ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
- ng-change="saveDatavalue(prStDes[de.dataElement.id])"
- value="false">
- {{'no'| translate}}
- </label>
+
+ <div ng-switch-when="BOOLEAN">
+ <dhis2-radio-button
+ dh-required="prStDes[de.dataElement.id].compulsory"
+ 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-click="saveDataValueForRadio(prStDes[de.dataElement.id], currentEvent, value)">
+ </dhis2-radio-button>
+
</div>
<div ng-switch-when="DATE">
<input type="text"
@@ -405,7 +399,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
blur-or-change="saveDatavalue(prStDes[de.dataElement.id])"
name="foo"/>
</div>
@@ -415,7 +409,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-change="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -425,7 +419,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo">
</textarea>
@@ -436,7 +430,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -446,20 +440,21 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[currentEvent.event][de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id])"
name="foo"/>
</div>
- <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
- </div>
- <div class="alert alert-warning alert-dismissible" role="alert" ng-if="warningMessages[de.dataElement.id]">
- <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- {{warningMessages[de.dataElement.id]}}
- </div>
- <div class="alert alert-danger alert-dismissible" role="alert" ng-if="errorMessages[de.dataElement.id]">
- <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- {{errorMessages[de.dataElement.id]}}
- </div>
+
+ <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo, outerForm)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ </div>
+ <div class="alert alert-warning alert-dismissible" role="alert" ng-if="warningMessages[currentEvent.event][de.dataElement.id]">
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
+ {{warningMessages[currentEvent.event][de.dataElement.id]}}
+ </div>
+ <div class="alert alert-danger alert-dismissible" role="alert" ng-if="errorMessages[currentEvent.event][de.dataElement.id]">
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
+ {{errorMessages[currentEvent.event][de.dataElement.id]}}
+ </div>
</div>
</ng-form>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html 2015-12-16 10:52:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html 2015-12-17 15:00:48 +0000
@@ -14,9 +14,9 @@
ng-disabled="currentEvent.status === 'SKIPPED' || selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
ng-required="true"
blur-or-change="saveEventDate()"/>
- <span ng-if="invalidDate" class="error">{{'date_required'| translate}}</span>
+ <span ng-if="invalidDate === currentEvent.event" class="error">{{'date_required'| translate}}</span>
</div>
- <div class="col-md-6" ng-if="!currentStage.hideDueDate">
+ <div ng-if="!currentEvent.eventDate && currentEvent.status !== 'SKIPPED'" class="col-md-6">
<span ng-if="currentEvent.eventDate || currentEvent.status === 'SKIPPED' || currentEvent.dueDate">
{{'due_date'| translate}}
</span>
@@ -30,9 +30,9 @@
d2-date
ng-model="currentEvent.dueDate"
blur-or-change="saveDueDate()"
- ng-disabled="currentEvent.eventDate || !schedulingEnabled || selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"/>
- <span ng-if="invalidDate" class="error">{{'date_required'| translate}}</span>
- </div>
+ ng-disabled="currentEvent.eventDate || !schedulingEnabled || currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"/>
+ <span ng-if="invalidDueDate === currentEvent.event" class="error">{{'date_required'| translate}}</span>
+ </div>
</div>
<!-- event dates/scheduling end -->
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-layout.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-layout.html 2015-12-16 10:52:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-layout.html 2015-12-17 15:00:48 +0000
@@ -2,13 +2,23 @@
<thead>
<tr>
<th class="active" style="vertical-align:middle" ng-repeat="stage in programStages">
- {{stage.name}}
+ {{stage.name}}
<!-- event add/filter icon begins -->
<span class='pull-right'>
<span ng-if="stageNeedsEvent(stage) && selectedEnrollment.status === 'ACTIVE'">
- <a href title="{{'create_new_event'| translate}}" ng-click="showCreateEvent(stage)" style="vertical-align:middle"><i class="fa fa-plus"></i></a>
+ <a href title="{{'create_new_event'| translate}}" ng-click="showCreateEvent(stage,eventCreationActions.add)" style="vertical-align:middle">
+ {{'add'|translate}}
+ </a>
+ |
+ <a href title="{{'schedule_new_event'| translate}}" ng-click="showCreateEvent(stage,eventCreationActions.schedule)" style="vertical-align:middle">
+ {{'schedule'|translate}}
+ </a>
+ |
+ <a href title="Make referral" ng-click="showCreateEvent(stage, eventCreationActions.referral)" style="vertical-align: middle" ng-if="showReferral">
+ Referral
+ </a>
</span>
</span>
<!-- event add/filter icon ends -->
@@ -26,14 +36,14 @@
ng-click="showDataEntry(dhis2Event, false)">
{{dhis2Event.orgUnitName}}<br/>
{{dhis2Event.sortingDate}}<br>
- <span ng-if="eventsByStage[stage.id].length > 1 && !filterEvents">[{{eventsByStage[stage.id].length - $index}}]</span>
+ <span ng-if="eventsByStage[stage.id].length > 1 && !filterEvents">[{{$index + 1}}]</span>
</div>
</div>
<span ng-if="eventsByStage[stage.id].length > 1 && filterEvents">
<span ng-if="currentEvent.programStage !== stage.id">
<div class="event-paging">
<a href class="event-paging" ng-click="showDataEntryForEvent(eventsByStage[stage.id][0])">{{'show_more'| translate}}</a>
- </div>
+ </div>
</span>
<event-paginator ng-if="stage.id === currentEvent.programStage"></event-paginator>
</span>
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/eventstatus-in-table.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/eventstatus-in-table.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/eventstatus-in-table.html 2015-12-17 15:00:48 +0000
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<!--
+Copyright (c) 2015, UiO
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+-->
+
+<div>
+ <div class="pull-right" ng-show="event===chosenEvent && buttonsEnabled()">
+ <div class="btn-group event-table-options-dropdown dropup">
+ <button type="button" class="btn btn-default" ng-click="defaultOption.onClick()" data-toggle='tooltip' title='{{defaultOption.tooltip | translate}}' ng-bind-html="defaultOption.icon" ng-disabled="defaultOption.disabled">
+ </button>
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+ <span class="caret"></span>
+ <span class="sr-only">Toggle Dropdown</span>
+ </button>
+ <ul class="dropdown-menu custom-dropdown-menu dropdown-menu-left">
+ <li ng-show="option.show && !option.disabled" ng-repeat="option in eventTableOptionsArr" ng-click="option.onClick()">
+ <a href="">
+ <span ng-bind-html="option.icon"></span>
+ {{option.text | translate}}
+ </a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ <div class="pull-right" ng-show="event!=chosenEvent || !buttonsEnabled()">
+ <span class="badge event-table-options-badge" ng-class="getEventStyle(event)">
+ <span ng-show="event.status == EVENTSTATUSCOMPLETELABEL" class="glyphicon glyphicon-ok event-table-options-glypicon"></span>
+ <span ng-show="event.status != EVENTSTATUSCOMPLETELABEL" class="glyphicon glyphicon-remove event-table-options-glypicon"></span>
+ </span>
+ </div>
+</div>
+
+
+
+
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/modal-default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/modal-default-form.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/modal-default-form.html 2015-12-17 15:00:48 +0000
@@ -0,0 +1,124 @@
+<div style='padding:10px'>
+
+ <ng-form name="modalForm" novalidate>
+ <!-- event dates/scheduling begin -->
+ <div class="row" ng-if="!currentStage.periodType">
+
+ <div class="col-md-6">
+ {{currentEvent.excecutionDateLabel}}
+ <input type="text"
+ placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+ class="form-control"
+ ng-class="{'input-success': eventDateSaved}"
+ d2-date
+ max-date="0"
+ min-date=""
+ ng-model="currentEvent.eventDate"
+ ng-disabled="currentEvent.status === 'SKIPPED' || currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-required="true"
+ blur-or-change="saveEventDate()"/>
+ <span ng-if="invalidDate === currentEvent.event" class="error">{{'date_required'| translate}}</span>
+ </div>
+ <div ng-if="!currentEvent.eventDate && currentEvent.status !== 'SKIPPED'" class="col-md-6">
+ <span ng-if="currentEvent.eventDate || currentEvent.status === 'SKIPPED' || currentEvent.dueDate">
+ {{'due_date'| translate}}
+ </span>
+ <span ng-if="!currentEvent.eventDate && currentEvent.status !== 'SKIPPED' && !selectedEntity.inactive">
+ <a href ng-click="enableRescheduling()" title="{{ schedulingEnabled ? 'disable_rescheduling' : 'enable_rescheduling' | translate}}"><span class="text-primary bold">{{'reschedule_duedate'| translate}}</span></a>
+ </span>
+ <input type="text"
+ placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+ class="form-control"
+ ng-class="{'input-success': dueDateSaved}"
+ d2-date
+ ng-model="currentEvent.dueDate"
+ blur-or-change="saveDueDate()"
+ ng-disabled="currentEvent.eventDate || !schedulingEnabled || currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"/>
+ <span ng-if="invalidDueDate === currentEvent.event" class="error">{{'date_required'| translate}}</span>
+ </div>
+ </div>
+ <!-- event dates/scheduling end -->
+
+ <!-- coordinates begin -->
+
+ <div class="row" ng-if="currentStage.captureCoordinates && currentEvent.eventDate">
+ <div class="col-md-6">
+ {{'latitude'| translate}}<span><a href ng-click="showMap(currentEvent)" title="{{'get_from_map'| translate}}"><i class="fa fa-map-marker fa-2x"></i></a></span>
+ <input type="number"
+ ng-model="currentEvent.coordinate.latitude"
+ class="form-control"
+ ng-class="{'input-success': latitudeSaved}"
+ name="latitude"
+ d2-coordinate-validator
+ ng-blur="saveCoordinate('LAT')"
+ ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-required="false"/>
+ <div ng-messages="outerForm.latitude.$error" ng-if="interacted(outerForm.latitude)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ </div>
+ </div>
+ <div class="col-md-6">
+ {{'longitude'| translate}}<span><a href ng-click="showMap(currentEvent)" title="{{'get_from_map'| translate}}"><i class="fa fa-map-marker fa-2x"></i></a></span>
+ <input type="number"
+ ng-model="currentEvent.coordinate.longitude"
+ class="form-control"
+ ng-class="{'input-success': longitudeSaved}"
+ name="longitude"
+ d2-coordinate-validator
+ ng-blur="saveCoordinate('LNG')"
+ ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-required="false"/>
+ <div ng-messages="outerForm.longitude.$error" ng-if="interacted(outerForm.longitude)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ </div>
+ </div>
+ </div>
+
+ <br/>
+ <div ng-if="currentEvent.eventDate">
+ <div ng-include="'components/dataentry/default-form.html'"></div>
+ <!-- data entry/event buttons begins -->
+ </div>
+ <div>
+ <div class="form-group" ng-controller='ModalDefaultFormController'>
+
+ <div><hr></div>
+ <!--show error messsages-->
+ <div ng-if='requestError'>
+ <alert type='danger'>{{requestError}}</alert>
+ </div>
+
+ <!---->
+
+ <a href ng-click="completeIncompleteEventModal()"
+ class="btn btn-warning"
+ ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id"
+ ng-if="currentEvent.eventDate && (currentEvent.status === 'SCHEDULE' || currentEvent.status === 'ACTIVE' || currentEvent.status === 'VISITED')">{{'complete'| translate}}</a>
+
+ <a href ng-click="completeIncompleteEventModal()"
+ class="btn btn-warning"
+ ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed && currentEvent.status !== 'COMPLETED' || currentEvent.orgUnit !== selectedOrgUnit.id"
+ ng-if="currentEvent.eventDate && currentEvent.status === 'COMPLETED'">{{'incomplete'| translate}}</a>
+
+ <a href ng-click="skipUnskipEventModal()"
+ class="btn btn-warning"
+ ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id"
+ ng-if="!currentEvent.eventDate && currentEvent.status !== 'SKIPPED'">{{'skip'| translate}}</a>
+
+ <a href ng-click="skipUnskipEventModal()"
+ class="btn btn-warning"
+ ng-disabled="currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id"
+ ng-if="currentEvent.status === 'SKIPPED'">{{'unskip' | translate}}</a>
+
+
+ <a href ng-click="deleteEventModal()"
+ ng-disabled="currentEvent.enrollmentStatus === 'COMPLETED' || currentEvent.editingNotAllowed || currentEvent.orgUnit !== selectedOrgUnit.id"
+ class="btn btn-danger">{{'delete'| translate}}</a>
+
+ <a href ng-click="closeEventModal()"
+ class="btn btn-default">{{'close'| translate}}</a>
+
+ <!--<a href class="btn btn-primary" ng-click="printDiv('divForPrint');">{{'print_form'| translate}}</a>-->
+ </div>
+ </div>
+ </ng-form>
+<!-- data entry/event buttons ends -->
+</div>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/new-event.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/new-event.html 2015-10-20 09:44:15 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/new-event.html 2015-12-17 15:00:48 +0000
@@ -1,11 +1,13 @@
<div class="modal-header page">
- <h3>{{'new_event'| translate}} - {{dhis2Event.name}}</h3>
+ <h3 ng-if="isNewEvent">{{'add'| translate}} - {{dhis2Event.name}}</h3>
+ <h3 ng-if="isScheduleEvent && !isReferralEvent">{{'schedule'| translate}} - {{dhis2Event.name}}</h3>
+ <h3 ng-if="isReferralEvent">{{'referral' | translate}} - {{dhis2Event.name}}</h3>
</div>
<div class="modal-body page">
<form name="eventCreationForm" class="form-horizontal" role="form" novalidate>
<div ng-if="!selectedStage.periodType">
- <div class="form-group">
- <label class="col-sm-2 control-label">{{'due_date'| translate}}</label>
+ <div ng-if="isScheduleEvent && !isReferralEvent" class="form-group">
+ <label class="col-sm-2 control-label">{{'scheduled_date'| translate}}</label>
<div class="col-sm-10">
<input type="text"
class="form-control"
@@ -15,16 +17,16 @@
d2-date
ng-model="dhis2Event.dueDate">
<span ng-if="dueDateInvalid" class="error">{{'required'| translate}}</span>
- </div>
+ </div>
</div>
- <div class="form-group">
+ <div ng-if="isNewEvent" class="form-group">
<label class="col-sm-2 control-label">{{dhis2Event.excecutionDateLabel}}</label>
<div class="col-sm-10">
<input type="text"
class="form-control"
name="eventDate"
placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
- ng-rquired="false"
+ ng-rquired="true"
d2-date
max-date="0"
min-date=""
@@ -32,9 +34,50 @@
<span ng-if="eventDateInvalid" class="error">{{'required'| translate}}</span>
</div>
</div>
+ <div ng-if="isReferralEvent">
+ <h4>Select an organizaton unit</h4>
+ <div class="org-unit-tree row" data-stop-propagation="true">
+ <i class="fa fa-spinner fa-spin fa-2x" ng-show="orgUnitsLoading"></i>
+ <script type="text/ng-template" id="orgUnitTree.html">
+ <span ng-init="initTest(orgUnit)">
+ <span class="org-unit-tree-button" ng-click="expandCollapse(orgUnit)" ng-show="orgUnit.show && orgUnit.children.length > 0"><i class="fa fa-minus-square-o"></i></span>
+ <span class="org-unit-tree-button" ng-click="expandCollapse(orgUnit)" ng-show="(!orgUnit.show && orgUnit.children.length > 0) || (!orgUnit.show && orgUnit.hasChildren)"><i class="fa fa-plus-square-o"></i></span>
+ <span class="org-unit-tree-button" ng-click="setSelectedSearchingOrgUnit(orgUnit)" ng-class="{'selected-org-unit' : orgUnit.id === selectedSearchingOrgUnit.id}">{{orgUnit.name}}</span>
+ <ul class="tree" id="tree" ng-show="orgUnit.show">
+ <li ng-repeat="orgUnit in orgUnit.children | orderBy:'name'" ng-include="'orgUnitTree.html'"></li>
+ </ul>
+ </span>
+ </script>
+ <ul class="tree" id="tree" ng-hide="orgUnitsLoading">
+ <li ng-repeat="orgUnit in orgUnits | orderBy:'name'" ng-include="'orgUnitTree.html'"></li>
+ </ul>
+ </div>
+ <div class="alert alert-warning" ng-if="orgUnitError"><span>Please select an organization unit</span></div>
+ <hr/>
+ <div class="input-group">
+ <label for="referralDueDate"><strong>{{dhis2Event.excecutionDateLabel}}</strong></label>
+ <input type="text"
+ placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+ id="referralDueDate"
+ name="dueDate"
+ d2-date
+ d2-date-validator
+ class="form-control"
+ ng-model="dhis2Event.dueDate"
+ ng-required="true"
+ />
+ </div>
+ <br/>
+ <div class="input-group">
+ <label>
+ <input type="checkbox" ng-model="referralMovePermanent" id="referralMovePermanent" /> <strong>Move permanent</strong>
+ </label>
+ </div>
+ <span ng-if="dueDateInvalid" class="error">{{'required'| translate}}</span>
+ </div>
</div>
<div ng-if="selectedStage.periodType">
- <div class="form-group">
+ <div class="form-group">
<label class="control-label">
{{'period'| translate}}
</label>
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/referral-modal.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/referral-modal.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/referral-modal.html 2015-12-17 15:00:48 +0000
@@ -0,0 +1,35 @@
+<div class="modal-header">
+ <h3>Make referral</h3>
+</div>
+<div class="modal-body">
+ <h4>Select an organizaton unit</h4>
+ <div class="org-unit-tree row" data-stop-propagation="true">
+ <script type="text/ng-template" id="orgUnitTree.html">
+ <span class="org-unit-tree-button" ng-click="expandCollapse(orgUnit)" ng-show="orgUnit.show && orgUnit.children.length > 0"><i class="fa fa-minus-square-o"></i></span>
+ <span class="org-unit-tree-button" ng-click="expandCollapse(orgUnit)" ng-show="(!orgUnit.show && orgUnit.children.length > 0) || (!orgUnit.show && orgUnit.hasChildren)"><i class="fa fa-plus-square-o"></i></span>
+ <span class="org-unit-tree-button" ng-click="setSelectedSearchingOrgUnit(orgUnit)" ng-class="{'selected-org-unit' : orgUnit.id === selectedSearchingOrgUnit.id}">{{orgUnit.name}}</span>
+ <ul class="tree" id="tree" ng-show="orgUnit.show">
+ <li ng-repeat="orgUnit in orgUnit.children | orderBy:'name'" ng-include="'orgUnitTree.html'"></li>
+ </ul>
+ </script>
+ <ul class="tree" id="tree">
+ <li ng-repeat="orgUnit in orgUnits | orderBy:'name'" ng-include="'orgUnitTree.html'"></li>
+ </ul>
+ </div>
+ <div class="alert alert-warning" ng-if="orgError"><span>Please select an organization unit</span></div>
+ <hr/>
+ <h4>{{stage.excecutionDateLabel}}</h4>
+ <input type="text"
+ placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+ d2-date
+ d2-date-validator
+ class="form-control"
+ ng-model="referralDate"
+ ng-required="true"
+ />
+ <div class="alert alert-warning" ng-if="dateError"><span>Please select a date</span></div>
+</div>
+<div class="modal-footer">
+ <button class="btn btn-default" data-ng-click="cancel()">Cancel</button>
+ <button class="btn btn-primary" data-ng-click="makeReferral()">Make referral</button>
+</div>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html 2015-11-25 10:41:52 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html 2015-12-17 15:00:48 +0000
@@ -1,317 +1,392 @@
-<form name="tableEntryOuterForm" novalidate>
- <table class="table-borderless table-striped" ng-if='currentEvent'>
- <thead>
- <tr class="col-md-12">
- <th class="col-md-2" >
- {{currentEvent.excecutionDateLabel}}
- </th>
- <th class="col-md-2" ng-repeat="prStDe in currentStage.programStageDataElements">
- {{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}
- <a ng-if="prStDes[prStDe.dataElement.id].dataElement.description" Title="{{prStDes[prStDe.dataElement.id].dataElement.description}}" ng-init="showHelpText[prStDe.dataElement.id] = false;" ng-click="showHelpText[prStDe.dataElement.id] = !showHelpText[prStDe.dataElement.id]">
- <span class="glyphicon glyphicon-info-sign" ></span>
- <span ng-show="showHelpText[prStDe.dataElement.id]" ><br>{{prStDes[prStDe.dataElement.id].dataElement.description}}</span>
- </a>
- </th>
- <th class="col-md-2">Status</th>
- </thead>
- <tr ng-class="currentEvent === eventRow ? getEventStyle(eventRow) : 'col-md-12'" ng-repeat="eventRow in currentStageEvents" ng-if="currentStageEvents" ng-click="switchToEventRow(eventRow)">
- <td class="col-md-2" ng-class="{'current-event-td': currentEvent === eventRow}">
- <div ng-if="eventRow === currentEvent && eventRow.status !== EVENTSTATUSCOMPLETELABEL && eventRow.status !== EVENTSTATUSSKIPPEDLABEL">
- <input type="text"
- placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
- class="form-control"
- ng-class="getInputDueDateClass(eventRow)"
- d2-date
- ng-model="eventRow.eventDate"
- ng-disabled="eventRow.status === 'SKIPPED' || eventRow.enrollmentStatus !== 'ACTIVE' || eventRow.editingNotAllowed "
- ng-required="true"
- blur-or-change="saveEventDateForEvent(eventRow)"/>
- </div>
- <div ng-if="eventRow !== currentEvent || eventRow.status === EVENTSTATUSCOMPLETELABEL || eventRow.status === EVENTSTATUSSKIPPEDLABEL">
- {{eventRow.eventDate}}
- </div>
- <span ng-if="invalidDate === eventRow.event" class="error">{{'date_required'| translate}}</span>
- </td>
- <td ng-class="{'current-event-td': currentEvent === eventRow, 'col-md-2 optionset': prStDe.dataElement.optionSetValue, 'col-md-2': !(prStDe.dataElement.optionSetValue)}" ng-repeat="prStDe in currentStage.programStageDataElements">
- <ng-form ng-if="eventRow === currentEvent && eventRow.status !== EVENTSTATUSCOMPLETELABEL && eventRow.status !== EVENTSTATUSSKIPPEDLABEL && eventRow.validatedEventDate" name="innerform">
- <div ng-if="prStDe.dataElement.optionSetValue">
- <div ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDe.dataElement.optionSet.id].options.length >= 7">
- <ui-select ng-model="eventRow[prStDe.dataElement.id]"
- theme="select2"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
- name="foo"
- on-select="saveDatavalue(prStDe, innerForm.foo)"
- style="width:100%;">
- <ui-select-match allow-clear="true" ng-class={{getInputNotifcationClass(prStDe.dataElement.id,false)}} class="form-control-ui-select" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
- <ui-select-choices repeat="option.name as option in optionSets[prStDe.dataElement.optionSet.id].options | filter: $select.search | limitTo:maxOptionSize">
- <span ng-bind-html="option.name | highlight: $select.search"></span>
- </ui-select-choices>
- </ui-select>
- </div>
- <div ng-if="selectedProgram.dataEntryMethod && optionSets[prStDe.dataElement.optionSet.id].options.length < 7">
- <label>
- <input type="radio"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
- class="form-control"
- name={{prStDe.dataElement.id}}
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-change="saveDatavalue(prStDe, innerForm.foo)"
- value=""> {{'no_value' | translate}}<br>
- </label><br>
- <span ng-repeat="option in optionSets[prStDe.dataElement.optionSet.id].options">
- <label>
- <input type="radio"
- class="form-control"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
- name={{prStDe.dataElement.id}}
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-change="saveDatavalue(prStDe, innerForm.foo)"
- value={{option.name}}> {{option.name}}
- </label><br>
+<form name="tableEntryOuterForm" novalidate>
+ <div ng-show="currentStageEvents && currentStageEvents.length > 0">
+ <table class="table-borderless table-striped event-table-custom">
+ <thead>
+ <tr class="">
+ <th class="">
+ <!--{{currentEvent.excecutionDateLabel}}-->
+ DOB/Ab
+ </th>
+ <th class="" ng-repeat="prStDe in currentStage.programStageDataElements">
+ {{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}
+ <a ng-if="prStDes[prStDe.dataElement.id].dataElement.description" Title="{{prStDes[prStDe.dataElement.id].dataElement.description}}" ng-init="showHelpText[prStDe.dataElement.id] = false;" ng-click="showHelpText[prStDe.dataElement.id] = !showHelpText[prStDe.dataElement.id]">
+ <span class="glyphicon glyphicon-info-sign" ></span>
+ <span ng-show="showHelpText[prStDe.dataElement.id]" ><br>{{prStDes[prStDe.dataElement.id].dataElement.description}}</span>
+ </a>
+ </th>
+ <th class="" style="text-align: right">Status</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-class="currentEvent === eventRow ? getEventStyle(eventRow) : ''"
+ ng-repeat="eventRow in currentStageEvents"
+ ng-if="currentStageEvents"
+ ng-click="eventRowClicked(eventRow)"
+ ng-dblclick="eventRowDblClicked(eventRow);"
+ ng-form="eventRowForm{{eventRow.event}}"
+ dhis2-deselect dh-on-deselected="deselectCurrent(id)" dh-id="{{eventRow.event}}" dh-pre-selected="currentEvent === eventRow">
+ <td class="" ng-class="{'current-event-td': currentEvent === eventRow}">
+ <div ng-if="tableRowIsEditable(eventRow)">
+ <input type="text"
+ placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+ class="form-control"
+ ng-class="getInputNotifcationClass('eventDate',false)"
+ d2-date
+ ng-model="eventRow.eventDate"
+ ng-disabled="eventRow.status === 'SKIPPED' || eventRow.enrollmentStatus !== 'ACTIVE' || eventRow.editingNotAllowed "
+ ng-required="true"
+ ng-dblclick="$event.stopPropagation();"
+ title="DOB/Ab"
+ blur-or-change="saveEventDateForEvent(eventRow)"/>
+ </div>
+ <div class="event-table-inactive" ng-if="!tableRowIsEditable(eventRow)">
+ <span title="DOB/Ab">
+ {{eventRow.eventDate}}
+ </span>
+ </div>
+ <span ng-if="invalidDate === eventRow.event" class="error">{{'date_required'| translate}}</span>
+
+ </td>
+ <td ng-class="{'current-event-td': currentEvent === eventRow, 'optionset': prStDe.dataElement.optionSetValue, '': !(prStDe.dataElement.optionSetValue)}"
+ ng-repeat="prStDe in currentStage.programStageDataElements">
+ <div ng-if="!isHidden(prStDe.dataElement.id, eventRow)">
+ <div ng-if="tableRowIsEditable(eventRow) && eventRow.validatedEventDate">
+ <div ng-if="prStDe.dataElement.optionSetValue">
+ <div ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDe.dataElement.optionSet.id].options.length >= 7">
+ <div>
+ <ui-select ng-model="eventRow[prStDe.dataElement.id]"
+ theme="select2"
+ ng-dblclick="$event.stopPropagation();"
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-required={{prStDe.compulsory}}
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"
+ on-select="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ style="width:100%;">
+ <ui-select-match allow-clear="true" ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)' class="form-control-ui-select" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
+ <ui-select-choices repeat="option.name as option in optionSets[prStDe.dataElement.optionSet.id].options | filter: $select.search | limitTo:maxOptionSize">
+ <span ng-bind-html="option.name | highlight: $select.search"></span>
+ </ui-select-choices>
+ </ui-select>
+ </div>
+ </div>
+ <div ng-if="selectedProgram.dataEntryMethod && optionSets[prStDe.dataElement.optionSet.id].options.length < 7">
+ <label>
+ <input type="radio"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
+ class="form-control"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
+ ng-model="eventRow[prStDe.dataElement.id]"
+ ng-change="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ value=""> {{'no_value' | translate}}<br>
+ </label><br>
+ <span ng-repeat="option in optionSets[prStDe.dataElement.optionSet.id].options">
+ <label>
+ <input type="radio"
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
+ ng-model="eventRow[prStDe.dataElement.id]"
+ ng-change="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ value={{option.name}}> {{option.name}}
+ </label><br>
+ </span>
+ </div>
+ </div>
+ <div ng-if="!prStDe.dataElement.optionSetValue" ng-switch="prStDe.dataElement.valueType">
+ <div ng-switch-when="NUMBER">
+ <input type="number"
+ number-type={{prStDe.dataElement.numberType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="eventRow[prStDe.dataElement.id]"
+ d2-number-validator
+ ng-required={{prStDe.compulsory}}
+ ng-dblclick="$event.stopPropagation();"
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
+ ng-blur="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"/>
+ </div>
+ <div ng-switch-when="INTEGER">
+ <input type="number"
+ number-type={{prStDe.dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="eventRow[prStDe.dataElement.id]"
+ d2-number-validator
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"/>
+ </div>
+ <div ng-switch-when="INTEGER_POSITIVE">
+ <input type="number"
+ number-type={{prStDe.dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="eventRow[prStDe.dataElement.id]"
+ d2-number-validator
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"/>
+ </div>
+ <div ng-switch-when="INTEGER_NEGATIVE">
+ <input type="number"
+ number-type={{prStDe.dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="eventRow[prStDe.dataElement.id]"
+ d2-number-validator
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"/>
+ </div>
+ <div ng-switch-when="INTEGER_ZERO_OR_POSITIVE">
+ <input type="number"
+ number-type={{prStDe.dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="eventRow[prStDe.dataElement.id]"
+ d2-number-validator
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"/>
+ </div>
+ <div ng-switch-when="LONG_TEXT">
+ <textarea rows="3"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ class="form-control"
+ ng-model="eventRow[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
+ ng-blur="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"/>
+ </textarea>
+ </div>
+ <div ng-switch-when="TEXT">
+ <input type="text"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ class="form-control"
+ ng-model="eventRow[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
+ ng-blur="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"/>
+ </div>
+ <div ng-switch-when="BOOLEAN">
+ <dhis2-radio-button
+ ng-dblclick="$event.stopPropagation();"
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ dh-required="prStDe.compulsory"
+ dh-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][de.dataElement.id] === true"
+ dh-value="eventRow[prStDe.dataElement.id]"
+ dh-name="{{eventRow.event}}{{prStDe.dataElement.id}}"
+ dh-click="saveDataValueForRadio(prStDe, eventRow, value)">
+ </dhis2-radio-button>
+ </div>
+ <div ng-switch-when="DATE">
+ <input type="text"
+ placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+ d2-date
+ d2-date-validator
+ max-date="prStDe.allowFutureDate ? '' : 0"
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="eventRow[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
+ blur-or-change="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"/>
+ </div>
+ <div ng-switch-when="TRUE_ONLY">
+ <input type="checkbox"
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="eventRow[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
+ ng-change="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"/>
+ </div>
+ <div ng-switch-when="MULTI_SELECT_GROUP">
+ <ui-select ng-model="eventRow[prStDe.dataElement.id].selections"
+ id="multiSelectGroup"
+ ng-init="initMultiSelect(eventRow)"
+ theme="select2"
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"
+ multiple
+ on-remove="saveMultiSelectState($item,eventRow,prStDe,false)"
+ on-select="saveMultiSelectState($item,eventRow,prStDe,true)"
+ style="width:100%; overflow:visible">
+ <ui-select-match allow-clear="true" ng-class={{getInputNotifcationClass(prStDe.dataElement.id,false)}} class="form-control-ui-select" placeholder="{{'select_or_search' | translate}}" >{{$item.dataElement.formName ? $item.dataElement.formName : $item.dataElement.name }}</ui-select-match>
+ <ui-select-choices repeat="prStDe.dataElement as prStDe in currentStage.multiSelectGroups[prStDe.dataElement.id].dataElements | filter: $select.search | limitTo:maxOptionSize">
+ <span ng-bind-html="prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name | highlight: $select.search"></span>
+ </ui-select-choices>
+ <!--<ui-select-choices repeat="option.nameo.name as option in optionsTest | filter: $select.search | limitTo:maxOptionSize">
+ <span ng-bind-html="option.nameo.name | highlight: $select.search"></span>
+ </ui-select-choices>-->
+ </ui-select>
+ </div>
+ <div ng-switch-default>
+ <input type="text"
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="eventRow[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-dblclick="$event.stopPropagation();"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
+ ng-blur="saveDatavalue(prStDe, $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id))"
+ name="{{eventRow.event}}{{prStDe.dataElement.id}}"/>
+ </div>
+ </div>
+
+ <div ng-messages="$eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id + '.$error')"
+ ng-show="eventRow.submitted || $eval('eventRowForm' + eventRow.event + '.' + eventRow.event + prStDe.dataElement.id + '.$dirty')"
+ class="error-text"
+ ng-dblclick="$event.stopPropagation();"
+ ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ </div>
+
+ </div>
+ <div class="event-table-inactive" ng-if="!tableRowIsEditable(eventRow) || !eventRow.validatedEventDate">
+ <div ng-switch="prStDe.dataElement.valueType">
+ <div ng-switch-when="BOOLEAN">
+ <dhis2-radio-button
+ dh-required="prStDe.compulsory"
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ dh-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][de.dataElement.id] === true"
+ dh-value="eventRow[prStDe.dataElement.id]"
+ dh-name="{{eventRow.event}}{{prStDe.dataElement.id}}"
+ dh-click="saveDataValueForRadio(prStDe, eventRow, value)">
+ </dhis2-radio-button>
+ </div>
+ <div ng-switch-when="TRUE_ONLY">
+ <input type="checkbox"
+ class="form-control"
+ ng-model="eventRow[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}"
+ ng-disabled="true"
+ name="foo"/>
+ </div>
+ <div ng-switch-when="MULTI_SELECT_GROUP">
+ <ul>
+ <li ng-repeat='event in eventRow[prStDe.dataElement.id].selections' title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}">
+ {{event.formName ? event.formName : event.name}}
+ </li>
+ </ul>
+ </div>
+ <div ng-switch-default>
+ <span title="{{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}">
+ {{eventRow[prStDe.dataElement.id]}}
+ </span>
+ </div>
+ </div>
+ </div>
+
+ <div if="errorMessages[eventRow.event][prStDe.dataElement.id] || warningMessages[eventRow.event][prStDe.dataElement.id]"
+ class="icon-padding"
+ ng-click="$event.stopPropagation();"
+ ng-dblclick="$event.stopPropagation();">
+ <span ng-click="showCompleteErrorMessageInModal(errorMessages[eventRow.event][prStDe.dataElement.id], prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name)"
+ ng-show="errorMessages[eventRow.event][prStDe.dataElement.id]">
+ <i class="fa fa-exclamation-triangle error-text"
+ tooltip="{{errorMessages[eventRow.event][prStDe.dataElement.id]}}"
+ tooltip-placement="bottom"></i>
+ </span>
+ <span ng-click="showCompleteErrorMessageInModal(warningMessages[eventRow.event][prStDe.dataElement.id], prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name, true)"
+ ng-show="warningMessages[eventRow.event][prStDe.dataElement.id]">
+ <i class="fa fa-exclamation-triangle warning-text"
+ tooltip="{{warningMessages[eventRow.event][prStDe.dataElement.id]}}"
+ tooltip-placement="bottom"></i>
+ </span>
+ </div>
+ </div>
+ <!--<span ng-show="dataEntryOuterForm.submitted && innerform.foo.$invalid" class="error">{{'required'| translate}}</span>-->
+ </td>
+ <td class="min-possible-width prevent-text-selection-on-double-click" ng-class="{'current-event-td': currentEvent === eventRow}">
+ <div class="statuscol" ng-controller="EventOptionsInTableController">
+ <div class="pull-right" ng-show="eventRow === currentEvent && tableEditMode !== tableEditModes.form && tableRowStatusButtonsEnabled(eventRow)">
+ <div class="btn-group event-table-options-dropdown dropup"
+ ng-dblclick="$event.stopPropagation();">
+ <button type="button" class="btn btn-default" ng-click="defaultOption.onClick()" data-toggle='tooltip' title='{{defaultOption.tooltip | translate}}' ng-bind-html="defaultOption.icon" ng-disabled="defaultOption.disabled">
+ </button>
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+ <span class="caret"></span>
+ <span class="sr-only">Toggle Dropdown</span>
+ </button>
+ <ul class="dropdown-menu">
+ <li ng-show="option.show && !option.disabled" ng-repeat="option in eventTableOptionsArr" ng-click="option.onClick()">
+ <a href="">
+ <span ng-bind-html="option.icon"></span>
+ {{option.text | translate}}
+ </a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ <div class="pull-right" ng-show="eventRow !== currentEvent || tableEditMode === tableEditModes.form || !tableRowStatusButtonsEnabled(eventRow)" ng-dblclick="$event.stopPropagation();">
+ <span ng-show="eventRow !== currentEvent" class="badge event-table-options-badge" ng-class="getEventStyle(eventRow)">
+ <span ng-show="eventRow.status === EVENTSTATUSCOMPLETELABEL" class="glyphicon glyphicon-ok event-table-options-glypicon"></span>
+ <span ng-show="eventRow.status !== EVENTSTATUSCOMPLETELABEL" class="glyphicon glyphicon-remove event-table-options-glypicon"></span>
+ </span>
+ <span ng-show="eventRow === currentEvent" style="padding-right: 2px">
+ <span ng-show="eventRow.status === EVENTSTATUSCOMPLETELABEL" class="glyphicon glyphicon-ok event-table-options-glypicon"></span>
+ <span ng-show="eventRow.status !== EVENTSTATUSCOMPLETELABEL" class="glyphicon glyphicon-remove event-table-options-glypicon"></span>
</span>
- </div>
- </div>
- <div ng-if="!prStDe.dataElement.optionSetValue" ng-switch="prStDe.dataElement.valueType">
- <div ng-switch-when="NUMBER">
- <input type="number"
- number-type={{prStDe.dataElement.numberType}}
- class="form-control"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- ng-model="eventRow[prStDe.dataElement.id]"
- d2-number-validator
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
- ng-blur="saveDatavalue(prStDe, innerForm.foo)"
- name="foo"/>
- </div>
- <div ng-switch-when="INTEGER">
- <input type="number"
- number-type={{prStDe.dataElement.valueType}}
- class="form-control"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- ng-model="eventRow[prStDe.dataElement.id]"
- d2-number-validator
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
- ng-blur="saveDatavalue(prStDe, innerForm.foo)"
- name="foo"/>
- </div>
- <div ng-switch-when="INTEGER_POSITIVE">
- <input type="number"
- number-type={{prStDe.dataElement.valueType}}
- class="form-control"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- ng-model="eventRow[prStDe.dataElement.id]"
- d2-number-validator
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
- ng-blur="saveDatavalue(prStDe, innerForm.foo)"
- name="foo"/>
- </div>
- <div ng-switch-when="INTEGER_NEGATIVE">
- <input type="number"
- number-type={{prStDe.dataElement.valueType}}
- class="form-control"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- ng-model="eventRow[prStDe.dataElement.id]"
- d2-number-validator
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
- ng-blur="saveDatavalue(prStDe, innerForm.foo)"
- name="foo"/>
- </div>
- <div ng-switch-when="INTEGER_ZERO_OR_POSITIVE">
- <input type="number"
- number-type={{prStDe.dataElement.valueType}}
- class="form-control"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- ng-model="eventRow[prStDe.dataElement.id]"
- d2-number-validator
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
- ng-blur="saveDatavalue(prStDe, innerForm.foo)"
- name="foo"/>
- </div>
- <div ng-switch-when="LONG_TEXT">
- <textarea rows="3"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- class="form-control"
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
- ng-blur="saveDatavalue(prStDe, innerForm.foo)"
- name="foo">
- </textarea>
- </div>
- <div ng-switch-when="TEXT">
- <input type="text"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- class="form-control"
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
- ng-blur="saveDatavalue(prStDe, innerForm.foo)"
- name="foo"/>
- </div>
- <div ng-switch-when="BOOLEAN">
- <label class="radio-inline">
- <input type="radio"
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[de.dataElement.id]"
- ng-change="saveDatavalue(prStDes[de.dataElement.id])"
- value="">
- {{'no_value'| translate}}
- </label>
- <label class="radio-inline">
- <input type="radio"
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[de.dataElement.id]"
- ng-change="saveDatavalue(prStDes[de.dataElement.id])"
- value="true">
- {{'yes'| translate}}
- </label>
- <label class="radio-inline">
- <input type="radio"
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[de.dataElement.id]"
- ng-change="saveDatavalue(prStDes[de.dataElement.id])"
- value="false">
- {{'no'| translate}}
- </label>
- </div>
- <div ng-switch-when="DATE">
- <input type="text"
- placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
- d2-date
- d2-date-validator
- max-date="prStDe.allowFutureDate ? '' : 0"
- class="form-control"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
- blur-or-change="saveDatavalue(prStDe, innerForm.foo)"
- name="foo"/>
- </div>
- <div ng-switch-when="TRUE_ONLY">
- <input type="checkbox"
- class="form-control"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
- ng-change="saveDatavalue(prStDe, innerForm.foo)"
- name="foo"/>
- </div>
- <div ng-switch-default>
- <input type="text"
- class="form-control"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
- ng-blur="saveDatavalue(prStDe, innerForm.foo)"
- name="foo"/>
- </div>
- </div>
- <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
- <div class="alert alert-warning alert-dismissible" role="alert" ng-if="warningMessages[prStDe.dataElement.id]">
- <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- {{warningMessages[prStDe.dataElement.id]}}
- </div>
- <div class="alert alert-danger alert-dismissible" role="alert" ng-if="errorMessages[prStDe.dataElement.id]">
- <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- {{errorMessages[prStDe.dataElement.id]}}
- </div>
- </div>
- </ng-form>
- <ng-form ng-if="eventRow !== currentEvent || eventRow.status === EVENTSTATUSCOMPLETELABEL || eventRow.status === EVENTSTATUSSKIPPEDLABEL || !eventRow.validatedEventDate" name="innerform" >
- <div ng-switch="prStDe.dataElement.valueType">
- <div ng-switch-when="BOOLEAN">
- <select class="form-control"
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="true"
- name="foo">
- <option value="">{{'please_select'| translate}}</option>
- <option value="false">{{'no'| translate}}</option>
- <option value="true">{{'yes'| translate}}</option>
- </select>
- </div>
- <div ng-switch-when="TRUE_ONLY">
- <input type="checkbox"
- class="form-control"
- ng-model="eventRow[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="true"
- name="foo"/>
- </div>
- <div ng-switch-default>
- {{eventRow[prStDe.dataElement.id]}}
- </div>
- </div>
- <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
- <div class="alert alert-warning alert-dismissible" role="alert" ng-if="warningMessages[prStDe.dataElement.id]">
- <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- {{warningMessages[prStDe.dataElement.id]}}
- </div>
- <div class="alert alert-danger alert-dismissible" role="alert" ng-if="errorMessages[prStDe.dataElement.id]">
- <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
- {{errorMessages[prStDe.dataElement.id]}}
- </div>
- </div>
- </ng-form>
- <span ng-show="dataEntryOuterForm.submitted && innerform.foo.$invalid" class="error">{{'required'| translate}}</span>
- </td>
- <td class="col-md-2" ng-class="{'current-event-td': currentEvent === eventRow}">
- <div ng-controller="EventOptionsInTableController" ng-if="eventRow.enrollmentStatus === 'ACTIVE' && !eventRow.editingNotAllowed && eventRow.orgUnit === selectedOrgUnit.id">
- <div class="btn-group event-table-options-dropdown dropup" ng-show="eventRow==currentEvent">
- <button type="button" class="btn btn-default" ng-click="defaultOption.onClick()" data-toggle='tooltip' title='{{defaultOption.tooltip | translate}}' ng-bind-html="defaultOption.icon" ng-disabled="defaultOption.disabled">
- </button>
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
- <span class="caret"></span>
- <span class="sr-only">Toggle Dropdown</span>
- </button>
- <ul class="dropdown-menu">
- <li ng-show="option.show && !option.disabled" ng-repeat="option in eventTableOptionsArr" ng-click="option.onClick()">
- <a href="">
- <span ng-bind-html="option.icon"></span>
- {{option.text | translate}}
- </a>
- </li>
- </ul>
- </div>
- <div ng-show="eventRow!=currentEvent">
- <span class="badge event-table-options-badge" ng-class="getEventStyle(eventRow)">
- <span ng-show="eventRow.status == EVENTSTATUSCOMPLETELABEL" class="glyphicon glyphicon-ok event-table-options-glypicon"></span>
- <span ng-show="eventRow.status != EVENTSTATUSCOMPLETELABEL" class="glyphicon glyphicon-remove event-table-options-glypicon"></span>
- </span>
- </div>
- </div>
- </td>
- <!--<td class="col-md-2" ng-if="allowProvidedElsewhereExists">
- <div class="align-center" ng-show="prStDe.allowProvidedElsewhere">
- <input type="checkbox"
- ng-model="eventRow.providedElsewhere[prStDe.dataElement.id]"
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
- ng-change="saveDatavalueLocation(prStDe)"/>
- </div>
- </td>-->
- </tr>
- </table>
- <div class="col-md-12" style="text-align: right">
- <button type="button"
- class="btn btn-default"
- ng-click="showCreateEvent(currentStage)">
- {{'add'| translate}}
- </button>
+ </div>
+ </div>
+ </td>
+ <!--<td class="col-md-2" ng-if="allowProvidedElsewhereExists">
+ <div class="align-center" ng-show="prStDe.allowProvidedElsewhere">
+ <input type="checkbox"
+ ng-model="eventRow.providedElsewhere[prStDe.dataElement.id]"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[eventRow.event][prStDe.dataElement.id] "
+ ng-change="saveDatavalueLocation(prStDe)"/>
+ </div>
+ </td>-->
+ </tr>
+ </tbody>
+ </table>
+ <div class="col-md-12" style="text-align: right;padding-right: 4px;">
+ <button type="button"
+ class="btn btn-default"
+ ng-click="showCreateEvent(currentStage, eventCreationActions.add)">
+ {{'add'| translate}}
+ </button>
+ </div>
</div>
</form>
\ No newline at end of file
=== 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-03 11:30:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js 2015-12-17 15:00:48 +0000
@@ -29,4 +29,571 @@
});
}
};
-});
\ No newline at end of file
+})
+
+.directive('eventstatusInTable', function (){
+ return {
+ restrict: 'E',
+ templateUrl: 'components/dataentry/eventstatus-in-table.html',
+ scope: {
+ event: '=',
+ chosenEventWrapped: '=', //two-way-binding not working if not wrapped in object!
+ getEventStyle: '=',
+ programStage: '=',
+ optionSets: '=',
+ completeActionCustom: '=', //optional
+ reopenActionCustom: '=', //optional
+ validateActionCustom: '=', //optional
+ deleteActionCustom: '=', //optional
+ skipActionCustom: '=', //optional
+ unskipActionCustom: '=', //optional
+ notesActionCustom: '=', //optional
+ applicableButtons: '=', //optional
+ actions: '=',
+ allEvents: '=',
+ formData: '=',
+ buttonsEnabled: '&'
+ },
+ controller: [
+ '$scope',
+ '$element',
+ '$attrs',
+ '$q',
+ 'EventUtils',
+ 'DHIS2EventFactory',
+ 'DialogService',
+ function($scope, $element, $attrs, $q, EventUtils, DHIS2EventFactory, DialogService){
+
+ $scope.EVENTSTATUSCOMPLETELABEL = "COMPLETED";
+ $scope.EVENTSTATUSSKIPPEDLABEL = "SKIPPED";
+ $scope.EVENTSTATUSVISITEDLABEL = "VISITED";
+ $scope.EVENTSTATUSACTIVELABEL = "ACTIVE";
+ $scope.EVENTSTATUSSCHEDULELABEL = "SCHEDULE";
+ var COMPLETE = "Complete";
+ var INCOMPLETE = "Incomplete";
+ var VALIDATE = "Validate";
+ var DELETE = "Delete";
+ var SKIP = "Skip";
+ var UNSKIP = "Unskip";
+ var NOTE = "Note";
+
+ $scope.completeAction = function() {
+ if(angular.isDefined($scope.completeActionCustom)){
+ $scope.completeActionCustom();
+ }
+ else {
+ $scope.completeActionDefault();
+ }
+ };
+
+ $scope.reopenAction = function() {
+ if(angular.isDefined($scope.reopenActionCustom)){
+ $scope.reopenActionCustom();
+ }
+ else {
+ $scope.reopenActionDefault();
+ }
+ };
+
+ $scope.validateAction = function(){
+ if(angular.isDefined($scope.validateActionCustom)){
+ $scope.validateActionCustom();
+ }
+ };
+
+ $scope.deleteAction = function(){
+ if(angular.isDefined($scope.deleteActionCustom)){
+ $scope.deleteActionCustom();
+ }
+ else {
+ $scope.deleteActionDefault();
+ }
+
+ };
+
+ $scope.skipAction = function(){
+ if(angular.isDefined($scope.skipActionCustom)){
+ $scope.skipActionCustom();
+ }
+ };
+
+ $scope.unskipAction = function(){
+ if(angular.isDefined($scope.unskipActionCustom)){
+ $scope.unskipActionCustom();
+ }
+ };
+
+ $scope.showNotes = function(){
+ if(angular.isDefined($scope.notesActionCustom)){
+ $scope.notesActionCustom();
+ }
+ else {
+ $scope.notesModal();
+ }
+ };
+
+ $scope.eventTableOptions = {};
+ $scope.eventTableOptions[COMPLETE] = {text: "Complete", tooltip: 'Complete', icon: "<span class='glyphicon glyphicon-check'></span>", value: COMPLETE, onClick: $scope.completeAction, sort: 0};
+ $scope.eventTableOptions[INCOMPLETE] = {text: "Reopen", tooltip: 'Reopen', icon: "<span class='glyphicon glyphicon-pencil'></span>", value: INCOMPLETE, onClick: $scope.reopenAction, sort: 1};
+ $scope.eventTableOptions[VALIDATE] = {text: "Validate", tooltip: 'Validate', icon: "<span class='glyphicon glyphicon-cog'></span>", value: VALIDATE, onClick: $scope.validateAction, sort: 2};
+ $scope.eventTableOptions[DELETE] = {text: "Delete", tooltip: 'Delete', icon: "<span class='glyphicon glyphicon-floppy-remove'></span>", value: DELETE, onClick: $scope.deleteAction, sort: 3};
+ $scope.eventTableOptions[SKIP] = {text: "Skip", tooltip: 'Skip', icon: "<span class='glyphicon glyphicon-step-forward'></span>", value: SKIP, onClick: $scope.skipAction, sort: 4};
+ $scope.eventTableOptions[UNSKIP] = {text: "Schedule back", tooltip: 'Schedule back', icon: "<span class='glyphicon glyphicon-step-backward'></span>", value: UNSKIP, onClick: $scope.unskipAction, sort: 5};
+ $scope.eventTableOptions[NOTE] = {text: "Notes", tooltip: 'Show notes', icon: "<span class='glyphicon glyphicon-list-alt'></span>", value: NOTE, onClick: $scope.showNotes, sort: 6};
+
+ $scope.event.validatedEventDate = $scope.event.eventDate;
+
+ updateEventTableOptions();
+
+ $scope.$watch("event.status", function(newValue, oldValue){
+
+ if(newValue !== oldValue){
+ updateEventTableOptions();
+ }
+ });
+
+ $scope.$watch("validatedDateSetForEvent", function(newValue, oldValue){
+
+ if(angular.isDefined(newValue)){
+ if(!angular.equals(newValue, {})){
+ var updatedEvent = newValue.event;
+ if(updatedEvent === $scope.event){
+ $scope.event.validatedEventDate = newValue.date;
+ updateEventTableOptions();
+ }
+ }
+ }
+ });
+
+ function updateEventTableOptions(){
+
+ var eventRow = $scope.event;
+
+ for(var key in $scope.eventTableOptions){
+ $scope.eventTableOptions[key].show = true;
+ $scope.eventTableOptions[key].disabled = false;
+ }
+
+ $scope.eventTableOptions[UNSKIP].show = false;
+
+ switch(eventRow.status){
+ case $scope.EVENTSTATUSCOMPLETELABEL:
+ $scope.eventTableOptions[COMPLETE].show = false;
+ $scope.eventTableOptions[SKIP].show = false;
+ $scope.eventTableOptions[VALIDATE].show = false;
+ $scope.defaultOption = $scope.eventTableOptions[INCOMPLETE];
+ $scope.defaultOption2 = $scope.eventTableOptions[DELETE];
+ break;
+ case $scope.EVENTSTATUSSKIPPEDLABEL:
+ $scope.eventTableOptions[COMPLETE].show = false;
+ $scope.eventTableOptions[INCOMPLETE].show = false;
+ $scope.eventTableOptions[VALIDATE].show = false;
+ $scope.eventTableOptions[SKIP].show = false;
+
+ $scope.eventTableOptions[UNSKIP].show = true;
+ $scope.defaultOption = $scope.eventTableOptions[UNSKIP];
+ $scope.defaultOption2 = $scope.eventTableOptions[DELETE];
+ break;
+ default:
+ if(eventRow.validatedEventDate){
+ $scope.eventTableOptions[INCOMPLETE].show = false;
+ $scope.defaultOption = $scope.eventTableOptions[COMPLETE];
+ $scope.defaultOption2 = $scope.eventTableOptions[DELETE];
+ }
+ else {
+ $scope.eventTableOptions[INCOMPLETE].show = false;
+ $scope.eventTableOptions[VALIDATE].show = false;
+ $scope.eventTableOptions[COMPLETE].disabled = true;
+ $scope.defaultOption = $scope.eventTableOptions[COMPLETE];
+ $scope.defaultOption2 = $scope.eventTableOptions[DELETE];
+ }
+ break;
+ }
+
+ createOptionsArray();
+ }
+
+ function createOptionsArray(){
+ $scope.eventTableOptionsArr = [];
+
+ if(angular.isDefined($scope.applicableButtons)){
+ var defaultFound = false;
+ for(var key in $scope.eventTableOptions){
+ var show = false;
+
+ for(i = 0; i < $scope.applicableButtons.length; i++){
+ if($scope.applicableButtons[i] === key){
+ show = true;
+ break;
+ }
+ }
+
+ if(show){
+ if($scope.eventTableOptions[key] === $scope.defaultOption){
+ defaultFound = true;
+ }
+ $scope.eventTableOptionsArr.push($scope.eventTableOptions[key]);
+ }
+ }
+
+ $scope.eventTableOptionsArr.sort(function(a,b){
+ return a.sort - b.sort;
+ });
+
+ if(!defaultFound){
+ $scope.defaultOption = $scope.defaultOption2;
+ }
+ }
+ else {
+ for(var key in $scope.eventTableOptions){
+ $scope.eventTableOptionsArr[$scope.eventTableOptions[key].sort] = $scope.eventTableOptions[key];
+ }
+ }
+ }
+
+ //-----------
+ $scope.notesModal = function(){
+
+ var def = $q.defer();
+
+ var bodyList = [];
+ if($scope.event.notes) {
+ for(i = 0; i < $scope.event.notes.length; i++){
+ var currentNote = $scope.event.notes[i];
+ bodyList.push({value1: currentNote.storedDate, value2: currentNote.value});
+ }
+ }
+
+ var dialogOptions = {
+ closeButtonText: 'Close',
+ textAreaButtonText: 'Add',
+ textAreaButtonShow: $scope.event.status === $scope.EVENTSTATUSSKIPPEDLABEL ? false : true,
+ headerText: 'Notes',
+ bodyTextAreas: [{model: 'note', placeholder: 'Add another note here', required: true, show: $scope.event.status === $scope.EVENTSTATUSSKIPPEDLABEL ? false : true}],
+ bodyList: bodyList,
+ currentEvent: $scope.event
+ };
+
+ var dialogDefaults = {
+
+ templateUrl: 'views/list-with-textarea-modal.html',
+ controller: function ($scope, $modalInstance, DHIS2EventFactory, DateUtils) {
+ $scope.modalOptions = dialogOptions;
+ $scope.formSubmitted = false;
+ $scope.currentEvent = $scope.modalOptions.currentEvent;
+ $scope.textAreaValues = [];
+
+ $scope.textAreaButtonClick = function(){
+ if($scope.textAreaModalForm.$valid){
+ $scope.note = $scope.textAreaValues["note"];
+ $scope.addNote();
+ $scope.textAreaModalForm.$setUntouched();
+ $scope.formSubmitted = false;
+ }
+ else {
+ $scope.formSubmitted = true;
+ }
+ };
+
+ $scope.modalOptions.close = function(){
+ $modalInstance.close($scope.currentEvent);
+ };
+
+ $scope.addNote = function(){
+
+ var newNote = {value: $scope.note};
+ var date = DateUtils.formatToHrsMins(new Date());
+
+ var e = {event: $scope.currentEvent.event,
+ program: $scope.currentEvent.program,
+ programStage: $scope.currentEvent.programStage,
+ orgUnit: $scope.currentEvent.orgUnit,
+ trackedEntityInstance: $scope.currentEvent.trackedEntityInstance,
+ notes: [newNote]
+ };
+
+ DHIS2EventFactory.updateForNote(e).then(function (data) {
+ if (angular.isUndefined($scope.modalOptions.bodyList) || $scope.modalOptions.bodyList.length === 0) {
+ $scope.modalOptions.bodyList = [{value1: date, value2: newNote.value}];
+ $scope.modalOptions.currentEvent.notes = [{storedDate: date, value: newNote.value}];
+ }
+ else {
+ $scope.modalOptions.bodyList.splice(0, 0, {value1: date, value2: newNote.value});
+ $scope.modalOptions.currentEvent.notes.splice(0,0,{storedDate: date, value: newNote.value});
+ }
+ $scope.note = $scope.textAreaValues["note"] = "";
+ });
+
+ };
+ }
+ };
+
+ DialogService.showDialog(dialogDefaults, dialogOptions).then(function(e){
+ $scope.event.notes = e.notes;
+ def.resolve();
+ });
+
+ return def.promise;
+ };
+
+ if(angular.isDefined($scope.actions)){
+ $scope.actions[$scope.event.event] = {};
+ $scope.actions[$scope.event.event].notes = $scope.notesModal;
+ }
+ //-----------
+
+ $scope.deleteActionDefault = function() {
+
+ DHIS2EventFactory.delete($scope.event).then(function (data) {
+
+ var foundIndex = -1;
+ //find index
+ for(i = 0; i < $scope.allEvents.length; i++){
+ if($scope.allEvents[i] === $scope.event){
+ foundIndex = i;
+ break;
+ }
+ }
+
+ if(foundIndex !== -1){
+ $scope.allEvents.splice(foundIndex,1);
+ }
+ setChosenEventToNothing();
+ });
+ };
+
+ $scope.completeActionDefault = function() {
+
+ $scope.event.submitted = true;
+ if($scope.formData.$valid){
+ var dhis2EventToUpdate = makeDhis2EventToUpdate();
+ dhis2EventToUpdate.status = $scope.EVENTSTATUSCOMPLETELABEL;
+ DHIS2EventFactory.update(dhis2EventToUpdate).then(function (data) {
+ $scope.event.status = $scope.EVENTSTATUSCOMPLETELABEL;
+ setChosenEventToNothing();
+
+ //reset dataElementStatus for event
+ $scope.event.deStatus = {};
+ }, function(){
+
+ });
+ }
+ };
+
+ $scope.reopenActionDefault = function () {
+ var dhis2EventToUpdate = makeDhis2EventToUpdate();
+ dhis2EventToUpdate.status = $scope.EVENTSTATUSACTIVELABEL;
+ DHIS2EventFactory.update(dhis2EventToUpdate).then(function (data) {
+ $scope.event.status = $scope.EVENTSTATUSACTIVELABEL;
+ });
+ }
+
+ function makeDhis2EventToUpdate() {
+
+ var dhis2EventToUpdate = {};
+
+ if(angular.isDefined($scope.programStage) && angular.isDefined($scope.optionSets)){
+
+ var dhis2Event = EventUtils.reconstruct($scope.event, $scope.programStage, $scope.optionSets);
+ dhis2EventToUpdate = angular.copy(dhis2Event);
+ }
+ else {
+ dhis2EventToUpdate = angular.copy($scope.event);
+ }
+
+ /*
+ dhis2EventToUpdate.dataValues = [];
+
+ for(var key in $scope.event[assocValuesProp]){
+ dhis2EventToUpdate.dataValues.push($scope.event[assocValuesProp][key]);
+ } */
+
+ return dhis2EventToUpdate;
+ }
+
+ function setChosenEventToNothing(){
+ $scope.chosenEventWrapped.currentEvent = {};
+ }
+
+ $scope.$watch('chosenEventWrapped.currentEvent', function(newEvent, oldEvent){
+ if(angular.isDefined(newEvent)){
+
+ if(newEvent !== oldEvent){
+ $scope.chosenEvent = newEvent;
+ }
+ }
+ });
+
+
+ }
+ ]
+ };
+})
+.directive('dhis2RadioButton', function (){
+ return {
+ restrict: 'E',
+ templateUrl: 'views/dhis2-radio-button.html',
+ scope: {
+ required: '=dhRequired',
+ value: '=dhValue',
+ disabled: '=dhDisabled',
+ name: '@dhName',
+ customOnClick: '&dhClick'
+ },
+ controller: [
+ '$scope',
+ '$element',
+ '$attrs',
+ '$q',
+ 'CommonUtils',
+ function($scope, $element, $attrs, $q, CommonUtils){
+
+ $scope.status = "";
+ $scope.clickedButton = "";
+
+ $scope.valueClicked = function (buttonValue){
+
+ $scope.clickedButton = buttonValue;
+
+ var originalValue = $scope.value;
+ var tempValue = buttonValue;
+ if($scope.value === buttonValue){
+ tempValue = "";
+ }
+
+ if(angular.isDefined($scope.customOnClick)){
+ var promise = $scope.customOnClick({value: tempValue});
+ if(angular.isDefined(promise) && angular.isDefined(promise.then)){
+ promise.then(function(status){
+ if(angular.isUndefined(status) || status !== "notSaved"){
+ $scope.status = "saved";
+ }
+ $scope.value = tempValue;
+ }, function(){
+ $scope.status = "error";
+ $scope.value = originalValue;
+ });
+ }
+ else if(angular.isDefined(promise)){
+ if(promise === false){
+ $scope.value = originalValue;
+ }
+ else {
+ $scope.value = tempValue;
+ }
+ }
+ else{
+ $scope.value = tempValue;
+ }
+ }
+ else{
+ $scope.value = tempValue;
+ }
+ };
+
+ $scope.getDisabledValue = function(inValue){
+ return CommonUtils.displayBooleanAsYesNo(inValue);
+ };
+
+ $scope.getDisabledIcon = function(inValue){
+ if(inValue === true || inValue === "true"){
+ return "fa fa-check";
+ }
+ else if(inValue === false || inValue === "false"){
+ return "fa fa-times";
+ }
+ return '';
+ }
+
+ }],
+ link: function (scope, element, attrs) {
+
+ scope.radioButtonColor = function(buttonValue){
+
+ if(scope.value !== ""){
+ if(scope.status === "saved"){
+ 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.radioButtonImage = function(buttonValue){
+
+ if(angular.isDefined(scope.value)){
+ if(scope.value === buttonValue && buttonValue === "true"){
+ return 'fa fa-stack-1x fa-check';
+ }
+ else if(scope.value === buttonValue && buttonValue === "false"){
+ return 'fa fa-stack-1x fa-times';
+ }
+ }
+ return 'fa fa-stack-1x';
+ };
+ }
+ };
+})
+
+.directive('dhis2Deselect', function ($document) {
+ return {
+ restrict: 'A',
+ scope: {
+ onDeselected: '&dhOnDeselected',
+ id: '@dhId',
+ preSelected: '=dhPreSelected'
+ },
+ controller: [
+ '$scope',
+ '$element',
+ '$attrs',
+ '$q',
+ function($scope, $element, $attrs, $q){
+
+ $scope.documentEventListenerSet = false;
+ $scope.elementClicked = false;
+
+ $element.on('click', function(event) {
+
+ $scope.elementClicked = true;
+ if($scope.documentEventListenerSet === false){
+ $document.on('click', $scope.documentClick);
+ $scope.documentEventListenerSet = true;
+ }
+ });
+
+ $scope.documentClick = function(event){
+
+ var modalPresent = $(".modal-backdrop").length > 0;
+ var calendarPresent = $(".calendars-popup").length > 0;
+ var calendarPresentInEvent = $(event.target).parents(".calendars-popup").length > 0;
+
+ if($scope.elementClicked === false &&
+ modalPresent === false &&
+ calendarPresent === false &&
+ calendarPresentInEvent === false){
+ $scope.onDeselected({id:$scope.id});
+ $scope.$apply();
+ $document.off('click', $scope.documentClick);
+ $scope.documentEventListenerSet = false;
+ }
+ $scope.elementClicked = false;
+ };
+
+ if(angular.isDefined($scope.preSelected) && $scope.preSelected === true){
+ $document.on('click', $scope.documentClick);
+ $scope.documentEventListenerSet = true;
+ }
+
+ }],
+ link: function (scope, element, attrs) {}
+ };
+})
+;
=== 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 2015-12-14 15:05:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-12-17 15:00:48 +0000
@@ -20,7 +20,8 @@
/* Service to fetch/store dasboard widgets */
.service('DashboardLayoutService', function($http) {
-
+ var ButtonIds = { Complete: "Complete", Incomplete: "Incomplete", Validate: "Validate", Delete: "Delete", Skip: "Skip", Unskip: "Unskip", Note: "Note" };
+
var w = {};
w.enrollmentWidget = {title: 'enrollment', view: "components/enrollment/enrollment.html", show: true, expand: true, parent: 'biggerWidget', order: 0};
w.indicatorWidget = {title: 'indicators', view: "components/rulebound/rulebound.html", show: true, expand: true, parent: 'biggerWidget', order: 1};
@@ -471,8 +472,7 @@
/* Factory for fetching OrgUnit */
.factory('OrgUnitFactory', function($http, SessionStorageService) {
- var orgUnit, orgUnitPromise, rootOrgUnitPromise;
- var roles = SessionStorageService.get('USER_ROLES');
+ var orgUnit, orgUnitPromise, rootOrgUnitPromise, orgUnitWithGroupsPromise, orgUnitWithParent;
return {
get: function(uid){
if( orgUnit !== uid ){
@@ -482,26 +482,41 @@
});
}
return orgUnitPromise;
- },
+ },
+ getWithGroups: function(uid){
+ orgUnitWithGroupsPromise = $http.get( '../api/organisationUnits.json?filter=id:eq:' + uid + '&fields=id,name,children[id,name,organisationUnitGroups[shortName],children[id,name, organisationUnitGroups[shortName]],organisationUnitGroups[shortName]]&paging=false' ).then(function(response){
+ orgUnit = response.data.id;
+ return response.data;
+ });
+ return orgUnitWithGroupsPromise;
+ },
+ getWithParents: function(uid){
+ orgUnitWithParent = $http.get( '../api/organisationUnits.json?filter=id:eq:' + uid + '&fields=id,name,parent[id,name,parent[id,name,parent[id,name,parent[id,name]]]&paging=false' ).then(function(response){
+ orgUnit = response.data.id;
+ return response.data;
+ });
+ return orgUnitWithParent;
+ },
getSearchTreeRoot: function(){
- if(!rootOrgUnitPromise){
- var url = '../api/me.json?fields=organisationUnits[id,name,children[id,name,children[id,name]]]&paging=false';
- if( roles && roles.userCredentials && roles.userCredentials.userRoles){
- var userRoles = roles.userCredentials.userRoles;
- for(var i=0; i<userRoles.length; i++){
- if(userRoles[i].authorities.indexOf('ALL') !== -1 ||
- userRoles[i].authorities.indexOf('F_TRACKED_ENTITY_INSTANCE_SEARCH_IN_ALL_ORGUNITS') !== -1 ){
- url = '../api/organisationUnits.json?filter=level:eq:1&fields=id,name,children[id,name,children[id,name]]&paging=false';
- i=userRoles.length;
- }
- }
- }
- rootOrgUnitPromise = $http.get( url ).then(function(response){
- return response.data;
- });
- }
- return rootOrgUnitPromise;
- }
+ var roles = SessionStorageService.get('USER_ROLES');
+ if(!rootOrgUnitPromise){
+ var url = '../api/me.json?fields=organisationUnits[id,name,children[id,name,children[id,name]]]&paging=false';
+ if( roles && roles.userCredentials && roles.userCredentials.userRoles){
+ var userRoles = roles.userCredentials.userRoles;
+ for(var i=0; i<userRoles.length; i++){
+ if(userRoles[i].authorities.indexOf('ALL') !== -1 ||
+ userRoles[i].authorities.indexOf('F_TRACKED_ENTITY_INSTANCE_SEARCH_IN_ALL_ORGUNITS') !== -1 ){
+ url = '../api/organisationUnits.json?filter=level:eq:1&fields=id,name,children[id,name,children[id,name]]&paging=false';
+ i=userRoles.length;
+ }
+ }
+ }
+ rootOrgUnitPromise = $http.get( url ).then(function(response){
+ return response.data;
+ });
+ }
+ return rootOrgUnitPromise;
+ }
};
})
@@ -983,6 +998,16 @@
});
return promise;
},
+ getEventsByProgramStage: function(entity, programStage){
+ var url = '../api/events.json?ouMode=ACCESSIBLE&' + 'trackedEntityInstance=' + entity + '&paging=false';
+ if(programStage){
+ url += '&programStage='+programStage;
+ }
+ var promise = $http.get(url).then(function(response){
+ return response.data.events;
+ });
+ return promise;
+ },
getByOrgUnitAndProgram: function(orgUnit, ouMode, program, startDate, endDate){
var url;
if(startDate && endDate){
@@ -1864,4 +1889,31 @@
}
};
+})
+
+.service('EventCreationService', function($modal){
+
+ this.showModal = function(stage, dummyEvent,eventCreationAction, autoCreate){
+ var modalInstance = $modal.open({
+ templateUrl: 'components/dataentry/new-event.html',
+ controller: 'EventCreationController',
+ resolve: {
+ dummyEvent: function () {
+ return dummyEvent;
+ },
+ autoCreate: function () {
+ //In case the programstage is a table, autocreate
+ return autoCreate;
+ },
+ eventCreationAction: function() {
+ return eventCreationAction;
+ },
+ stage: function(){
+ return stage;
+ }
+ }
+ });
+ return modalInstance;
+ };
+ this.eventCreationActions = { add: 'ADD', schedule: 'SCHEDULE', referral: 'REFERRAL'};
});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2015-12-16 14:44:28 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2015-12-17 15:00:48 +0000
@@ -80,6 +80,10 @@
width: 264px;
}
+#bootstrapSelectForm .selectContainer .form-control-feedback {
+ /* Adjust feedback icon position */
+ right: -15px;
+}
/*----------------------------------------------------------------------------*/
/* Program-stage-instances
@@ -178,6 +182,15 @@
/* App - specific
/*----------------------------------------------------------------------------*/
+div.ui-select-dropdown.select2-drop.select2-with-searchbox.select2-drop-active{
+ min-width: 200px;
+}
+ul.select2-choices {
+ /*overflow: visible !important;*/
+}
+span.form-control-ui-select.ui-select-match {
+ padding:1px;
+}
.container-heading {
color: white;
}
@@ -963,7 +976,11 @@
}
#ui-datepicker-div, .calendars-popup {
- z-index: 2000; //has to be greater than bootsrap's modal z-index
+ z-index: 2000; /* has to be greater than bootsrap's modal z-index */
+}
+
+.no-padding {
+ padding:0px;
}
/*Necessary to override the .panel-group .panel { overflow: hidden; } in bootstrap.*/
@@ -1209,6 +1226,10 @@
background: #ebf0f6;
}
+.default-form-table > tbody > tr {
+ height: 40px;
+}
+
.row.null-margins {
margin-left: 0;
margin-right: 0;
@@ -1219,6 +1240,76 @@
padding: 0px;
}
+.event-table-custom > thead{
+ background-color: #FFFFFF;
+ padding-top: 10px;
+}
+
+.event-table-custom > tbody > tr {
+ height: 40px;
+}
+
+.event-table-custom > thead > tr > th {
+ padding-left: 7px;
+ padding-right: 7px;
+ margin: 0;
+}
+
+.event-table-custom > tbody > tr > td {
+ vertical-align: top;
+ padding-top: 5px;
+ padding-bottom: 5px;
+ padding-left: 2px;
+ padding-right: 2px;
+ margin: 0;
+}
+
+.event-table-custom > tbody > tr > td .event-table-inactive {
+ padding-right: 5px;
+ padding-left: 5px;
+}
+
+.event-table-custom > tbody > tr > td.optionset {
+ vertical-align: top;
+ padding-top: 5px;
+ padding-bottom: 5px;
+ padding-left: 2px;
+ padding-right: 2px;
+ margin: 0;
+}
+
+.event-table-custom > tbody > tr > td input {
+ padding: 5px;
+ margin: 0;
+}
+
+.event-table-custom > tbody > tr > td textarea {
+ padding: 5px;
+ margin: 0;
+}
+
+.event-table-custom > tbody > tr > td select {
+ padding: 5px;
+ margin: 0;
+}
+
+.event-table-custom > tbody > tr > td button {
+ padding-top: 5px;
+ padding-bottom: 5px;
+ margin: 0;
+}
+
+.event-table-custom > tbody > tr > td a {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+.event-table-custom > tbody > tr > td .statuscol {
+ padding-right: 4px;
+}
+
+
+
.badge.event-table-options-badge {
padding-top: 0.5;
padding-bottom: 0.5;
@@ -1232,10 +1323,103 @@
background-color: inherit;
}
+.table.table-event-overview > tbody > tr > td {
+ border: none;
+ vertical-align: middle;
+}
+
+.table.table-event-overview > thead > tr > th {
+ border: none;
+}
+
+.min-possible-width {
+ width: 1px;
+}
+
+.radio-display-none {
+ display: none;
+}
+
+.fa-stack > .fa.fa-stack-1x.fa-circle.radio-save-success {
+ color: #b9ffb9 !important;
+}
+
+.fa-stack > .fa.fa-stack-1x.fa-circle.radio-save-error {
+ color: #ff8a8a !important;
+}
+
+.fa-stack > .fa.fa-stack-1x.fa-circle.radio-white {
+ color: #FFFFFF !important;
+}
+
+.fa-stack > .radio-default{
+ color: #FFFFFF;
+}
+
+.error-text {
+ color: red;
+}
+
+.warning-text {
+ color: #C7C728;
+}
+
+.custom-radio-group {
+ margin-left: -8px;
+}
+
+.custom-radio-text {
+ display: inline-block;
+ margin-left: -5px;
+}
+
+.custom-radio-error{
+ margin-left: 5px;
+ width:100px;
+ text-align: center;
+}
+
+.custom-dropdown-menu {
+ min-width: 0 !important;
+}
+
+.dropdown-menu.custom-dropdown-menu > li > a {
+ padding-left: 10px;
+ padding-right: 10px;
+}
+
+.fa-stack-custom-large {
+ font-size: 20px;
+}
+
+.fa-stack-custom-small {
+ font-size: 10px;
+}
+
.wrap-text {
word-wrap: break-word;
}
+
+.cursor-pointer {
+ cursor: pointer;
+}
+
+.fa-icon-width {
+ width: 15px;
+}
+
+.prevent-text-selection-on-double-click{
+ -webkit-user-select: none; /* webkit (safari, chrome) browsers */
+ -moz-user-select: none; /* mozilla browsers */
+ -khtml-user-select: none; /* webkit (konqueror) browsers */
+ -ms-user-select: none; /* IE10+ */
+}
+
+.icon-padding {
+ padding: 2px;
+}
+
.border-left {
border-left: 1px solid #c2c2c2;
}
@@ -1245,4 +1429,9 @@
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-}
\ No newline at end of file
+}
+
+.findview-padding {
+ padding-top: 16px;
+}
+
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dhis2-radio-button.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dhis2-radio-button.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/dhis2-radio-button.html 2015-12-17 15:00:48 +0000
@@ -0,0 +1,66 @@
+<!--
+Copyright (c) 2015, UiO
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-->
+
+
+<div ng-if="!disabled" class="custom-radio-group">
+ <span ng-click="valueClicked('true')">
+ <span class="fa-stack">
+ <span class='fa fa-stack-1x fa-circle radio-default fa-stack-custom-large' ng-class='radioButtonColor("true")'></span>
+ <span class="fa fa-stack-1x fa-circle-thin fa-stack-custom-large"></span>
+ <span class="fa-stack-custom-small" ng-class="radioButtonImage('true')"></span>
+ </span>
+ <span class="custom-radio-text cursor-pointer">
+ {{'Yes' | translate }}
+ </span>
+ </span>
+
+ <span ng-click="valueClicked('false')">
+ <span class="fa-stack">
+ <span class='fa fa-stack-1x fa-circle fa-stack-custom-large' ng-class='radioButtonColor("false")'></span>
+ <span class="fa fa-stack-1x fa-circle-thin fa-stack-custom-large"></span>
+ <span class="fa-stack-custom-small" ng-class="radioButtonImage('false')"></span>
+ </span>
+ <span class="custom-radio-text cursor-pointer">
+ {{'No' | translate }}
+ </span>
+ </span>
+ <div ng-if="status === 'error'" class="custom-radio-error input-error"><span>{{'save failed' | translate}}</span></div>
+
+
+ <div ng-show="false">
+ <label class="radio-inline">
+ <input class="radio-display-none" ng-required="required" style='margin-top: 1px' type="radio" ng-model="value" ng-disabled="disabled" name="{{name}}" value="true">
+ </label>
+ <label class="radio-inline">
+ <input class="radio-display-none" ng-required="required" style='margin-top: 1px' type="radio" ng-model="value" ng-disabled="disabled" name="{{name}}" value="false">
+ </label>
+ </div>
+</div>
+<div ng-if="disabled">
+ <span class="fa-icon-width" ng-class="getDisabledIcon(value)"></span>
+ <span>{{getDisabledValue(value) | translate}}</span>
+</div>
+