← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21177: tracker-capture: better filtering in upcoming and overdue event reports

 

------------------------------------------------------------
revno: 21177
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-11-23 18:03:19 +0100
message:
  tracker-capture: better filtering in upcoming and overdue event 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/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/components/teiadd/tei-add-controller.js
  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-11-23 14:50:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js	2015-11-23 17:03:19 +0000
@@ -130,7 +130,7 @@
 
                     //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.sortGrid({id: 'dueDate', name: $translate.instant('due_date'), valueType: 'DATE', displayInListNoProgram: false, showFilter: false, show: true});
                         $scope.reverse = false;
                     }
                 }                
@@ -162,15 +162,14 @@
                     col.eventCol = false;
                 });
 
-                $scope.gridColumns.push({name: $translate('event_orgunit_name'), id: 'orgUnitName', type: 'string', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
+                $scope.gridColumns.push({name: $translate.instant('event_orgunit_name'), id: 'orgUnitName', valueType: 'TEXT', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
                 $scope.filterTypes['orgUnitName'] = 'string';
-                $scope.gridColumns.push({name: $translate('event_name'), id: 'eventName', type: 'string', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
+                $scope.gridColumns.push({name: $translate.instant('event_name'), id: 'eventName', valueType: 'TEXT', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
                 $scope.filterTypes['eventName'] = 'string';
-                $scope.gridColumns.push({name: $translate('due_date'), id: 'dueDate', type: 'date', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
-                $scope.filterTypes['dueDate'] = 'date';
-                $scope.filterText['dueDate']= {};                
-            });
-            
+                $scope.gridColumns.push({name: $translate.instant('due_date'), id: 'dueDate', valueType: 'DATE', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
+                $scope.filterTypes['dueDate'] = 'DATE';
+                $scope.filterText['dueDate']= {};
+            });            
         }      
     };
     
@@ -210,7 +209,7 @@
             return;
         }        
         $scope.sortColumn = gridHeader;
-        if($scope.sortColumn.valueType === 'date'){
+        if($scope.sortColumn.valueType === 'DATE'){
             $scope.reverse = true;
         }
         else{
@@ -220,7 +219,7 @@
     
     
     $scope.d2Sort = function(overDueEvent){ 
-        if($scope.sortColumn && $scope.sortColumn.valueType === 'date'){            
+        if($scope.sortColumn && $scope.sortColumn.valueType === 'DATE'){            
             var d = overDueEvent[$scope.sortColumn.id];         
             return DateUtils.getDate(d);
         }

=== 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-11-23 14:50:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events.html	2015-11-23 17:03:19 +0000
@@ -144,29 +144,45 @@
 
                                     <!-- filter icon begins -->
                                     <span class='pull-right hideInPrint'>
-                                        <span ng-if="gridColumn.type != 'date' && gridColumn.type != 'int'">
+                                        <span ng-if="gridColumn.valueType !== 'DATE' && gridColumn.valueType !== 'NUMBER'">
                                             <a href ng-click="searchInGrid(gridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [filterText[gridColumn.id] == undefined || filterText[gridColumn.id] == '']"><i class="fa fa-search"></i></span></a>
                                         </span>
-                                        <span ng-if="gridColumn.type === 'date' || gridColumn.type === 'int'">
+                                        <span ng-if="gridColumn.valueType === 'DATE' || gridColumn.valueType === 'NUMBER'">
                                             <a href ng-click="searchInGrid(gridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [(filterText[gridColumn.id].start == undefined || filterText[gridColumn.id].start == '') && (filterText[gridColumn.id].end == undefined || filterText[gridColumn.id].end == '')]"><i class="fa fa-search"></i></span></a>
                                         </span>                                                    
                                     </span>
                                     <!-- filter icon ends -->
 
                                     <!-- filter input field begins -->
-                                    <span ng-if="gridColumn.showFilter" class="hideInPrint">  
-                                        <span ng-switch="gridColumn.type">
-                                            <span ng-switch-when="int">
-                                                <input style="width: 45%;" placeholder="{{'lower_limit'| translate}}" type="number" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
-                                                <input style="width: 45%;" placeholder="{{'upper_limit'| translate}}" type="number" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
-                                            </span>
-                                            <span ng-switch-when="date">
-                                                <input style="width: 70%;" placeholder="{{'start_date'| translate}}" type="text" ng-model="filterText[gridColumn.id].start" data-d2-date readonly="readonly">
-                                                <span ng-hide="filterText[gridColumn.id].start == undefined || filterText[gridColumn.id].start == ''">
+                                    <span ng-show="gridColumn.showFilter" class="hideInPrint">                                          
+                                        <span ng-switch="gridColumn.valueType">                                            
+                                            <span ng-switch-when="NUMBER">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER_POSITIVE">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" min="1" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" min="1" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER_NEGATIVE">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" max="-1" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" max="-1" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER_ZERO_OR_POSITIVE">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" min="0" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" min="0" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                            </span>
+                                            <span ng-switch-when="DATE">
+                                                <input style="width: 70%;" placeholder="{{'start_date' | translate}}" type="text" ng-model="filterText[gridColumn.id].start" d2-date readonly="readonly">
+                                                <span ng-hide="!filterText[gridColumn.id].start || filterText[gridColumn.id].start == undefined || filterText[gridColumn.id].start == ''">
                                                     <a href ng-click='removeStartFilterText(gridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>                                                        
                                                 </span>
-                                                <input style="width: 70%;" placeholder="{{'end_date'| translate}}" type="text" ng-model="filterText[gridColumn.id].end" data-d2-date readonly="readonly">
-                                                <span ng-hide="filterText[gridColumn.id].end == undefined || filterText[gridColumn.id].end == ''">
+                                                <input style="width: 70%;" placeholder="{{'end_date' | translate}}" type="text" ng-model="filterText[gridColumn.id].end" d2-date readonly="readonly">
+                                                <span ng-hide="!filterText[gridColumn.id].end || filterText[gridColumn.id].end == undefined || filterText[gridColumn.id].end == ''">
                                                     <a href ng-click='removeEndFilterText(gridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>                                                        
                                                 </span> 
                                             </span>
@@ -175,7 +191,7 @@
                                             </span> 
                                         </span>                                                    
                                     </span>
-                                    <!-- filter input field ends -->
+                                    <!-- filter input field ends -->    
                                     
                                 </th>
                             </tr>                        

=== 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-11-23 14:50:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js	2015-11-23 17:03:19 +0000
@@ -129,7 +129,7 @@
 
                 //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.sortGrid({id: 'dueDate', name: $translate.instant('due_date'), valueType: 'DATE', displayInListNoProgram: false, showFilter: false, show: true});
                     $scope.reverse = false;
                 }
             }
@@ -162,12 +162,12 @@
                     col.eventCol = false;
                 });
                 
-                $scope.gridColumns.push({name: $translate('event_orgunit_name'), id: 'orgUnitName', type: 'string', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
-                $scope.filterTypes['orgUnitName'] = 'string';
-                $scope.gridColumns.push({name: $translate('event_name'), id: 'eventName', type: 'string', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
-                $scope.filterTypes['eventName'] = 'string';
-                $scope.gridColumns.push({name: $translate('due_date'), id: 'dueDate', type: 'date', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
-                $scope.filterTypes['dueDate'] = 'date';
+                $scope.gridColumns.push({name: $translate.instant('event_orgunit_name'), id: 'orgUnitName', valueType: 'TEXT', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
+                $scope.filterTypes['orgUnitName'] = 'TEXT';
+                $scope.gridColumns.push({name: $translate.instant('event_name'), id: 'eventName', valueType: 'TEXT', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
+                $scope.filterTypes['eventName'] = 'TEXT';
+                $scope.gridColumns.push({name: $translate.instant('due_date'), id: 'dueDate', valueType: 'DATE', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
+                $scope.filterTypes['dueDate'] = 'DATE';
                 $scope.filterText['dueDate']= {};                
             });
             
@@ -209,7 +209,7 @@
             return;
         }        
         $scope.sortColumn = gridHeader;
-        if($scope.sortColumn.valueType === 'date'){
+        if($scope.sortColumn.valueType === 'DATE'){
             $scope.reverse = true;
         }
         else{
@@ -218,7 +218,7 @@
     };
     
     $scope.d2Sort = function(upcomingDueEvent){ 
-        if($scope.sortColumn && $scope.sortColumn.valueType === 'date'){            
+        if($scope.sortColumn && $scope.sortColumn.valueType === 'DATE'){            
             var d = upcomingDueEvent[$scope.sortColumn.id];         
             return DateUtils.getDate(d);
         }

=== 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-11-23 14:50:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html	2015-11-23 17:03:19 +0000
@@ -170,29 +170,45 @@
 
                                     <!-- filter icon begins -->
                                     <span class='pull-right hideInPrint'>
-                                        <span ng-if="gridColumn.type != 'date' && gridColumn.type != 'int'">
+                                        <span ng-if="gridColumn.type != 'DATE' && gridColumn.type != 'NUMBER'">
                                             <a href ng-click="searchInGrid(gridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [filterText[gridColumn.id] == undefined || filterText[gridColumn.id] == '']"><i class="fa fa-search"></i></span></a>
                                         </span>
-                                        <span ng-if="gridColumn.type === 'date' || gridColumn.type === 'int'">
+                                        <span ng-if="gridColumn.type === 'DATE' || gridColumn.type === 'NUMBER'">
                                             <a href ng-click="searchInGrid(gridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [(filterText[gridColumn.id].start == undefined || filterText[gridColumn.id].start == '') && (filterText[gridColumn.id].end == undefined || filterText[gridColumn.id].end == '')]"><i class="fa fa-search"></i></span></a>
                                         </span>                                                    
                                     </span>
                                     <!-- filter icon ends -->
 
                                     <!-- filter input field begins -->
-                                    <span ng-if="gridColumn.showFilter" class="hideInPrint">  
-                                        <span ng-switch="gridColumn.type">
-                                            <span ng-switch-when="int">
-                                                <input style="width: 45%;" placeholder="{{'lower_limit'| translate}}" type="number" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
-                                                <input style="width: 45%;" placeholder="{{'upper_limit'| translate}}" type="number" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
-                                            </span>
-                                            <span ng-switch-when="date">
-                                                <input style="width: 70%;" placeholder="{{'start_date'| translate}}" type="text" ng-model="filterText[gridColumn.id].start" data-d2-date readonly="readonly">
-                                                <span ng-hide="filterText[gridColumn.id].start == undefined || filterText[gridColumn.id].start == ''">
+                                    <span ng-show="gridColumn.showFilter" class="hideInPrint">                                          
+                                        <span ng-switch="gridColumn.valueType">                                            
+                                            <span ng-switch-when="NUMBER">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER_POSITIVE">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" min="1" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" min="1" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER_NEGATIVE">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" max="-1" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" max="-1" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER_ZERO_OR_POSITIVE">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" min="0" ng-model="filterText[gridColumn.id].start" ng-blur="searchInGrid(gridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" min="0" ng-model="filterText[gridColumn.id].end" ng-blur="searchInGrid(gridColumn)">
+                                            </span>
+                                            <span ng-switch-when="DATE">
+                                                <input style="width: 70%;" placeholder="{{'start_date' | translate}}" type="text" ng-model="filterText[gridColumn.id].start" d2-date readonly="readonly">
+                                                <span ng-hide="!filterText[gridColumn.id].start || filterText[gridColumn.id].start == undefined || filterText[gridColumn.id].start == ''">
                                                     <a href ng-click='removeStartFilterText(gridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>                                                        
                                                 </span>
-                                                <input style="width: 70%;" placeholder="{{'end_date'| translate}}" type="text" ng-model="filterText[gridColumn.id].end" data-d2-date readonly="readonly">
-                                                <span ng-hide="filterText[gridColumn.id].end == undefined || filterText[gridColumn.id].end == ''">
+                                                <input style="width: 70%;" placeholder="{{'end_date' | translate}}" type="text" ng-model="filterText[gridColumn.id].end" d2-date readonly="readonly">
+                                                <span ng-hide="!filterText[gridColumn.id].end || filterText[gridColumn.id].end == undefined || filterText[gridColumn.id].end == ''">
                                                     <a href ng-click='removeEndFilterText(gridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>                                                        
                                                 </span> 
                                             </span>
@@ -201,7 +217,7 @@
                                             </span> 
                                         </span>                                                    
                                     </span>
-                                    <!-- filter input field ends -->
+                                    <!-- filter input field ends -->    
                                     
                                 </th>
                             </tr>                        

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add-controller.js	2015-10-08 11:26:14 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add-controller.js	2015-11-23 17:03:19 +0000
@@ -298,7 +298,7 @@
             $scope.teiFetched = true;
             
             if(!$scope.sortColumn.id){                                      
-                $scope.sortGrid({id: 'created', name: $translate('registration_date'), valueType: 'date', displayInListNoProgram: false, showFilter: false, show: false});
+                $scope.sortGrid({id: 'created', name: $translate.instant('registration_date'), valueType: 'date', displayInListNoProgram: false, showFilter: false, show: false});
             }
             
         });

=== 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-23 14:50:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-11-23 17:03:19 +0000
@@ -1575,7 +1575,7 @@
             var header = []; 
             angular.forEach(columns, function(col){
                 if(col.show){
-                    header.push($translate(col.name));
+                    header.push($translate.instant(col.name));
                 }
             });        
             return header;