← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19973: event-capture: now complete for type->valueType change.

 

------------------------------------------------------------
revno: 19973
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-03 17:33:49 +0200
message:
  event-capture: now complete for type->valueType change.
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


--
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 14:55:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-09-03 15:33:49 +0000
@@ -168,10 +168,10 @@
                 $scope.filterTypes = {};                               
                 $scope.newDhis2Event = {};
 
-                $scope.eventGridColumns.push({name: 'form_id', id: 'uid', valueType: 'string', compulsory: false, showFilter: false, show: false});
+                $scope.eventGridColumns.push({name: 'form_id', id: 'uid', valueType: 'TEXT', compulsory: false, filterWithRange: false, showFilter: false, show: false});
                 $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.eventGridColumns.push({name: $scope.selectedProgramStage.reportDateDescription ? $scope.selectedProgramStage.reportDateDescription : 'incident_date', id: 'event_date', valueType: 'DATE', filterWithRange: true, compulsory: false, showFilter: false, show: true});
                 $scope.filterTypes['event_date'] = 'DATE';
                 $scope.filterText['event_date']= {};
 
@@ -289,11 +289,11 @@
                     }
 
                     if($scope.noteExists && !GridColumnService.columnExists($scope.eventGridColumns, 'comment')){
-                        $scope.eventGridColumns.push({name: 'comment', id: 'comment', type: 'string', compulsory: false, showFilter: false, show: true});
+                        $scope.eventGridColumns.push({name: 'comment', id: 'comment', type: 'TEXT', filterWithRange: false, compulsory: false, showFilter: false, show: true});
                     }
                     
                     if(!$scope.sortHeader.id){
-                        $scope.sortEventGrid({name: $scope.selectedProgramStage.reportDateDescription ? $scope.selectedProgramStage.reportDateDescription : 'incident_date', id: 'event_date', type: 'date', compulsory: false, showFilter: false, show: true});
+                        $scope.sortEventGrid({name: $scope.selectedProgramStage.reportDateDescription ? $scope.selectedProgramStage.reportDateDescription : 'incident_date', id: 'event_date', type: 'DATE', compulsory: false, showFilter: false, show: true});
                     }
                 }
                 
@@ -399,8 +399,8 @@
         
         if($scope.formHasUnsavedData()){
             var modalOptions = {
-                closeButtonText: 'cancel',
-                actionButtonText: 'proceed',
+                closeButtonText: 'no',
+                actionButtonText: 'yes',
                 headerText: 'warning',
                 bodyText: 'unsaved_data_exists_proceed'
             };

=== 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-09-03 14:55:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html	2015-09-03 15:33:49 +0000
@@ -54,15 +54,15 @@
                                         <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.filterWithRange">
+                                        <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>
                                     <!-- filter icon ends -->
-
+                                    
                                     <!-- filter input field begins -->
-                                    <span ng-show="eventGridColumn.showFilter">  
-                                        <span ng-switch="eventGridColumn.valueType">
+                                    <span ng-show="eventGridColumn.showFilter">                                          
+                                        <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)">
@@ -83,13 +83,13 @@
                                                 <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">
+                                            <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">
-                                                <span ng-hide="filterText[eventGridColumn.id].start == undefined || filterText[eventGridColumn.id].start == ''">
+                                                <span ng-hide="!filterText[eventGridColumn.id].start || filterText[eventGridColumn.id].start == undefined || filterText[eventGridColumn.id].start == ''">
                                                     <a href ng-click='removeStartFilterText(eventGridColumn.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[eventGridColumn.id].end" d2-date readonly="readonly">
-                                                <span ng-hide="filterText[eventGridColumn.id].end == undefined || filterText[eventGridColumn.id].end == ''">
+                                                <span ng-hide="!filterText[eventGridColumn.id].end || filterText[eventGridColumn.id].end == undefined || filterText[eventGridColumn.id].end == ''">
                                                     <a href ng-click='removeEndFilterText(eventGridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>                                                        
                                                 </span> 
                                             </span>
@@ -115,7 +115,7 @@
                                     ng-click="showEventList(dhis2Event)"
                                     ng-show="currentEvent.event !== dhis2Event.event && eventGridColumn.id !== 'comment'">                                    
                                     <span ng-switch="eventGridColumn.valueType">
-                                        <span ng-switch-when="bool">
+                                        <span ng-switch-when="BOOLEAN">
                                             <span ng-if="dhis2Event[eventGridColumn.id] == 'false'">{{noLabel}}</span>
                                             <span ng-if="dhis2Event[eventGridColumn.id] == 'true'">{{yesLabel}}</span>
                                         </span>
@@ -129,8 +129,7 @@
                                         </span>
                                     </span>
                                 </div>
-                                <!-- Visible when event is not under editing -->
-                                
+                                <!-- Visible when event is not under editing -->                                
                                 
                                 <!-- Visible when event is under editing in grid -->
                                 <div style="cursor:default;"
@@ -151,7 +150,7 @@
                                                                ng-required={{eventGridColumn.compulsory}}
                                                                name="foo" 
                                                                d2-option-validator
-                                                               on-select={{updateEventDataValue(dhis2Event,eventGridColumn.id)}} 
+                                                               on-select="updateEventDataValue(dhis2Event,eventGridColumn.id)" 
                                                                on-remove="validateOptionOnRemove(eventGridColumn.compulsory)"
                                                                input-field-id={{eventGridColumn.id}}
                                                                style="width:100%;"
@@ -188,22 +187,73 @@
                                                 </span> 
                                             </div>
                                             <div ng-if="!prStDes[eventGridColumn.id].dataElement.optionSetValue" ng-switch="eventGridColumn.valueType">                                            
-                                                <div ng-switch-when="int">
-                                                    <input type="number"                                                            
-                                                           d2-number-validator
-                                                           number-type={{prStDes[eventGridColumn.id].dataElement.numberType}}
-                                                           ng-model="currentEvent[eventGridColumn.id]" 
-                                                           ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
-                                                           ng-required={{eventGridColumn.compulsory}}
-                                                           input-field-id={{eventGridColumn.id}} 
-                                                           name="foo" 
-                                                           class="form-control"
-                                                           ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
-                                                           ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"/>
-                                                </div>
-                                                <div ng-switch-when="string">                                        
-                                                    <div ng-if="eventGridColumn.textType==='longText'">
-                                                        <textarea rows="3"
+                                                <div ng-switch-when="NUMBER">
+                                                    <input type="number"                                                            
+                                                           d2-number-validator
+                                                           number-type={{prStDes[eventGridColumn.id].dataElement.numberType}}
+                                                           ng-model="currentEvent[eventGridColumn.id]" 
+                                                           ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
+                                                           ng-required={{eventGridColumn.compulsory}}
+                                                           input-field-id={{eventGridColumn.id}} 
+                                                           name="foo" 
+                                                           class="form-control"
+                                                           ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+                                                           ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"/>
+                                                </div>
+                                                <div ng-switch-when="INTEGER">
+                                                    <input type="number"                                                            
+                                                           d2-number-validator
+                                                           number-type={{prStDes[eventGridColumn.id].dataElement.numberType}}
+                                                           ng-model="currentEvent[eventGridColumn.id]" 
+                                                           ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
+                                                           ng-required={{eventGridColumn.compulsory}}
+                                                           input-field-id={{eventGridColumn.id}} 
+                                                           name="foo" 
+                                                           class="form-control"
+                                                           ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+                                                           ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"/>
+                                                </div>
+                                                <div ng-switch-when="INTEGER_POSITIVE">
+                                                    <input type="number"                                                            
+                                                           d2-number-validator
+                                                           number-type={{prStDes[eventGridColumn.id].dataElement.numberType}}
+                                                           ng-model="currentEvent[eventGridColumn.id]" 
+                                                           ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
+                                                           ng-required={{eventGridColumn.compulsory}}
+                                                           input-field-id={{eventGridColumn.id}} 
+                                                           name="foo" 
+                                                           class="form-control"
+                                                           ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+                                                           ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"/>
+                                                </div>
+                                                <div ng-switch-when="INTEGER_NEGATIVE">
+                                                    <input type="number"                                                            
+                                                           d2-number-validator
+                                                           number-type={{prStDes[eventGridColumn.id].dataElement.numberType}}
+                                                           ng-model="currentEvent[eventGridColumn.id]" 
+                                                           ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
+                                                           ng-required={{eventGridColumn.compulsory}}
+                                                           input-field-id={{eventGridColumn.id}} 
+                                                           name="foo" 
+                                                           class="form-control"
+                                                           ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+                                                           ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"/>
+                                                </div>
+                                                <div ng-switch-when="INTEGER_ZERO_OR_POSITIVE">
+                                                    <input type="number"                                                            
+                                                           d2-number-validator
+                                                           number-type={{prStDes[eventGridColumn.id].dataElement.numberType}}
+                                                           ng-model="currentEvent[eventGridColumn.id]" 
+                                                           ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
+                                                           ng-required={{eventGridColumn.compulsory}}
+                                                           input-field-id={{eventGridColumn.id}} 
+                                                           name="foo" 
+                                                           class="form-control"
+                                                           ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+                                                           ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"/>
+                                                </div>
+                                                <div ng-switch-when="LONG_TEXT">                                        
+                                                    <textarea rows="3"
                                                             ng-model="currentEvent[eventGridColumn.id]"                                        
                                                             ng-required={{eventGridColumn.compulsory}}
                                                             ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
@@ -213,17 +263,16 @@
                                                             ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
                                                             class="form-control">
                                                         </textarea>
-                                                    </div>
-                                                    <div ng-if="eventGridColumn.textType!=='longText'">
-                                                        <input type="text"
+                                                </div>
+                                                <div ng-switch-when="TEXT">
+                                                    <input type="text"
                                                                ng-model="currentEvent[eventGridColumn.id]" 
                                                                ng-required={{eventGridColumn.compulsory}}
                                                                ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
                                                                name="foo" 
-                                                               class="form-control"/>
-                                                    </div>                                                    
+                                                               class="form-control"/>                                                    
                                                 </div>                                        
-                                                <div ng-switch-when="bool">
+                                                <div ng-switch-when="BOOLEAN">
                                                     <select ng-model="currentEvent[eventGridColumn.id]" 
                                                             ng-change="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
                                                             ng-required={{eventGridColumn.compulsory}}
@@ -237,23 +286,39 @@
                                                         <option value="true">{{yesLabel}}</option>
                                                     </select>
                                                 </div>
-                                                <div ng-switch-when="date">
-                                                    <input type="text" 
-                                                           placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
-                                                           d2-date
-                                                           max-date="prStDes[eventGridColumn.id].allowFutureDate ? '' : 0" 
-                                                           d2-date-validator
-                                                           ng-model="currentEvent[eventGridColumn.id]"
-                                                           blur-or-change="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
-                                                           ng-required={{eventGridColumn.compulsory}}
-                                                           ng-disabled="eventGridColumn.id == 'event_date'"
-                                                           input-field-id={{eventGridColumn.id}}                                                            
-                                                           style="width:98%;"
-                                                           ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
-                                                           ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
-                                                           name="foo"/>
-                                                </div>
-                                                <div ng-switch-when="trueOnly">
+                                                <div ng-switch-when="DATE">
+                                                    <input type="text" 
+                                                           placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+                                                           d2-date
+                                                           max-date="prStDes[eventGridColumn.id].allowFutureDate ? '' : 0" 
+                                                           d2-date-validator
+                                                           ng-model="currentEvent[eventGridColumn.id]"
+                                                           blur-or-change="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
+                                                           ng-required={{eventGridColumn.compulsory}}
+                                                           ng-disabled="eventGridColumn.id == 'event_date'"
+                                                           input-field-id={{eventGridColumn.id}}                                                            
+                                                           style="width:98%;"
+                                                           ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+                                                           ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+                                                           name="foo"/>
+                                                </div>
+                                                <div ng-switch-when="DATETIME">
+                                                    <input type="text" 
+                                                           placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+                                                           d2-date
+                                                           max-date="prStDes[eventGridColumn.id].allowFutureDate ? '' : 0" 
+                                                           d2-date-validator
+                                                           ng-model="currentEvent[eventGridColumn.id]"
+                                                           blur-or-change="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
+                                                           ng-required={{eventGridColumn.compulsory}}
+                                                           ng-disabled="eventGridColumn.id == 'event_date'"
+                                                           input-field-id={{eventGridColumn.id}}                                                            
+                                                           style="width:98%;"
+                                                           ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+                                                           ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+                                                           name="foo"/>
+                                                </div>
+                                                <div ng-switch-when="TRUE_ONLY">
                                                     <input type="checkbox"
                                                            d2-validation 
                                                            ng-model="currentEvent[eventGridColumn.id]"
@@ -264,6 +329,14 @@
                                                            ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
                                                            name="foo"/>
                                                 </div>
+                                                <div ng-switch-default>
+                                                    <input type="text"
+                                                               ng-model="currentEvent[eventGridColumn.id]" 
+                                                               ng-required={{eventGridColumn.compulsory}}
+                                                               ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)" 
+                                                               name="foo" 
+                                                               class="form-control"/>                                                    
+                                                </div>
                                                 <div ng-messages="innerFormGrid.foo.$error" ng-if="interacted(innerFormGrid.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
                                                 </div>
                                             </div>