dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41556
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21176: tracker-capture: bug fix in reports
------------------------------------------------------------
revno: 21176
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-11-23 15:50:42 +0100
message:
tracker-capture: bug fix in reports
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js 2015-10-21 12:04:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js 2015-11-23 14:50:42 +0000
@@ -97,44 +97,45 @@
$scope.reportStarted = true;
$scope.overdueEvents = [];
- EventReportService.getEventReport($scope.selectedOrgUnit.id, $scope.selectedOuMode, $scope.selectedProgram.id, null, null, 'ACTIVE','OVERDUE', $scope.pager).then(function(data){
- if( data.pager ){
- $scope.pager = data.pager;
- $scope.pager.toolBarDisplay = 5;
-
- Paginator.setPage($scope.pager.page);
- Paginator.setPageCount($scope.pager.pageCount);
- Paginator.setPageSize($scope.pager.pageSize);
- Paginator.setItemCount($scope.pager.total);
- }
-
- angular.forEach(data.eventRows, function(row){
- var overdueEvent = {};
- angular.forEach(row.attributes, function(att){
- var val = AttributesFactory.formatAttributeValue(att, $scope.attributesById, $scope.optionSets, 'USER');
- overdueEvent[att.attribute] = val;
+ EventReportService.getEventReport($scope.selectedOrgUnit.id, $scope.selectedOuMode, $scope.selectedProgram.id, null, null, 'ACTIVE','OVERDUE', $scope.pager).then(function(data){
+ if( data ) {
+ if( data.pager ){
+ $scope.pager = data.pager;
+ $scope.pager.toolBarDisplay = 5;
+
+ Paginator.setPage($scope.pager.page);
+ Paginator.setPageCount($scope.pager.pageCount);
+ Paginator.setPageSize($scope.pager.pageSize);
+ Paginator.setItemCount($scope.pager.total);
+ }
+
+ angular.forEach(data.eventRows, function(row){
+ var overdueEvent = {};
+ angular.forEach(row.attributes, function(att){
+ var val = AttributesFactory.formatAttributeValue(att, $scope.attributesById, $scope.optionSets, 'USER');
+ overdueEvent[att.attribute] = val;
+ });
+
+ overdueEvent.dueDate = DateUtils.formatFromApiToUser(row.dueDate);
+ overdueEvent.event = row.event;
+ overdueEvent.eventName = $scope.programStages[row.programStage].name;
+ overdueEvent.orgUnitName = row.orgUnitName;
+ overdueEvent.followup = row.followup;
+ overdueEvent.program = row.program;
+ overdueEvent.programStage = row.programStage;
+ overdueEvent.trackedEntityInstance = row.trackedEntityInstance;
+ $scope.overdueEvents.push(overdueEvent);
+
});
-
- overdueEvent.dueDate = DateUtils.formatFromApiToUser(row.dueDate);
- overdueEvent.event = row.event;
- overdueEvent.eventName = $scope.programStages[row.programStage].name;
- overdueEvent.orgUnitName = row.orgUnitName;
- overdueEvent.followup = row.followup;
- overdueEvent.program = row.program;
- overdueEvent.programStage = row.programStage;
- overdueEvent.trackedEntityInstance = row.trackedEntityInstance;
- $scope.overdueEvents.push(overdueEvent);
-
- });
-
- //sort overdue events by their due dates - this is default
- if(!$scope.sortColumn.id){
- $scope.sortGrid({id: 'dueDate', name: $translate('due_date'), valueType: 'date', displayInListNoProgram: false, showFilter: false, show: true});
- $scope.reverse = false;
- }
-
+
+ //sort overdue events by their due dates - this is default
+ if(!$scope.sortColumn.id){
+ $scope.sortGrid({id: 'dueDate', name: $translate('due_date'), valueType: 'date', displayInListNoProgram: false, showFilter: false, show: true});
+ $scope.reverse = false;
+ }
+ }
$scope.reportFinished = true;
- $scope.reportStarted = false;
+ $scope.reportStarted = false;
});
}
};
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events.html 2015-10-21 12:04:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events.html 2015-11-23 14:50:42 +0000
@@ -45,7 +45,7 @@
<div class="col-sm-8 col-md-6">
<table class="table-borderless table-striped">
<tr>
- <td>{{orgUnitLabel}}</td>
+ <td>{{'org_unit' | translate}}</td>
<td>
<input type="text" class="form-control" selected-org-unit ng-model="selectedOrgUnit.name" value="{{selectedOrgUnit.name || 'please_select'| translate}}" ng-disabled="true">
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js 2015-04-20 07:30:05 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js 2015-11-23 14:50:42 +0000
@@ -85,61 +85,66 @@
DateUtils.formatFromUserToApi($scope.report.startDate),
DateUtils.formatFromUserToApi($scope.report.endDate)).then(function(data){
- $scope.totalEnrollment = data.enrollments.length;
- angular.forEach(data.enrollments, function(en){
- $scope.enrollmentList[en.enrollment] = en;
- if(en.status === 'ACTIVE'){
- $scope.enrollments.active++;
- }
- else if(en.status === 'COMPLETED'){
- $scope.enrollments.completed++;
- }
- else{
- $scope.enrollments.cancelled++;
- }
- });
-
- $scope.enrollmentStat = [{key: 'Completed', y: $scope.enrollments.completed},
- {key: 'Active', y: $scope.enrollments.active},
- {key: 'Cancelled', y: $scope.enrollments.cancelled}];
-
- DHIS2EventFactory.getByOrgUnitAndProgram($scope.selectedOrgUnit.id, $scope.selectedOuMode.name, $scope.selectedProgram.id, null, null).then(function(data){
-
- $scope.dhis2Events = {completed: 0, active: 0, skipped: 0, overdue: 0, ontime: 0};
- $scope.totalEvents = 0;
- angular.forEach(data, function(ev){
+ if( data ) {
+ $scope.totalEnrollment = data.enrollments.length;
+ angular.forEach(data.enrollments, function(en){
+ $scope.enrollmentList[en.enrollment] = en;
+ if(en.status === 'ACTIVE'){
+ $scope.enrollments.active++;
+ }
+ else if(en.status === 'COMPLETED'){
+ $scope.enrollments.completed++;
+ }
+ else{
+ $scope.enrollments.cancelled++;
+ }
+ });
+
+ $scope.enrollmentStat = [{key: 'Completed', y: $scope.enrollments.completed},
+ {key: 'Active', y: $scope.enrollments.active},
+ {key: 'Cancelled', y: $scope.enrollments.cancelled}];
+
+ DHIS2EventFactory.getByOrgUnitAndProgram($scope.selectedOrgUnit.id, $scope.selectedOuMode.name, $scope.selectedProgram.id, null, null).then(function(data){
- if(ev.trackedEntityInstance && $scope.enrollmentList[ev.enrollment]){
-
- $scope.totalEvents++;
- if(ev.status === 'COMPLETED'){
- $scope.dhis2Events.completed++;
- }
- else if(ev.status === 'ACTIVE'){
- $scope.dhis2Events.active++;
- }
- else if(ev.status === 'SKIPPED'){
- $scope.dhis2Events.skipped++;
- }
- else{
- if(ev.dueDate && moment($scope.today).isAfter(DateUtils.formatFromApiToUser(ev.dueDate))){
- $scope.dhis2Events.overdue++;
- }
- else{
- $scope.dhis2Events.ontime++;
- }
- }
+ if( data ) {
+ $scope.dhis2Events = {completed: 0, active: 0, skipped: 0, overdue: 0, ontime: 0};
+ $scope.totalEvents = 0;
+ angular.forEach(data, function(ev){
+
+ if(ev.trackedEntityInstance && $scope.enrollmentList[ev.enrollment]){
+
+ $scope.totalEvents++;
+ if(ev.status === 'COMPLETED'){
+ $scope.dhis2Events.completed++;
+ }
+ else if(ev.status === 'ACTIVE'){
+ $scope.dhis2Events.active++;
+ }
+ else if(ev.status === 'SKIPPED'){
+ $scope.dhis2Events.skipped++;
+ }
+ else{
+ if(ev.dueDate && moment($scope.today).isAfter(DateUtils.formatFromApiToUser(ev.dueDate))){
+ $scope.dhis2Events.overdue++;
+ }
+ else{
+ $scope.dhis2Events.ontime++;
+ }
+ }
+ }
+ });
+ $scope.eventStat = [{key: 'Completed', y: $scope.dhis2Events.completed},
+ {key: 'Active', y: $scope.dhis2Events.active},
+ {key: 'Skipped', y: $scope.dhis2Events.skipped},
+ {key: 'Ontime', y: $scope.dhis2Events.overdue},
+ {key: 'Overdue', y: $scope.dhis2Events.ontime}];
}
- });
- $scope.eventStat = [{key: 'Completed', y: $scope.dhis2Events.completed},
- {key: 'Active', y: $scope.dhis2Events.active},
- {key: 'Skipped', y: $scope.dhis2Events.skipped},
- {key: 'Ontime', y: $scope.dhis2Events.overdue},
- {key: 'Overdue', y: $scope.dhis2Events.ontime}];
-
- $scope.reportStarted = false;
- $scope.dataReady = true;
- });
+ });
+ }
+
+ $scope.reportStarted = false;
+ $scope.dataReady = true;
+
});
};
});
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics.html 2015-10-21 12:04:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics.html 2015-11-23 14:50:42 +0000
@@ -17,6 +17,10 @@
{{'loading_tree'| translate}}
</div>
+ <!--- selected org unit begins -->
+ <input type="text" selected-org-unit ng-model="selectedOrgUnit.name" ng-hide=true>
+ <!--- selected org unit ends -->
+
</div>
<div id="mainPage" class="bordered-div">
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js 2015-10-21 12:04:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js 2015-11-23 14:50:42 +0000
@@ -97,28 +97,32 @@
$scope.pager).then(function(data){
$scope.dhis2Events = [];
$scope.teiList = [];
- angular.forEach(data.eventRows, function(ev){
- if(ev.trackedEntityInstance){
- ev.name = $scope.stagesById[ev.programStage].name;
- ev.programName = $scope.selectedProgram.name;
- ev.statusColor = EventUtils.getEventStatusColor(ev);
- ev.eventDate = DateUtils.formatFromApiToUser(ev.eventDate);
-
- angular.forEach(ev.dataValues, function(dv){
- ev[dv.dataElement] = dv.value;
- $scope.stagesById[ev.programStage].hasData = true;
- });
-
- angular.forEach(ev.attributes, function(att){
- ev[att.attribute] = att.value;
- });
-
- if($scope.teiList.indexOf(ev.trackedEntityInstance) === -1){
- $scope.teiList.push( ev.trackedEntityInstance );
+
+ if( data && data.eventRows ){
+ angular.forEach(data.eventRows, function(ev){
+ if(ev.trackedEntityInstance){
+ ev.name = $scope.stagesById[ev.programStage].name;
+ ev.programName = $scope.selectedProgram.name;
+ ev.statusColor = EventUtils.getEventStatusColor(ev);
+ ev.eventDate = DateUtils.formatFromApiToUser(ev.eventDate);
+
+ angular.forEach(ev.dataValues, function(dv){
+ ev[dv.dataElement] = dv.value;
+ $scope.stagesById[ev.programStage].hasData = true;
+ });
+
+ angular.forEach(ev.attributes, function(att){
+ ev[att.attribute] = att.value;
+ });
+
+ if($scope.teiList.indexOf(ev.trackedEntityInstance) === -1){
+ $scope.teiList.push( ev.trackedEntityInstance );
+ }
+ $scope.dhis2Events.push(ev);
}
- $scope.dhis2Events.push(ev);
- }
- });
+ });
+ }
+
$scope.reportStarted = false;
$scope.dataReady = true;
});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary.html 2015-05-18 17:05:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary.html 2015-11-23 14:50:42 +0000
@@ -1,18 +1,26 @@
-<div id="leftBar">
- <div class="left-bar-menu" ng-controller="LeftBarMenuController">
- <ul class="nav nav-pills nav-stacked">
- <li><a href ng-click="showHome()">{{'registration_and_data_entry'| translate}}</a></li>
- <li><a href ng-click="showReportTypes()">{{'reports'| translate}}</a></li>
- </ul>
- </div>
- <div id="orgUnitTree" style="margin-top:20px">
+<span id="showLeftBar">
+ <a href="javascript:dhis2.leftBar.showAnimated()" title="$i18n.getString('show_menu' )"><i class="fa fa-arrow-right leftBarIcon"></i></a>
+</span>
+
+<div id="leftBar">
+
+ <d2-left-bar></d2-left-bar>
+
+ <div id="orgUnitTree">
<ul>
</ul>
</div>
- <img id="ouwt_loader" src="../images/ajax-loader-bar.gif" alt="{{'loading_tree'| translate}}"/>
+
+ <img id="ouwt_loader" src="../images/ajax-loader-bar.gif" alt="{{'in_progress'| translate}}"/>
+
+ <div class="small-horizonal-spacing" ng-if="!treeLoaded">
+ {{'loading_tree'| translate}}
+ </div>
+
<!--- selected org unit begins -->
<input type="text" selected-org-unit ng-model="selectedOrgUnit.name" ng-hide=true>
<!--- selected org unit ends -->
+
</div>
<div id="mainPage" class="bordered-div">
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html 2015-09-15 13:51:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html 2015-11-23 14:50:42 +0000
@@ -2,7 +2,7 @@
<div class="col-sm-8 col-md-6">
<table class="table table-borderless table-striped">
<tr>
- <td>{{orgUnitLabel}}</td>
+ <td>{{'org_unit' | translate}}</td>
<td>
<input type="text" class="form-control" value="{{selectedOrgUnit.name|| 'please_select'| translate}}" ng-disabled="true">
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js 2015-10-21 12:04:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js 2015-11-23 14:50:42 +0000
@@ -94,43 +94,44 @@
DateUtils.formatFromUserToApi($scope.report.endDate),
'ACTIVE',
'SCHEDULE',
- $scope.pager).then(function(data){
-
- if( data.pager ){
- $scope.pager = data.pager;
- $scope.pager.toolBarDisplay = 5;
-
- Paginator.setPage($scope.pager.page);
- Paginator.setPageCount($scope.pager.pageCount);
- Paginator.setPageSize($scope.pager.pageSize);
- Paginator.setItemCount($scope.pager.total);
- }
-
- angular.forEach(data.eventRows, function(row){
- var upcomingEvent = {};
- angular.forEach(row.attributes, function(att){
- var val = AttributesFactory.formatAttributeValue(att, $scope.attributesById, $scope.optionSets, 'USER');
- upcomingEvent[att.attribute] = val;
+ $scope.pager).then(function(data){
+ if( data ) {
+ if( data.pager ){
+ $scope.pager = data.pager;
+ $scope.pager.toolBarDisplay = 5;
+
+ Paginator.setPage($scope.pager.page);
+ Paginator.setPageCount($scope.pager.pageCount);
+ Paginator.setPageSize($scope.pager.pageSize);
+ Paginator.setItemCount($scope.pager.total);
+ }
+
+ angular.forEach(data.eventRows, function(row){
+ var upcomingEvent = {};
+ angular.forEach(row.attributes, function(att){
+ var val = AttributesFactory.formatAttributeValue(att, $scope.attributesById, $scope.optionSets, 'USER');
+ upcomingEvent[att.attribute] = val;
+ });
+
+ upcomingEvent.dueDate = DateUtils.formatFromApiToUser(row.dueDate);
+ upcomingEvent.event = row.event;
+ upcomingEvent.eventName = $scope.programStages[row.programStage].name;
+ upcomingEvent.eventOrgUnitName = row.eventOrgUnitName;
+ upcomingEvent.orgUnitName = row.eventOrgUnitName;
+ upcomingEvent.followup = row.followup;
+ upcomingEvent.program = row.program;
+ upcomingEvent.programStage = row.programStage;
+ upcomingEvent.trackedEntityInstance = row.trackedEntityInstance;
+ upcomingEvent.created = DateUtils.formatFromApiToUser(row.registrationDate);;
+ $scope.upcomingEvents.push(upcomingEvent);
+
});
-
- upcomingEvent.dueDate = DateUtils.formatFromApiToUser(row.dueDate);
- upcomingEvent.event = row.event;
- upcomingEvent.eventName = $scope.programStages[row.programStage].name;
- upcomingEvent.eventOrgUnitName = row.eventOrgUnitName;
- upcomingEvent.orgUnitName = row.eventOrgUnitName;
- upcomingEvent.followup = row.followup;
- upcomingEvent.program = row.program;
- upcomingEvent.programStage = row.programStage;
- upcomingEvent.trackedEntityInstance = row.trackedEntityInstance;
- upcomingEvent.created = DateUtils.formatFromApiToUser(row.registrationDate);;
- $scope.upcomingEvents.push(upcomingEvent);
-
- });
-
- //sort upcoming events by their due dates - this is default
- if(!$scope.sortColumn.id){
- $scope.sortGrid({id: 'dueDate', name: $translate('due_date'), valueType: 'date', displayInListNoProgram: false, showFilter: false, show: true});
- $scope.reverse = false;
+
+ //sort upcoming events by their due dates - this is default
+ if(!$scope.sortColumn.id){
+ $scope.sortGrid({id: 'dueDate', name: $translate('due_date'), valueType: 'date', displayInListNoProgram: false, showFilter: false, show: true});
+ $scope.reverse = false;
+ }
}
$scope.reportFinished = true;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html 2015-10-21 12:04:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html 2015-11-23 14:50:42 +0000
@@ -45,7 +45,7 @@
<div class="col-sm-8 col-md-6">
<table class="table-borderless table-striped">
<tr>
- <td>{{orgUnitLabel}}</td>
+ <td>{{'org_unit' | translate}}</td>
<td>
<input type="text" class="form-control" selected-org-unit ng-model="selectedOrgUnit.name" value="{{selectedOrgUnit.name || 'please_select'| translate}}" ng-disabled="true">
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-11-17 13:20:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-11-23 14:50:42 +0000
@@ -276,6 +276,7 @@
no_enity_for_tracker_associate_attribute=Selected attribute has invalid tracked entity
error=Error
success=Success
+unable_to_fetch_data_from_server=Unable to fetch data from server.
access_denied=Access is Denied
registration_complete=Registration is completed
validation_error=Validation Error
=== 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-11-22 18:47:25 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-11-23 14:50:42 +0000
@@ -501,7 +501,7 @@
})
/* Service to deal with enrollment */
-.service('EnrollmentService', function($http, DateUtils) {
+.service('EnrollmentService', function($http, DateUtils, DialogService, $translate) {
var convertFromApiToUser = function(enrollment){
if(enrollment.enrollments){
@@ -539,6 +539,14 @@
getByEntityAndProgram: function( entity, program ){
var promise = $http.get( '../api/enrollments.json?ouMode=ACCESSIBLE&trackedEntityInstance=' + entity + '&program=' + program + '&paging=false').then(function(response){
return convertFromApiToUser(response.data);
+ }, function(response){
+ if( response && response.data && response.data.status === 'ERROR'){
+ var dialogOptions = {
+ headerText: response.data.status,
+ bodyText: response.data.message ? response.data.message : $translate.instant('unable_to_fetch_data_from_server')
+ };
+ DialogService.showDialog({}, dialogOptions);
+ }
});
return promise;
},
@@ -912,7 +920,7 @@
})
/* factory for handling events */
-.factory('DHIS2EventFactory', function($http) {
+.factory('DHIS2EventFactory', function($http, DialogService, $translate) {
return {
@@ -943,6 +951,14 @@
}
var promise = $http.get( url ).then(function(response){
return response.data.events;
+ }, function(response){
+ if( response && response.data && response.data.status === 'ERROR'){
+ var dialogOptions = {
+ headerText: response.data.status,
+ bodyText: response.data.message ? response.data.message : $translate.instant('unable_to_fetch_data_from_server')
+ };
+ DialogService.showDialog({}, dialogOptions);
+ }
});
return promise;
},
@@ -992,7 +1008,7 @@
})
/* factory for handling event reports */
-.factory('EventReportService', function($http) {
+.factory('EventReportService', function($http, DialogService, $translate) {
return {
getEventReport: function(orgUnit, ouMode, program, startDate, endDate, programStatus, eventStatus, pager){
@@ -1021,6 +1037,14 @@
var promise = $http.get( url ).then(function(response){
return response.data;
+ }, function(response){
+ if( response && response.data && response.data.status === 'ERROR'){
+ var dialogOptions = {
+ headerText: response.data.status,
+ bodyText: response.data.message ? response.data.message : $translate.instant('unable_to_fetch_data_from_server')
+ };
+ DialogService.showDialog({}, dialogOptions);
+ }
});
return promise;
}