← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19970: more conversion of valueTypes

 

------------------------------------------------------------
revno: 19970
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-03 16:55:07 +0200
message:
  more conversion of valueTypes
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.filters.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-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-09-03 13:13:08 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-09-03 14:55:07 +0000
@@ -169,10 +169,10 @@
                 $scope.newDhis2Event = {};
 
                 $scope.eventGridColumns.push({name: 'form_id', id: 'uid', valueType: 'string', compulsory: false, showFilter: false, show: false});
-                $scope.filterTypes['uid'] = 'string';                
+                $scope.filterTypes['uid'] = 'TEXT';                
 
                 $scope.eventGridColumns.push({name: $scope.selectedProgramStage.reportDateDescription ? $scope.selectedProgramStage.reportDateDescription : 'incident_date', id: 'event_date', type: 'date', compulsory: false, showFilter: false, show: true});
-                $scope.filterTypes['event_date'] = 'date';
+                $scope.filterTypes['event_date'] = 'DATE';
                 $scope.filterText['event_date']= {};
 
                 angular.forEach($scope.selectedProgramStage.programStageDataElements, function(prStDe){
@@ -181,11 +181,17 @@
 
                     //generate grid headers using program stage data elements
                     //create a template for new event
-                    //for date type dataelements, filtering is based on start and end dates                    
+                    //for date type dataelements, filtering is based on start and end dates
                     $scope.eventGridColumns.push({name: prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name, 
                                                   id: prStDe.dataElement.id, 
                                                   valueType: prStDe.dataElement.valueType, 
                                                   compulsory: prStDe.compulsory, 
+                                                  filterWithRange: prStDe.dataElement.valueType === 'DATE' || 
+                                                                        prStDe.dataElement.valueType === 'NUMBER' || 
+                                                                        prStDe.dataElement.valueType === 'INTEGER' || 
+                                                                        prStDe.dataElement.valueType === 'INTEGER_POSITIVE' || 
+                                                                        prStDe.dataElement.valueType === 'INTEGER_NEGATIVE' || 
+                                                                        prStDe.dataElement.valueType === 'INTEGER_ZERO_OR_POSITIVE' ? true : false,  
                                                   showFilter: false, 
                                                   show: prStDe.displayInReports});
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html	2015-08-25 14:54:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html	2015-09-03 14:55:07 +0000
@@ -51,10 +51,10 @@
 
                                     <!-- filter icon begins -->
                                     <span class='pull-right hideInPrint'>
-                                        <span ng-show="eventGridColumn.type !='date' && eventGridColumn.type !='int'">
+                                        <span ng-show="!eventGridColumn.filterWithRange">
                                             <a href ng-click="searchInGrid(eventGridColumn)" title="{{searchLabel}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [filterText[eventGridColumn.id] == undefined || filterText[eventGridColumn.id] == '']"><i class="fa fa-search"></i></span></a>
                                         </span>
-                                        <span ng-show="eventGridColumn.type ==='date' || eventGridColumn.type ==='int'">
+                                        <span ng-show="eventGridColumn.filterWithRange">
                                             <a href ng-click="searchInGrid(eventGridColumn)" title="{{searchLabel}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [(filterText[eventGridColumn.id].start == undefined || filterText[eventGridColumn.id].start == '') && (filterText[eventGridColumn.id].end == undefined || filterText[eventGridColumn.id].end == '')]"><i class="fa fa-search"></i></span></a>
                                         </span>                                                    
                                     </span>
@@ -62,10 +62,26 @@
 
                                     <!-- filter input field begins -->
                                     <span ng-show="eventGridColumn.showFilter">  
-                                        <span ng-switch="eventGridColumn.type">
-                                            <span ng-switch-when="int">
-                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" ng-model="filterText[eventGridColumn.id].start" ng-blur="searchInGrid(eventGridColumn)">
-                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" ng-model="filterText[eventGridColumn.id].end" ng-blur="searchInGrid(eventGridColumn)">
+                                        <span ng-switch="eventGridColumn.valueType">
+                                            <span ng-switch-when="NUMBER">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" ng-model="filterText[eventGridColumn.id].start" ng-blur="searchInGrid(eventGridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" ng-model="filterText[eventGridColumn.id].end" ng-blur="searchInGrid(eventGridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" ng-model="filterText[eventGridColumn.id].start" ng-blur="searchInGrid(eventGridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" ng-model="filterText[eventGridColumn.id].end" ng-blur="searchInGrid(eventGridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER_POSITIVE">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" min="1" ng-model="filterText[eventGridColumn.id].start" ng-blur="searchInGrid(eventGridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" min="1" ng-model="filterText[eventGridColumn.id].end" ng-blur="searchInGrid(eventGridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER_NEGATIVE">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" max="-1" ng-model="filterText[eventGridColumn.id].start" ng-blur="searchInGrid(eventGridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" max="-1" ng-model="filterText[eventGridColumn.id].end" ng-blur="searchInGrid(eventGridColumn)">
+                                            </span>
+                                            <span ng-switch-when="INTEGER_ZERO_OR_POSITIVE">
+                                                <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" min="0" ng-model="filterText[eventGridColumn.id].start" ng-blur="searchInGrid(eventGridColumn)">
+                                                <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" min="0" ng-model="filterText[eventGridColumn.id].end" ng-blur="searchInGrid(eventGridColumn)">
                                             </span>
                                             <span ng-switch-when="date">
                                                 <input style="width: 70%;" placeholder="{{'start_date' | translate}}" type="text" ng-model="filterText[eventGridColumn.id].start" d2-date readonly="readonly">
@@ -98,7 +114,7 @@
                                 <div d2-context-menu 
                                     ng-click="showEventList(dhis2Event)"
                                     ng-show="currentEvent.event !== dhis2Event.event && eventGridColumn.id !== 'comment'">                                    
-                                    <span ng-switch="eventGridColumn.type">
+                                    <span ng-switch="eventGridColumn.valueType">
                                         <span ng-switch-when="bool">
                                             <span ng-if="dhis2Event[eventGridColumn.id] == 'false'">{{noLabel}}</span>
                                             <span ng-if="dhis2Event[eventGridColumn.id] == 'true'">{{yesLabel}}</span>
@@ -171,7 +187,7 @@
                                                     </label>
                                                 </span> 
                                             </div>
-                                            <div ng-if="!prStDes[eventGridColumn.id].dataElement.optionSetValue" ng-switch="eventGridColumn.type">                                            
+                                            <div ng-if="!prStDes[eventGridColumn.id].dataElement.optionSetValue" ng-switch="eventGridColumn.valueType">                                            
                                                 <div ng-switch-when="int">
                                                     <input type="number"                                                            
                                                            d2-number-validator

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.filters.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.filters.js	2015-04-08 11:07:34 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.filters.js	2015-09-03 14:55:07 +0000
@@ -24,12 +24,16 @@
             
             for(var key in filters){
                 
-                if(filterTypes[key] === 'date'){
+                if(filterTypes[key] === 'DATE'){
                     if(filters[key].start || filters[key].end){
                         dateFilter[key] = filters[key];
                     }
                 }
-                else if(filterTypes[key] === 'int'){
+                else if(filterTypes[key] === 'NUMBER' || 
+                			filterTypes[key] === 'INTEGER' ||
+                			filterTypes[key] === 'INTEGER_POSITIVE' || 
+                			filterTypes[key] === 'INTEGER_NEGATIVE' || 
+                			filterTypes[key] === 'INTEGER_ZERO_OR_POSITIVE'){
                     if(filters[key].start || filters[key].end){
                         numberFilter[key] = filters[key];
                     }