← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20004: Updates to accomodate new valueType codes

 

------------------------------------------------------------
revno: 20004
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-09-06 20:14:06 +0200
message:
  Updates to accomodate new valueType codes
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.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/dataentry/table-entry-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html	2015-09-03 20:50:06 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html	2015-09-06 18:14:06 +0000
@@ -71,8 +71,8 @@
                             </span>
                         </div> 
                     </div>
-                    <div ng-if="!prStDe.dataElement.optionSetValue" ng-switch="prStDe.dataElement.type">
-                        <div ng-switch-when="int">
+                    <div ng-if="!prStDe.dataElement.optionSetValue" ng-switch="prStDe.dataElement.valueType">
+                        <div ng-switch-when="NUMBER">
                             <input type="number"                                   
                                    number-type={{prStDe.dataElement.numberType}}
                                    class="form-control"
@@ -83,8 +83,56 @@
                                    ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed" 
                                    ng-blur="saveDatavalue(prStDe, innerForm.foo)" 
                                    name="foo"/>
-                        </div>                        
-                        <div ng-switch-when="string">
+                        </div> 
+                        <div ng-switch-when="INTEGER">
+                            <input type="number"                                   
+                                   number-type={{prStDe.dataElement.valueType}}
+                                   class="form-control"
+                                   ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+                                   ng-model="eventRow[prStDe.dataElement.id]"                                    
+                                   d2-number-validator
+                                   ng-required={{prStDe.compulsory}}
+                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
+                                   ng-blur="saveDatavalue(prStDe, innerForm.foo)" 
+                                   name="foo"/>
+                        </div>
+                        <div ng-switch-when="INTEGER_POSITIVE">
+                            <input type="number"                                   
+                                   number-type={{prStDe.dataElement.valueType}}
+                                   class="form-control"
+                                   ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+                                   ng-model="eventRow[prStDe.dataElement.id]"                                    
+                                   d2-number-validator
+                                   ng-required={{prStDe.compulsory}}
+                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
+                                   ng-blur="saveDatavalue(prStDe, innerForm.foo)" 
+                                   name="foo"/>
+                        </div>
+                        <div ng-switch-when="INTEGER_NEGATIVE">
+                            <input type="number"                                   
+                                   number-type={{prStDe.dataElement.valueType}}
+                                   class="form-control"
+                                   ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+                                   ng-model="eventRow[prStDe.dataElement.id]"                                    
+                                   d2-number-validator
+                                   ng-required={{prStDe.compulsory}}
+                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
+                                   ng-blur="saveDatavalue(prStDe, innerForm.foo)" 
+                                   name="foo"/>
+                        </div>
+                        <div ng-switch-when="INTEGER_ZERO_OR_POSITIVE">
+                            <input type="number"                                   
+                                   number-type={{prStDe.dataElement.valueType}}
+                                   class="form-control"
+                                   ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+                                   ng-model="eventRow[prStDe.dataElement.id]"                                    
+                                   d2-number-validator
+                                   ng-required={{prStDe.compulsory}}
+                                   ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
+                                   ng-blur="saveDatavalue(prStDe, innerForm.foo)" 
+                                   name="foo"/>
+                        </div>
+                        <div ng-switch-when="TEXT">
                             <span ng-if="prStDe.dataElement.textType==='longText'">
                                 <textarea rows="3"
                                     ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
@@ -96,6 +144,8 @@
                                     name="foo">
                                 </textarea>
                             </span>
+                        </div>
+                        <div ng-switch-when="LONG_TEXT">
                             <span ng-if="prStDe.dataElement.textType!=='longText'">
                                 <input type="text"
                                     ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
@@ -107,7 +157,7 @@
                                     name="foo"/>                 
                             </span>                            
                         </div>
-                        <div ng-switch-when="bool">
+                        <div ng-switch-when="BOOLEAN">
                             <select ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
                                     class="form-control"
                                     ng-model="eventRow[prStDe.dataElement.id]" 
@@ -120,7 +170,7 @@
                                 <option value="true">{{'yes'| translate}}</option>
                             </select>
                         </div>
-                        <div ng-switch-when="date">
+                        <div ng-switch-when="DATE">
                             <input type="text" 
                                    placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
                                    d2-date
@@ -134,7 +184,7 @@
                                    blur-or-change="saveDatavalue(prStDe, innerForm.foo)"
                                    name="foo"/>
                         </div>
-                        <div ng-switch-when="trueOnly">
+                        <div ng-switch-when="TRUE_ONLY">
                             <input type="checkbox"     
                                    class="form-control"
                                    ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
@@ -167,8 +217,8 @@
                     </div>
                 </ng-form>
                 <ng-form ng-if="eventRow !== currentEvent" name="innerform" >
-                    <div ng-switch="prStDe.dataElement.type">
-                         <div ng-switch-when="bool">
+                    <div ng-switch="prStDe.dataElement.valueType">
+                         <div ng-switch-when="BOOLEAN">
                             <select ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
                                     class="form-control"
                                     ng-model="eventRow[prStDe.dataElement.id]" 
@@ -181,7 +231,7 @@
                                 <option value="true">{{'yes'| translate}}</option>
                             </select>
                         </div>
-                        <div ng-switch-when="trueOnly">
+                        <div ng-switch-when="TRUE_ONLY">
                             <input type="checkbox"     
                                    class="form-control"
                                    ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-09-03 14:22:27 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-09-06 18:14:06 +0000
@@ -802,7 +802,7 @@
         variableValue = $filter('trimquotes')(variableValue);
 
         //Append single quotation marks in case the variable is of text or date type:
-        if(variableType === 'TEXT' || variableType === 'DATE' || variableType === 'OPTION_SET') {
+        if(variableType === 'LONG_TEXT' || variableType === 'TEXT' || variableType === 'DATE' || variableType === 'OPTION_SET') {
             if(variableValue) {
                 variableValue = "'" + variableValue + "'";
             } else {
@@ -818,7 +818,7 @@
                 variableValue = false;
             }
         }
-        else if(variableType === "INTEGER" || variableType === "NUMBER" || variableType === "INTEGER_POSITIVE" || variableType === "INTEGER_NEGATIVE" || variableType === "INTEGER_ZERO_OR_POSITIVE") {
+        else if(variableType === "INTEGER" || variableType === "NUMBER" || variableType === "INTEGER_POSITIVE" || variableType === "INTEGER_NEGATIVE" || variableType === "INTEGER_ZERO_OR_POSITIVE" || variableType === "PERCENTAGE") {
             if(variableValue) {
                 variableValue = Number(variableValue);
             } else {