← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18591: tracker-capture: option to fitler TEIs based on their enrollment status. Available filters are AL...

 

------------------------------------------------------------
revno: 18591
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-03-12 11:55:00 +0100
message:
  tracker-capture: option to fitler TEIs based on their enrollment status. Available filters are ALL, ACTIVE, COMPLETED and CANCELLED. A program needs to be selected for the filtering to be applied.
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/scripts/controllers.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
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.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/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-03-11 11:21:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-03-12 10:55:00 +0000
@@ -282,6 +282,11 @@
 zoom_out=Zoom out
 center_map=Center map
 capture_coordinate=Capture coordinate
+show_active_only=Show only active ones
+all_enrollment=Show with all enrollment status
+active_enrollment=Only those with active enrollment
+cancelled_enrollment=Only those with cancelled enrollment
+completed_enrollment=Only those with completed enrollment
 filter_events=Filter events
 list_events=List all events
 jan=January

=== 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-03-11 15:02:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2015-03-12 10:55:00 +0000
@@ -32,6 +32,8 @@
     $scope.selectedOrgUnitId = ($location.search()).ou;
     $scope.treeLoaded = false;
     $scope.searchOuTree = false;
+    $scope.teiListMode = {onlyActive: false};
+    $scope.enrollmentStatus = 'ALL';
     
     //Paging
     $scope.pager = {pageSize: 50, page: 1, toolBarDisplay: 5};   
@@ -171,15 +173,12 @@
     };
    
     //$scope.searchParam = {bools: []};
-    $scope.search = function(mode){
-        $scope.teiFetched = false;
+    $scope.search = function(mode){        
         $scope.selectedSearchMode = mode;
         $scope.emptySearchText = false;
         $scope.emptySearchAttribute = false;
         $scope.showRegistrationDiv = false;  
-        $scope.showTrackedEntityDiv = false;
-        $scope.trackedEntityList = null; 
-        $scope.teiCount = null;
+        $scope.showTrackedEntityDiv = false;        
         
         $scope.queryUrl = null;
         $scope.programUrl = null;
@@ -230,6 +229,11 @@
     };
     
     $scope.fetchTeis = function(){
+        
+        $scope.teiFetched = false;
+        $scope.trackedEntityList = null; 
+        $scope.teiCount = null;
+        
         //get events for the specified parameters        
         TEIService.search($scope.searchingOrgUnit.id, 
                                             $scope.selectedOuMode.name,
@@ -387,6 +391,20 @@
         }        
     };
     
+    
+    $scope.filterByEnrollmentStatus = function(status){
+        if(status !== $scope.enrollmentStatus){            
+            $scope.enrollmentStatus = status;                
+            if($scope.enrollmentStatus === 'ALL'){
+                $scope.programUrl = 'program=' + $scope.selectedProgram.id;                
+            }
+            else{
+                $scope.programUrl = 'program=' + $scope.selectedProgram.id + '&programStatus=' + $scope.enrollmentStatus;
+            }
+            $scope.fetchTeis();
+        }
+    };
+    
     //load programs for the selected orgunit (from tree)
     $scope.setSelectedSearchingOrgUnit = function(orgUnit){    
         $scope.selectedSearchingOrgUnit = orgUnit;

=== 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-03-10 07:49:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html	2015-03-12 10:55:00 +0000
@@ -15,12 +15,12 @@
     $('#searchDropDown').on('click', "[data-stop-propagation]", function (e) {
         e.stopPropagation();
     });
-    
+
     //stop date picker's event bubling
     $(document).on('click.dropdown touchstart.dropdown.data-api', '#ui-datepicker-div', function (e) {
         e.stopPropagation();
     });
-    
+
     $(window).resize(function () {
         $("#selectDropDown").width($("#selectDropDownParent").width());
         $("#searchDropDown").width($("#searchDropDownParent").width());
@@ -28,40 +28,49 @@
 </script>
 
 <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>
+            <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>    
-    
+
     <d2-ou-search></d2-ou-search>
-    
+
     <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="{{'loading_tree'| translate}}"/>
     <div class="small-horizonal-spacing" ng-if='!treeLoaded'>
         {{'loading_tree'| translate}}
     </div> 
 </div>
 
 <div class="page" id="mainPage">
-    
+
     <div ng-if="!selectedOrgUnit">
         <img src="../images/ajax-loader-bar.gif" alt="{{'in_progress'| translate}}" ng-if="!selectedOrgUnit"/><br>
         {{'loading_metadata'| translate}}
     </div> 
 
     <div ng-show="selectedOrgUnit">
-		
+
         <!-- top bar begins -->
         <div class="row top-bar">        
             <div class="col-sm-12">            
                 <span ng-if='!showRegistrationDiv'>
-                    {{selectedProgram.trackedEntity.name}} {{'search'| translate}}<span class="small-horizonal-spacing" ng-if="pager.total">({{'total' | translate}}:  {{pager.total}})</span>
+                    {{selectedProgram.trackedEntity.name}} {{'search'| translate}}
+                    <span class="small-horizonal-spacing" ng-if="pager.total">
+                        ({{'total'| translate}}:  {{pager.total}})
+                    </span>
+                    <span class="btn-group horizonal-spacing" ng-show="selectedProgram">
+                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'ALL'" title="{{'all_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("ALL")'><i class="fa fa-check-square mouse-pointer"></i></label>
+                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'ACTIVE'" title="{{'active_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("ACTIVE")'><i class="fa fa-spinner fa-spin mouse-pointer"></i></label>
+                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'COMPLETED'" title="{{'completed_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("COMPLETED")'><i class="fa fa-circle-o mouse-pointer"></i></label>
+                        <label class="btn btn-default" ng-model="enrollmentStatus" btn-radio="'CANCELLED'" title="{{'cancelled_enrollment'| translate}}" ng-click='filterByEnrollmentStatus("CANCELLED")'><i class="fa fa-times mouse-pointer"></i></label>
+                    </span>
                 </span>
                 <span ng-if='showRegistrationDiv'>
                     {{selectedProgram.trackedEntity.name}} {{'register'| translate}}
@@ -84,38 +93,39 @@
         <input type="text" selected-org-unit ng-model="selectedOrgUnit.name" ng-hide=true>
         <!--- selected org unit ends  -->
 
-        <!--- search, registration and reporting menu begins -->
+        <!--- search and registration menu begins -->
         <div class="row vertical-spacing not-for-screen">
             <div class="col-md-4">
-                <h4>{{'org_unit' | translate}}</h4>
+                <h4>{{'org_unit'| translate}}</h4>
             </div>
             <div class="col-md-4">
                 <input type="text" class="form-control" ng-disabled='true' value="{{selectedOrgUnit.name}}">
             </div>
         </div>
         <div class="row">
-            
+
             <!-- program selection begins -->
             <div id="selectDropDownParent" class="input-group col-md-4">            
                 <button type="button" class="select-dropdown-button form-control" ng-show="programs.length > 0">{{selectedProgram ? selectedProgram.name : 'please_select_a_program'| translate}}</button>
-                <button type="button" class="select-dropdown-button form-control" ng-show="programs.length < 1" ng-disabled="true">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists' | translate}}</button>
+                <button type="button" class="select-dropdown-button form-control" ng-show="programs.length < 1" ng-disabled="true">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists'| translate}}</button>
                 <div class="input-group-btn">
                     <button class="btn btn-default select-dropdown-caret" type="button" title="{{'list_programs'| translate}}" data-toggle="dropdown" ng-disabled="programs.length < 1"><i class="fa fa-caret-down"></i></button>
                     <ul id="selectDropDown" class="dropdown-menu dropdown-menu-right">
                         <li>
-                            <a href ng-click="getProgramAttributes(null)">{{'please_select_a_program' | translate}}</a>
+                            <a href ng-click="getProgramAttributes(null)">{{'please_select_a_program'| translate}}</a>
                         </li>
                         <li ng-repeat="program in programs| orderBy: 'name'">
                             <a href ng-click="getProgramAttributes(program)">{{program.name}}</a>
                         </li>
                     </ul>
-                </div>                
+                </div>
             </div>
+
             <!-- program selection ends -->
-            
+
             <!-- simple/advanced search begins -->
             <div id="searchDropDownParent" class="input-group col-md-4 not-printable">
-                <input type="text" placeholder="{{'type_your_search_criteria_here'| translate}}" ng-model="searchText" class="form-control expanded" d2-enter="search(searchMode.freeText)" ng-class="{true: 'invalid-input'} [!searchText && emptySearchText]" ng-focus="showHideSearch()" ng-disabled="showRegistrationDiv">
+                <input type="text" placeholder="{{'type_your_search_criteria_here'| translate}}" ng-model="searchText" class="form-control expanded" d2-enter="search(searchMode.freeText)" ng-class="{true: 'invalid - input'} [!searchText && emptySearchText]" ng-focus="showHideSearch()" ng-disabled="showRegistrationDiv">
                 <div class="input-group-btn">
                     <button class="btn btn-default search-dropdown-button trim" type="button" title="{{'advanced_search'| translate}}" data-toggle="dropdown" ng-click="showHideSearch()" ng-disabled="showRegistrationDiv"><i class="fa fa-caret-down"></i></button>
                     <button class="btn btn-primary trim" type="button" title="{{'search'| translate}}" ng-disabled="showRegistrationDiv" ng-click="search(searchMode.freeText)"><i class="fa fa-search"></i></button>
@@ -127,7 +137,7 @@
                 </div>                
             </div>
             <!-- simple/advanced search ends -->
-            
+
             <!--search/registration buttons begin-->
             <div class="col-md-4 trim not-printable">            
                 <button type="button" 
@@ -149,9 +159,9 @@
                 </button>
             </div>
             <!--search/registration buttons end-->
-            
+
         </div>
-        <!--- search, registration and reporting menu ends -->
+        <!--- search and registration menu ends -->
 
         <!--- Error display for search begins -->
         <div class="row" ng-if="emptySearchAttribute || !searchText && emptySearchText">
@@ -170,13 +180,13 @@
         <!-- registration form ends -->        
 
         <!-- entity grid begins -->
-        <img src="../images/ajax-loader-bar.gif" alt="{{'in_progress' | translate}}" ng-if="!teiFetched && searchText && !emptySearchTex"/>
+        <img src="../images/ajax-loader-bar.gif" alt="{{'in_progress'| translate}}" ng-if="!teiFetched && searchText && !emptySearchTex"/>
         <div class="row" ng-if="showTrackedEntityDiv">
             <div class="col-md-12" ng-include="'views/tei.html'"></div>  
         </div>
         <!-- entity grid ends -->
     </div>
-    
+
 </div>           
 
 

=== 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-03-11 15:02:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html	2015-03-12 10:55:00 +0000
@@ -1,57 +1,55 @@
-<div ng-switch="teiCount">                    
+<div ng-switch="teiCount" class='vertical-spacing'>                    
     <div ng-switch-when="undefined">
         <div class="alert alert-warning vertical-spacing">
-            {{'no'| translate}} {{selectedProgram.trackedEntity.name || 'records' | translate}} {{'found'| translate}}                        
+            {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
         </div>
     </div>
     <div ng-switch-when="0">  
         <div class="alert alert-warning vertical-spacing">
-            {{'no'| translate}} {{selectedProgram.trackedEntity.name || 'records' | translate}} {{'found'| translate}}                        
+            {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
         </div>
     </div>    
-    <div ng-switch-default> 
-        
+    <div ng-switch-default>        
         <!-- entity begins -->
-        <div class="vertical-spacing">
-            <table class="table table-striped dhis2-table-hover table-bordered">               
-                <thead>                        
-                    <tr>
-                        <th ng-if="gridColumn.show" ng-repeat="gridColumn in gridColumns" class='mouse-pointer' ng-click="sortGrid(gridColumn)">                            
-                            <!-- sort icon begins -->                                
-                            <span ng-hide="gridColumn.showFilter" class="bold pointer" title="{{'sort'| translate}}">
-                                <span ng-class="{true: 'red'} [sortColumn.id === gridColumn.id]"><i class="fa fa-sort"></i></span>
-                                {{gridColumn.name}}
-                            </span>
-                            <!-- sort icon ends -->                            
-                        </th>                                    
-                    </tr>                        
-                </thead>
-                <tbody id="list">
-                    <tr ng-repeat="trackedEntity in trackedEntityList.rows | orderBy:d2Sort:reverse"   
-                        ng-click="showDashboard(trackedEntity)"
-                        title="{{'go_to_dashboard'| translate}}">
-                        <td ng-show="gridColumn.show"                                            
-                            ng-repeat="gridColumn in gridColumns">
-                            <span ng-switch="gridColumn.valueType">
-                                <span ng-switch-when="bool">
-                                    <span ng-if="trackedEntity[gridColumn.id] === 'true'">{{'yes' | translate}}</span>
-                                    <span ng-if="trackedEntity[gridColumn.id] === 'false'">{{ 'no' | translate}}</span>
-                                </span>
-                                <span ng-switch-when="trueOnly">
-                                    <span ng-if="trackedEntity[gridColumn.id] === 'true'"><i class="fa fa-check"></i></span>
-                                </span>
-                                <span ng-switch-default>{{trackedEntity[gridColumn.id]}}</span>
-                            </span>                            
-                        </td>
-                    </tr>
-                </tbody>        
-            </table>
-        </div>
+        <table class="table table-striped dhis2-table-hover table-bordered">               
+            <thead>                        
+                <tr>
+                    <th ng-if="gridColumn.show" ng-repeat="gridColumn in gridColumns" class='mouse-pointer' ng-click="sortGrid(gridColumn)">                            
+                        <!-- sort icon begins -->                                
+                        <span ng-hide="gridColumn.showFilter" class="bold pointer" title="{{'sort'| translate}}">
+                            <span ng-class="{true: 'red'} [sortColumn.id === gridColumn.id]"><i class="fa fa-sort"></i></span>
+                            {{gridColumn.name}}
+                        </span>
+                        <!-- sort icon ends -->                            
+                    </th>                                    
+                </tr>                        
+            </thead>
+            <tbody id="list">
+                <tr ng-repeat="trackedEntity in trackedEntityList.rows| orderBy:d2Sort:reverse"   
+                    ng-click="showDashboard(trackedEntity)"
+                    title="{{'go_to_dashboard'| translate}}">
+                    <td ng-show="gridColumn.show"                                            
+                        ng-repeat="gridColumn in gridColumns">
+                        <span ng-switch="gridColumn.valueType">
+                            <span ng-switch-when="bool">
+                                <span ng-if="trackedEntity[gridColumn.id] === 'true'">{{'yes'| translate}}</span>
+                                <span ng-if="trackedEntity[gridColumn.id] === 'false'">{{ 'no' | translate}}</span>
+                            </span>
+                            <span ng-switch-when="trueOnly">
+                                <span ng-if="trackedEntity[gridColumn.id] === 'true'"><i class="fa fa-check"></i></span>
+                            </span>
+                            <span ng-switch-default>{{trackedEntity[gridColumn.id]}}</span>
+                        </span>                            
+                    </td>
+                </tr>
+            </tbody>        
+        </table>
+
         <!-- entity ends -->
-        
+
         <!-- paging begins -->
         <serverside-paginator></serverside-paginator>
         <!-- paging ends -->
-        
+
     </div>
 </div> 
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2015-03-05 15:48:50 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2015-03-12 10:55:00 +0000
@@ -497,7 +497,7 @@
             function enableDisableZoom(){
                 if(currentLayer >= ouLevels.length-1){                    
                     $("#zoomIn").addClass('disabled-context-menu-item');
-                    $("#zoomIn").removeClass('enable-context-menu-item');
+                    $("#zoomIn").removeClass('mouse-pointer');
                     $('#zoomIn').attr('disabled', "disabled");
                 }else{
                     $("#zoomIn").removeClass('disabled-context-menu-item');