dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31321
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15942: tracker capture - new coloring for event status and also a possibility for creating events anytime
------------------------------------------------------------
revno: 15942
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Wed 2014-07-02 18:25:28 +0200
message:
tracker capture - new coloring for event status and also a possibility for creating events anytime
modified:
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2014-06-30 13:16:30 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2014-07-02 16:25:28 +0000
@@ -16,7 +16,8 @@
TranslationService.translate();
//dashboard items
- $rootScope.dashboardWidgets = {bigger: [], smaller: []};
+ $rootScope.biggerDashboardWidgets = [];
+ $rootScope.smallerDashboardWidgets = [];//{bigger: [], smaller: []};
$rootScope.enrollmentWidget = {title: 'enrollment', view: "components/enrollment/enrollment.html", show: true, expand: true};
$rootScope.dataentryWidget = {title: 'dataentry', view: "components/dataentry/dataentry.html", show: true, expand: true};
$rootScope.selectedWidget = {title: 'current_selections', view: "components/selected/selected.html", show: false, expand: true};
@@ -24,12 +25,12 @@
$rootScope.relationshipWidget = {title: 'relationship', view: "components/relationship/relationship.html", show: true, expand: true};
$rootScope.notesWidget = {title: 'notes', view: "components/notes/notes.html", show: true, expand: true};
- $rootScope.dashboardWidgets.bigger.push($rootScope.enrollmentWidget);
- $rootScope.dashboardWidgets.bigger.push($rootScope.dataentryWidget);
- $rootScope.dashboardWidgets.smaller.push($rootScope.selectedWidget);
- $rootScope.dashboardWidgets.smaller.push($rootScope.profileWidget);
- $rootScope.dashboardWidgets.smaller.push($rootScope.relationshipWidget);
- $rootScope.dashboardWidgets.smaller.push($rootScope.notesWidget);
+ $rootScope.biggerDashboardWidgets.push($rootScope.enrollmentWidget);
+ $rootScope.biggerDashboardWidgets.push($rootScope.dataentryWidget);
+ $rootScope.smallerDashboardWidgets.push($rootScope.selectedWidget);
+ $rootScope.smallerDashboardWidgets.push($rootScope.profileWidget);
+ $rootScope.smallerDashboardWidgets.push($rootScope.relationshipWidget);
+ $rootScope.smallerDashboardWidgets.push($rootScope.notesWidget);
//selections
$scope.selectedTeiId = null;
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html 2014-06-30 05:56:38 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html 2014-07-02 16:25:28 +0000
@@ -28,14 +28,14 @@
<div class="row">
<div class="col-sm-6 col-md-8">
<div sortable class="row connectedSortable empty-dashboard-container">
- <div ng-repeat="biggerWidget in dashboardWidgets.bigger">
+ <div ng-repeat="biggerWidget in biggerDashboardWidgets">
<div class="col-sm-12" ng-show="biggerWidget.show" ng-include="biggerWidget.view"></div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
- <div sortable class="row connectedSortable empty-dashboard-container">
- <div class="col-sm-12" ng-repeat="smallerWidget in dashboardWidgets.smaller">
+ <div sortable class="row connectedSortable empty-dashboard-container">
+ <div class="col-sm-12" ng-repeat="smallerWidget in smallerDashboardWidgets">
<div ng-show="smallerWidget.show" ng-include="smallerWidget.view"></div>
</div>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-06-30 11:46:04 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-07-02 16:25:28 +0000
@@ -17,6 +17,7 @@
var today = moment();
today = Date.parse(today);
today = $filter('date')(today, 'yyyy-MM-dd');
+ $scope.invalidDate = false;
//listen for the selected items
$scope.$on('dashboard', function(event, args) {
@@ -51,7 +52,7 @@
$scope.getEvents = function(){
- DHIS2EventFactory.getByEntity($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgram.id).then(function(data){
+ DHIS2EventFactory.getEvents($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgram.id, 'ACTIVE').then(function(data){
$scope.dhis2Events = data;
if(angular.isUndefined($scope.dhis2Events)){
@@ -78,40 +79,22 @@
angular.forEach($scope.dhis2Events, function(dhis2Event){
var eventStage = $scope.selectedProgramWithStage[dhis2Event.programStage];
+
if(angular.isObject(eventStage)){
- dhis2Event.name = eventStage.name;
- if(dhis2Event.status === 'COMPLETED'){
- dhis2Event.statusColor = 'stage-completed';
+ dhis2Event.name = eventStage.name;
+ dhis2Event.eventDate = DateUtils.format(dhis2Event.eventDate);
+ if(dhis2Event.dueDate){
+ dhis2Event.dueDate = DateUtils.format(dhis2Event.dueDate);
}
else{
- dhis2Event.statusColor = 'stage-on-time';
-
- if(dhis2Event.dueDate){
- dhis2Event.dueDate = DateUtils.format(dhis2Event.dueDate);
- }
- else{
- dhis2Event.dueDate = DateUtils.getDueDate(eventStage, $scope.selectedEnrollment);
- }
-
- if(moment(today).isAfter(dhis2Event.dueDate) && !dhis2Event.dataValues){
- dhis2Event.statusColor = 'stage-overdue';
- }
- }
- }
-
- dhis2Event.eventDate = DateUtils.format(dhis2Event.eventDate);
-
- //get orgunit name for the event
- if(dhis2Event.orgUnit){
- OrgUnitService.open().then(function(){
- OrgUnitService.get(dhis2Event.orgUnit).then(function(ou){
- if(ou){
- dhis2Event.orgUnitName = ou.n;
- }
- });
- });
- }
+ dhis2Event.dueDate = EventUtils.getEventDueDate(eventStage, $scope.selectedEnrollment);
+ }
+
+ dhis2Event.statusColor = EventUtils.getEventStatusColor(dhis2Event);
+ dhis2Event = EventUtils.setEventOrgUnitName(dhis2Event);
+ }
+
});
$scope.dhis2Events = orderByFilter($scope.dhis2Events, '-eventDate');
@@ -148,7 +131,7 @@
};
$scope.showDummyEventCreation = function(dummyEvent){
-
+
if(dummyEvent){
if($scope.currentDummyEvent == dummyEvent){
@@ -194,8 +177,19 @@
DialogService.showDialog({}, dialogOptions);
}
else {
- $scope.getEvents();
newEvent.event = data.importSummaries[0].reference;
+ newEvent.orgUnitName = $scope.currentDummyEvent.orgUnitName;
+ newEvent.name = $scope.currentDummyEvent.name;
+ newEvent.statusColor = $scope.currentDummyEvent.statusColor;
+
+ if(angular.isUndefined($scope.dhis2Events)){
+ $scope.dhis2Events = [newEvent];
+ }
+ else{
+ $scope.dhis2Events.splice(0,0,newEvent);
+ $scope.dhis2Events = orderByFilter($scope.dhis2Events, '-eventDate');
+ $scope.dhis2Events.reverse();
+ }
$scope.showDataEntry(newEvent);
}
});
@@ -203,35 +197,39 @@
$scope.createDummyEvent = function(programStage, orgUnit, enrollment){
- var dueDate = DateUtils.getDueDate(programStage, enrollment);
+ var dueDate = EventUtils.getEventDueDate(programStage, enrollment);
var dummyEvent = {programStage: programStage.id,
orgUnit: orgUnit.id,
orgUnitName: orgUnit.name,
dueDate: dueDate,
name: programStage.name,
- status: 'ACTIVE'};
- dummyEvent.statusColor = 'stage-on-time';
- if(moment(today).isAfter(dummyEvent.dueDate)){
- dummyEvent.statusColor = 'stage-overdue';
- }
+ status: 'ACTIVE',
+ statusColor: 'alert alert-warning'//'stage-on-time'
+ };
+
+ dummyEvent.statusColor = EventUtils.getEventStatusColor(dummyEvent);
+
return dummyEvent;
};
$scope.showDataEntry = function(event){
-
+
if(event){
-
+
if($scope.currentEvent && $scope.currentEvent.event === event.event){
//clicked on the same stage, do toggling
$scope.currentEvent = null;
$scope.currentElement = {id: '', saved: false};
- $scope.showDataEntryDiv = !$scope.showDataEntryDiv;
+ $scope.showDataEntryDiv = !$scope.showDataEntryDiv;
}
else{
$scope.currentElement = {};
$scope.currentEvent = event;
- $scope.showDataEntryDiv = !$scope.showDataEntryDiv;
- $scope.getDataEntryForm();
+ $scope.showDataEntryDiv = true;
+ $scope.showDummyEventDiv = false;
+ $scope.showEventCreationDiv = false;
+ $scope.getDataEntryForm();
+ $scope.newEventDate = $scope.currentEvent.eventDate;
}
}
};
@@ -242,6 +240,9 @@
$scope.currentEvent = data;
$scope.currentEvent.providedElsewhere = [];
+ $scope.currentEvent.dueDate = DateUtils.format($scope.currentEvent.dueDate);
+ $scope.currentEvent.eventDate = DateUtils.format($scope.currentEvent.eventDate);
+
if(!angular.isUndefined( $scope.currentEvent.notes)){
$scope.currentEvent.notes = orderByFilter($scope.currentEvent.notes, '-storedDate');
angular.forEach($scope.currentEvent.notes, function(note){
@@ -349,6 +350,41 @@
}
};
+ $scope.saveEventDate = function(){
+
+ if($scope.newEventDate != $scope.currentEvent.eventDate){
+ if($scope.newEventDate == ''){
+ $scope.invalidDate = true;
+ return false;
+ }
+ else{
+ var rawDate = $filter('date')($scope.newEventDate, 'yyyy-MM-dd');
+ var convertedDate = moment($scope.newEventDate, 'YYYY-MM-DD')._d;
+ convertedDate = $filter('date')(convertedDate, 'yyyy-MM-dd');
+
+ if(rawDate !== convertedDate){
+ $scope.invalidDate = true;
+ return false;
+ }
+
+ var e = {event: $scope.currentEvent.event,
+ program: $scope.currentEvent.program,
+ programStage: $scope.currentEvent.programStage,
+ orgUnit: $scope.currentEvent.orgUnit,
+ eventDate: $scope.newEventDate,
+ trackedEntityInstance: $scope.currentEvent.trackedEntityInstance
+ };
+
+ DHIS2EventFactory.updateForEventDate(e).then(function(data){
+ $scope.currentEvent.eventDate = $scope.newEventDate;
+ $scope.newEventDate = '';
+ $scope.invalidDate = false;
+ });
+ }
+ }
+
+ };
+
$scope.addNote = function(){
if(!angular.isUndefined($scope.note) && $scope.note != ""){
@@ -372,8 +408,7 @@
console.log('the notes before update are: ', $scope.currentEvent);
DHIS2EventFactory.updateForNote(e).then(function(data){
- $scope.note = '';
- console.log('the notes after update are: ', $scope.currentEvent);
+ $scope.note = '';
});
}
};
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2014-06-30 18:53:05 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2014-07-02 16:25:28 +0000
@@ -60,12 +60,12 @@
<div class="col-md-6">
{{currentDummyEvent.reportDateDescription}}
<input type="text" name="eventDate" class="form-control" ng-date ng-model="currentDummyEvent.eventDate" ng-required="true"/>
- <span ng-show="eventCreationForm.submitted && eventCreationForm.eventDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
+ <span ng-show="eventCreationForm.submitted && eventCreationForm.eventDate.$invalid" class="error">{{'required'| translate}}</span>
</div>
<div class="col-md-6">
{{'due_date'| translate}}
<input type="text" name="dueDate" class="form-control" ng-date ng-model="currentDummyEvent.dueDate" />
- <span ng-show="eventCreationForm.submitted && eventCreationForm.dueDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
+ <span ng-show="eventCreationForm.submitted && eventCreationForm.dueDate.$invalid" class="error">{{'required'| translate}}</span>
</div>
</div>
<div class="row vertical-spacing">
@@ -79,6 +79,18 @@
<div ng-show="currentEvent && !showEventCreationDiv">
<hr>
+ <div class="row">
+ <div class="col-md-6">
+ {{currentStage.reportDateDescription}}
+ <input class="form-control" ng-date ng-model="newEventDate" ng-required="true" blur-or-change="saveEventDate()"/>
+ <span ng-show="invalidDate" class="error">{{'date_required'| translate}}</span>
+ </div>
+ <div class="col-md-6">
+ {{'due_date'| translate}}
+ <input type="text" name="dueDate" class="form-control" ng-date ng-model="currentEvent.dueDate" ng-disabled="true"/>
+ </div>
+ </div>
+ <hr>
<form name="dataEntryOuterForm" novalidate>
<table class="table-borderless table-striped" ng-if='currentEvent'>
<thead>
@@ -108,7 +120,7 @@
ng-required={{prStDe.compulsory}}
ng-blur="saveDatavalue(prStDe)"
name="foo"/>
- <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" style="color:red;font-size:12px">{{'number_required' | translate}}</span>
+ <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" class="error">{{'number_required' | translate}}</span>
</div>
<div ng-switch-when="string">
<input type="text"
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2014-06-30 05:56:38 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js 2014-07-02 16:25:28 +0000
@@ -4,7 +4,6 @@
$filter,
$timeout,
storage,
- ProgramStageFactory,
AttributesFactory,
CurrentSelection,
TEIService,
@@ -20,7 +19,6 @@
$scope.enrollments = [];
$scope.showEnrollmentDiv = false;
$scope.showSchedulingDiv = false;
- $scope.selectedProgram = null;
$scope.selectedEnrollment = null;
$scope.newEnrollment = {};
@@ -56,6 +54,17 @@
if($scope.selectedEnrollment){//enrollment exists
$scope.selectedEnrollment.dateOfIncident = $filter('date')($scope.selectedEnrollment.dateOfIncident, 'yyyy-MM-dd');
+
+ $scope.programStages = [];
+
+ var incidentDate = $scope.selectedEnrollment ? $scope.selectedEnrollment.dateOfIncident : new Date();
+
+ angular.forEach($scope.selectedProgram.programStages, function(stage){
+ stage.dueDate = moment(moment(incidentDate).add('d', stage.minDaysFromStart), 'YYYY-MM-DD')._d;
+ stage.dueDate = Date.parse(stage.dueDate);
+ stage.dueDate= $filter('date')(stage.dueDate, 'yyyy-MM-dd');
+ $scope.programStages.push(stage);
+ });
}
else{//prepare for possible enrollment
AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
@@ -72,19 +81,7 @@
}
}
});
- }
-
- $scope.programStages = [];
- var incidentDate = $scope.selectedEnrollment ? $scope.selectedEnrollment.dateOfIncident : new Date();
-
- ProgramStageFactory.getByProgram($scope.selectedProgram).then(function(stages){
- angular.forEach(stages, function(stage){
- stage.dueDate = moment(moment(incidentDate).add('d', stage.minDaysFromStart), 'YYYY-MM-DD')._d;
- stage.dueDate = Date.parse(stage.dueDate);
- stage.dueDate= $filter('date')(stage.dueDate, 'yyyy-MM-dd');
- $scope.programStages.push(stage);
- });
- });
+ }
}
$scope.broadCastSelections();
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js 2014-06-19 15:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js 2014-07-02 16:25:28 +0000
@@ -110,8 +110,8 @@
$scope.outerForm.submitted = false;
if(showDashboard){
- $location.path('/dashboard').search({selectedEntityId: teiId,
- selectedProgramId: $scope.selectedProgram ? $scope.selectedProgram.id : null});
+ $location.path('/dashboard').search({tei: teiId,
+ program: $scope.selectedProgram ? $scope.selectedProgram.id: null});
}
});
};
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html 2014-06-27 14:49:34 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html 2014-07-02 16:25:28 +0000
@@ -29,11 +29,11 @@
<div ng-switch="attribute.valueType">
<div ng-switch-when="date">
<input type="text" name="foo" class="form-control" ng-date ng-model="attribute.value" ng-required="attribute.mandatory" />
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
</div>
<div ng-switch-when="trueOnly">
<input type="checkbox" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory" />
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
</div>
<div ng-switch-when="bool">
<select name="foo" ng-model="attribute.value" class="form-control" ng-required="attribute.mandatory">
@@ -41,7 +41,7 @@
<option value="0">{{'no'| translate}}</option>
<option value="1">{{'yes'| translate}}</option>
</select>
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
</div>
<div ng-switch-when="optionSet">
<input type="text"
@@ -52,15 +52,15 @@
typeahead-open-on-focus
ng-required="attribute.mandatory"
/>
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
</div>
<div ng-switch-when="number">
<input type="number" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
</div>
<div ng-switch-default>
<input type="text" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
</div>
</div>
</ng-form>
@@ -78,7 +78,7 @@
</td>
<td>
<input type="text" name="dateOfEnrollment" class="form-control" ng-date ng-model="enrollment.incidentDate" ng-required="true"/>
- <span ng-show="outerForm.submitted && outerForm.dateOfEnrollment.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
+ <span ng-show="outerForm.submitted && outerForm.dateOfEnrollment.$invalid" class="error">{{'required'| translate}}</span>
</td>
</tr>
<tr ng-if="selectedProgram.displayIncidentDate">
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-06-30 18:47:45 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-07-02 16:25:28 +0000
@@ -19,6 +19,7 @@
"list": "List",
"required": "Required",
"number_required": "Number required",
+ "date_required": "Date required (yyyy-mm-dd)",
"search": "Search",
"advanced_search": "Advanced search",
"search_for": "Search for",
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2014-07-02 11:34:41 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2014-07-02 16:25:28 +0000
@@ -5,8 +5,7 @@
//Controller for settings page
.controller('SelectionController',
- function($rootScope,
- $scope,
+ function($scope,
$modal,
$location,
Paginator,
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-06-30 13:56:21 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-07-02 16:25:28 +0000
@@ -415,8 +415,8 @@
return {
- getByEntity: function(entity, orgUnit, program){
- var promise = $http.get( '../api/events.json?' + 'trackedEntityInstance=' + entity + '&orgUnit=' + orgUnit + '&program=' + program + '&paging=false').then(function(response){
+ getEvents: function(entity, orgUnit, program, programStatus){
+ var promise = $http.get( '../api/events.json?' + 'trackedEntityInstance=' + entity + '&orgUnit=' + orgUnit + '&program=' + program + '&programStatus=' + programStatus + '&paging=false').then(function(response){
return response.data.events;
});
return promise;
@@ -450,6 +450,12 @@
return response.data;
});
return promise;
+ },
+ updateForEventDate: function(dhis2Event){
+ var promise = $http.put('../api/events/' + dhis2Event.event + '/updateEventDate', dhis2Event).then(function(response){
+ return response.data;
+ });
+ return promise;
}
};
})
@@ -837,17 +843,11 @@
dateValue = Date.parse(dateValue);
dateValue = $filter('date')(dateValue, 'yyyy-MM-dd');
return dateValue;
- },
- getDueDate: function(programStage, enrollment){
- var dueDate = moment(moment(enrollment.dateOfIncident).add('d', programStage.minDaysFromStart), 'YYYY-MM-DD')._d;
- dueDate = Date.parse(dueDate);
- dueDate = $filter('date')(dueDate, 'yyyy-MM-dd');
- return dueDate;
}
};
})
-.service('EventUtils', function(DateUtils, $filter){
+.service('EventUtils', function($filter, OrgUnitService){
return {
createDummyEvent: function(programStage, orgUnit, enrollment){
@@ -855,7 +855,7 @@
today = Date.parse(today);
today = $filter('date')(today, 'yyyy-MM-dd');
- var dueDate = DateUtils.getDueDate(programStage, enrollment);
+ var dueDate = this.getEventDueDate(programStage, enrollment);
var dummyEvent = {programStage: programStage.id,
orgUnit: orgUnit.id,
orgUnitName: orgUnit.name,
@@ -863,11 +863,49 @@
name: programStage.name,
reportDateDescription: programStage.reportDateDescription,
status: 'ACTIVE'};
- dummyEvent.statusColor = 'stage-on-time';
+ dummyEvent.statusColor = 'alert alert-warning';//'stage-on-time';
if(moment(today).isAfter(dummyEvent.dueDate)){
- dummyEvent.statusColor = 'stage-overdue';
+ dummyEvent.statusColor = 'alert alert-danger';//'stage-overdue';
}
return dummyEvent;
+ },
+ getEventStatusColor: function(dhis2Event){
+ var today = moment();
+ today = Date.parse(today);
+ today = $filter('date')(today, 'yyyy-MM-dd');
+ var eventDate = today;
+
+ if(dhis2Event.eventDate){
+ eventDate = dhis2Event.eventDate;
+ }
+
+ if(dhis2Event.status === 'COMPLETED'){
+ return 'alert alert-info';//'stage-completed';
+ }
+ else{
+ if(moment(eventDate).isAfter(dhis2Event.dueDate)){
+ return 'alert alert-danger';//'stage-overdue';
+ }
+ return 'alert alert-warning';//'stage-on-time';
+ }
+ },
+ getEventDueDate: function(programStage, enrollment){
+ var dueDate = moment(moment(enrollment.dateOfIncident).add('d', programStage.minDaysFromStart), 'YYYY-MM-DD')._d;
+ dueDate = Date.parse(dueDate);
+ dueDate = $filter('date')(dueDate, 'yyyy-MM-dd');
+ return dueDate;
+ },
+ setEventOrgUnitName: function(dhis2Event){
+ if(dhis2Event.orgUnit){
+ OrgUnitService.open().then(function(){
+ OrgUnitService.get(dhis2Event.orgUnit).then(function(ou){
+ if(ou){
+ dhis2Event.orgUnitName = ou.n;
+ return dhis2Event;
+ }
+ });
+ });
+ }
}
};
});
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2014-07-02 11:46:51 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2014-07-02 16:25:28 +0000
@@ -340,6 +340,10 @@
color: white;
}
+.error {
+ color:red;
+ font-size:12px;
+}
.anchor-color {
color: #276696;
}
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html 2014-07-02 11:34:41 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html 2014-07-02 16:25:28 +0000
@@ -86,7 +86,7 @@
</div>
<div ng-switch-when="bool">
<select multiple ui-select2 ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
- <option ng-repeat="option in boolOperators" value="{{option}}">{{option}}</option>
+ <option ng-repeat="option in boolOperators" value="{{option}}">{{option | translate}}</option>
</select>
</div>
</div>