dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42280
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21613: TC: TEIS with events here today
------------------------------------------------------------
revno: 21613
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-01-06 10:00:50 +0100
message:
TC: TEIS with events here today
modified:
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_ar.properties
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.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-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-12-30 13:04:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2016-01-06 09:00:50 +0000
@@ -384,9 +384,14 @@
value_not_unique=Value not unique
custom_form_has_invalid_attribute=Custom form has invalid attribute.
custom_form_has_invalid_dataelement=Custom form has invalid data element.
+events_today_persons=Only those with an event today
has_no_dataelements=has no dataelements.
section=Section
display_mode=Display mode
tracker_capture_display_mode=Tracker capture display mode
+events_today_all=All events today
+events_today_completeoractive=Complete or active
+events_today_skipped=Skipped
+events_today_scheduled=Scheduled
print_form=Print form
-value_must_be_email=Please enter a valid email address
\ No newline at end of file
+value_must_be_email=Please enter a valid email address
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app_ar.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app_ar.properties 2015-12-11 19:41:20 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app_ar.properties 2016-01-06 09:00:50 +0000
@@ -263,4 +263,9 @@
help=\u0645\u0633\u0627\u0639\u062f\u0629
log_out=\u062a\u0633\u062c\u064a\u0644 \u062e\u0631\u0648\u062c
about_dhis2=\u062d\u0648\u0644 DHIS 2
-value_must_be_email = \u064a\u062c\u0628 \u0623\u0646 \u062a\u0643\u0648\u0646 \u0642\u064a\u0645\u0629 \u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a(\u062c\u0648\u062c\u0644 \u062a\u0631\u062c\u0645\u0629)
\ No newline at end of file
+events_today_persons=\u0641\u0642\u0637 \u062a\u0644\u0643 \u0627\u0644\u062a\u064a \u062d\u062f\u062b \u0627\u0644\u064a\u0648\u0645(\u062c\u0648\u062c\u0644 \u062a\u0631\u062c\u0645\u0629)
+events_today_all = \u062c\u0645\u064a\u0639 \u0623\u062d\u062f\u0627\u062b \u0627\u0644\u064a\u0648\u0645(\u062c\u0648\u062c\u0644 \u062a\u0631\u062c\u0645\u0629)
+events_today_completeoractive = \u0643\u0627\u0645\u0644\u0629 \u0623\u0648 \u0646\u0634\u0627\u0637\u0627(\u062c\u0648\u062c\u0644 \u062a\u0631\u062c\u0645\u0629)
+events_today_skipped = \u062a\u062e\u0637\u064a(\u062c\u0648\u062c\u0644 \u062a\u0631\u062c\u0645\u0629)
+events_today_scheduled = \u0627\u0644\u0645\u0642\u0631\u0631(\u062c\u0648\u062c\u0644 \u062a\u0631\u062c\u0645\u0629)
+value_must_be_email = \u064a\u062c\u0628 \u0623\u0646 \u062a\u0643\u0648\u0646 \u0642\u064a\u0645\u0629 \u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a(\u062c\u0648\u062c\u0644 \u062a\u0631\u062c\u0645\u0629)
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2015-12-23 09:29:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2016-01-06 09:00:50 +0000
@@ -25,10 +25,14 @@
EntityQueryFactory,
CurrentSelection,
TEIGridService,
- TEIService) {
-
-
+ TEIService,
+ EventReportService,
+ ModalService,$q) {
$scope.maxOptionSize = 30;
+ $scope.eventsTodayFilters = [{name: $translate.instant('events_today_all'), value: 'all'},{name: $translate.instant('events_today_completeoractive'),value: 'completedOrActive', status:['COMPLETED', 'ACTIVE']},{name: $translate.instant('events_today_skipped') , value: 'skipped', status:['SKIPPED']},{name: $translate.instant('events_today_scheduled'), value: 'scheduled', status:['SCHEDULE']}];
+ $scope.selectedEventsTodayFilter = $scope.eventsTodayFilters[0];
+ $scope.availablePrograms = {};
+
$scope.model = {};
//Selection
@@ -39,8 +43,8 @@
$scope.treeLoaded = false;
$scope.searchOuTree = {open: true};
$scope.teiListMode = {onlyActive: false};
- $scope.enrollmentStatus = 'ALL';
-
+ $scope.enrollmentStatus = 'FIND';
+
//Searching
$scope.showSearchDiv = false;
$scope.searchText = null;
@@ -63,7 +67,6 @@
$scope.teiFetched = false;
$scope.queryUrl = null;
$scope.programUrl = null;
- $scope.enrollmentStatus = 'ALL';
$scope.attributeUrl = {url: null, hasValue: false};
$scope.pager = {pageSize: 50, page: 1, toolBarDisplay: 5};
}
@@ -72,7 +75,7 @@
$scope.$watch('selectedOrgUnit', function() {
if( angular.isObject($scope.selectedOrgUnit)){
-
+ $scope.doSearch = true;
$scope.searchingOrgUnit = $scope.selectedOrgUnit;
SessionStorageService.set('SELECTED_OU', $scope.selectedOrgUnit);
@@ -124,9 +127,12 @@
$scope.showHideLabel = $translate.instant('show_hide_columns');
$scope.listProgramsLabel = $translate.instant('list_programs');
$scope.settingsLabel = $translate.instant('settings');
+ $scope.todayLabel = $translate.instant('events_today_persons');
+
$scope.displayModeLabel = $translate.instant('display_mode');
resetParams();
+ //$scope.doSearch = true;
$scope.loadPrograms($scope.selectedOrgUnit);
}
});
@@ -185,12 +191,22 @@
$scope.doSearch = false;
}
+ $scope.setEnrollmentStatus();
if($scope.doSearch && $scope.selectedProgram && $scope.selectedProgram.displayFrontPageList){
$scope.search($scope.searchMode);
}
});
};
+ $scope.setEnrollmentStatus = function(){
+ if($rootScope.enrollmentStatus){
+ $scope.enrollmentStatus = $rootScope.enrollmentStatus;
+ $rootScope.enrollmentStatus = null;
+ }else if($scope.selectedProgram && $scope.selectedProgram.displayFrontPageList){
+ $scope.enrollmentStatus = 'TODAY';
+ }
+ };
+
//sortGrid
$scope.sortGrid = function(gridHeader){
if ($scope.sortColumn && $scope.sortColumn.id === gridHeader.id){
@@ -268,42 +284,81 @@
$scope.doSearch = false;
$scope.fetchTeis();
};
+ $scope.fetchTeisEventsToday = function(eventsTodayFilter){
+ $scope.teiFetched = false;
+ $scope.selectedEventsTodayFilter = eventsTodayFilter;
+ $scope.trackedEntityList = null;
+ var today = DateUtils.getToday();
+ var promises = [];
+
+ if(!eventsTodayFilter.status){
+ promises.push(EventReportService.getEventReport($scope.searchingOrgUnit.id,$scope.selectedOuMode.name, $scope.selectedProgram.id,today,today,'ACTIVE',null,$scope.pager));
+ }else{
+ angular.forEach(eventsTodayFilter.status, function(status){
+ promises.push(EventReportService.getEventReport($scope.searchingOrgUnit.id,$scope.selectedOuMode.name, $scope.selectedProgram.id,today,today,'ACTIVE',status,$scope.pager));
+ });
+ }
+ $q.all(promises).then(function(data){
+ $scope.trackedEntityList = { rows: {own:[]}};
+ var ids = [];
+ angular.forEach(data, function(result){
+ if(result.eventRows){
+ angular.forEach(result.eventRows, function(eventRow){
+ if(ids.indexOf(eventRow.trackedEntityInstance) === -1){
+ var row = { id: eventRow.trackedEntityInstance};
+ angular.forEach(eventRow.attributes, function(attr){
+ row[attr.attribute] = attr.value;
+ });
+ $scope.trackedEntityList.rows.own.push(row);
+ ids.push(eventRow.trackedEntityInstance);
+
+ }
+ });
+ }
+ });
+ $scope.trackedEntityList.length = $scope.trackedEntityList.rows.own.length;
+ $scope.teiFetched = true;
+ });
+ };
$scope.fetchTeis = function(){
-
$scope.teiFetched = false;
$scope.trackedEntityList = null;
$scope.showTrackedEntityDiv = true;
-
- //get events for the specified parameters
- TEIService.search($scope.searchingOrgUnit.id,
- $scope.selectedOuMode.name,
- $scope.queryUrl,
- $scope.programUrl,
- $scope.attributeUrl.url,
- $scope.pager,
- true).then(function(data){
- if( data && data.metaData && data.metaData.pager ){
- $scope.pager = data.metaData.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);
- }
-
- //process tei grid
- $scope.trackedEntityList = TEIGridService.format(data,false, $scope.optionSets, null);
-
- $scope.showSearchDiv = false;
- $scope.teiFetched = true;
- $scope.doSearch = true;
-
- if(!$scope.sortColumn.id){
- $scope.sortGrid({id: 'created', name: 'registration_date', valueType: 'date', displayInListNoProgram: false, showFilter: false, show: false});
- }
- });
+ $scope.eventsToday = false;
+ //get events for the specified parameters
+ if($scope.enrollmentStatus==='TODAY'){
+ $scope.fetchTeisEventsToday($scope.selectedEventsTodayFilter);
+ }else{
+ TEIService.search($scope.searchingOrgUnit.id,
+ $scope.selectedOuMode.name,
+ $scope.queryUrl,
+ $scope.programUrl,
+ $scope.attributeUrl.url,
+ $scope.pager,
+ true).then(function(data){
+ if( data && data.metaData && data.metaData.pager ){
+ $scope.pager = data.metaData.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);
+ }
+
+ //process tei grid
+ $scope.trackedEntityList = TEIGridService.format(data,false, $scope.optionSets, null);
+ $scope.showSearchDiv = false;
+ $scope.teiFetched = true;
+ $scope.doSearch = true;
+
+ if(!$scope.sortColumn.id){
+ $scope.sortGrid({id: 'created', name: 'registration_date', valueType: 'date', displayInListNoProgram: false, showFilter: false, show: false});
+ }
+ });
+
+ }
};
$scope.jumpToPage = function(){
@@ -392,7 +447,8 @@
sortedTeiIds.push(tei.id);
});
- CurrentSelection.setSortedTeiIds(sortedTeiIds);
+ CurrentSelection.setSortedTeiIds(sortedTeiIds);
+ $rootScope.enrollmentStatus = $scope.enrollmentStatus;
$location.path('/dashboard').search({tei: currentEntity.id,
program: $scope.selectedProgram ? $scope.selectedProgram.id: null});
};
@@ -409,7 +465,6 @@
o.hasChildren = o.children && o.children.length > 0 ? true : false;
});
});
-
$scope.selectedSearchingOrgUnit = $scope.orgUnits[0] ? $scope.orgUnits[0] : null;
});
@@ -434,13 +489,15 @@
$scope.filterByEnrollmentStatus = function(status){
if(status !== $scope.enrollmentStatus){
- $scope.enrollmentStatus = status;
+ $scope.enrollmentStatus = status;
if($scope.enrollmentStatus === 'ALL'){
- $scope.programUrl = 'program=' + $scope.selectedProgram.id;
+ $scope.programUrl = 'program=' + $scope.selectedProgram.id;
+ }else if($scope.enrollmentStatus ==='TODAY'){
+ $scope.programUrl = 'program=' + $scope.selectedProgram.id + '&programStatus=' + $scope.enrollmentStatus;
}
else{
$scope.programUrl = 'program=' + $scope.selectedProgram.id + '&programStatus=' + $scope.enrollmentStatus;
- }
+ }
$scope.fetchTeis();
}
};
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-12-24 11:47:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2016-01-06 09:00:50 +0000
@@ -287,7 +287,7 @@
return $.ajax( {
url: '../api/programs.json',
type: 'GET',
- data: 'fields=id,name,type,version,displayFrontPageList,dataEntryMethod,enrollmentDateLabel,incidentDateLabel,displayIncidentDate,ignoreOverdueEvents,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,dataEntryForm[id,name,style,htmlCode,format],relationshipText,relationshipFromA,relatedProgram[id,name],relationshipType[id,name],trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],userRoles[id,name],programStages[id,name,sortOrder,version,dataEntryForm[id,name,style,htmlCode,format],captureCoordinates,blockEntryForm,autoGenerateEvent,allowGenerateNextVisit,generatedByEnrollmentDate,remindCompleted,hideDueDate,excecutionDateLabel,minDaysFromStart,repeatable,openAfterEnrollment,standardInterval,periodType,reportDateToUse,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,code,name,description,formName,valueType,optionSetValue,optionSet[id]]]],programTrackedEntityAttributes[displayInList,mandatory,allowFutureDate,trackedEntityAttribute[id,unique]]&paging=false&filter=id:in:' + ids
+ data: 'fields=id,name,type,version,displayFrontPageList,dataEntryMethod,enrollmentDateLabel,incidentDateLabel,displayIncidentDate,ignoreOverdueEvents,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,dataEntryForm[id,name,style,htmlCode,format],relationshipText,relationshipFromA,relatedProgram[id,name],relationshipType[id,name],trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],userRoles[id,name],programStages[id,name,sortOrder,version,dataEntryForm[id,name,style,htmlCode,format],captureCoordinates,blockEntryForm,autoGenerateEvent,allowGenerateNextVisit,generatedByEnrollmentDate,remindCompleted,hideDueDate,excecutionDateLabel,minDaysFromStart,repeatable,openAfterEnrollment,standardInterval,periodType,reportDateToUse,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,code,name,description,formName,valueType,optionSetValue,optionSet[id],dataElementGroups[id,name]]]],programTrackedEntityAttributes[displayInList,mandatory,allowFutureDate,trackedEntityAttribute[id,unique]]&paging=false&filter=id:in:' + ids
}).done( function( response ){
if(response.programs){
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html 2015-12-28 20:34:02 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html 2016-01-06 09:00:50 +0000
@@ -112,7 +112,6 @@
</button>
</div>
<!--search/registration buttons end-->
-
</div>
<!--- search and registration menu ends -->
@@ -127,11 +126,12 @@
<!-- registration form ends -->
<!-- entity grid begins -->
- <i ng-if="!teiFetched && showTrackedEntityDiv" class="fa fa-spinner fa-spin fa-2x"></i>
+ <i ng-if="!teiFetched && showTrackedEntityDiv && enrollmentStatus!=='TODAY'" class="fa fa-spinner fa-spin fa-2x"></i>
<div class="row">
<div class="col-sm-12">
<span ng-if='!showRegistrationDiv'>
- <span class="btn-group" ng-if="selectedProgram && teiFetched">
+ <span class="btn-group" ng-if="selectedProgram && teiFetched || enrollmentStatus==='TODAY'">
+ <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'TODAY'" title="{{todayLabel}}" ng-click='filterByEnrollmentStatus("TODAY")'><i class='fa fa-calendar-o mouse-pointer'></i></label>
<label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'ALL'" title="{{allEnrollmentsLabel}}" ng-click='filterByEnrollmentStatus("ALL")'><i class="fa fa-list mouse-pointer"></i></label>
<label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'ACTIVE'" title="{{activeEnrollmentsLabel}}" ng-click='filterByEnrollmentStatus("ACTIVE")'><i class="fa fa-circle-o mouse-pointer"></i></label>
<label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'COMPLETED'" title="{{completedEnrollmentsLabel}}" ng-click='filterByEnrollmentStatus("COMPLETED")'><i class="fa fa-check mouse-pointer"></i></label>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html 2015-12-28 20:34:02 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html 2016-01-06 09:00:50 +0000
@@ -1,6 +1,20 @@
+<div class="row vertical-spacing">
+ <div id="selectDropDownParent" class="input-group col-md-3" ng-if="enrollmentStatus==='TODAY'">
+ <button type="button" class="select-dropdown-button form-control">{{selectedEventsTodayFilter.name}}</button>
+ <div class="input-group-btn todayfilter-drop-down">
+ <button class="btn btn-default select-dropdown-caret" type="button" data-toggle="dropdown" title="Test"><i class="fa fa-caret-down"></i></button>
+ <ul id="selectDropDown" class="dropdown-menu dropdown-menu-right">
+ <li ng-repeat="filter in eventsTodayFilters | orderBy: 'name'">
+ <a href ng-click="fetchTeisEventsToday(filter)">{{filter.name}}</a>
+ </li>
+ </ul>
+ </div>
+ </div>
+</div>
+<i ng-if="!teiFetched && enrollmentStatus==='TODAY'" class="fa fa-spinner fa-spin fa-2x"></i>
<div ng-if="teiFetched">
<div class="alert alert-warning vertical-spacing" ng-if="trackedEntityList.length === 0 || !trackedEntityList.length">
- {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}
+ {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}
</div>
<div class="vertical-spacing" ng-if="trackedEntityList.length > 0">
@@ -93,8 +107,9 @@
</tr>
</tbody>
</table>
- <serverside-paginator></serverside-paginator>
- </div>
+ <div ng-if="enrollmentStatus!=='TODAY'">
+ <serverside-paginator></serverside-paginator>
+ </div>
+
+ </div>
</div>
-
-