dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39456
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19975: tracker-capture: type->valueType - WIP
------------------------------------------------------------
revno: 19975
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-03 18:09:29 +0200
message:
tracker-capture: type->valueType - WIP
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html
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/services.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.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/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2015-08-24 10:22:35 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2015-09-03 16:09:29 +0000
@@ -66,10 +66,58 @@
</span>
</div>
</div>
- <div ng-if="!prStDe.dataElement.optionSetValue" ng-switch="prStDe.dataElement.type">
- <div ng-switch-when="int">
- <input type="number"
- number-type={{prStDe.dataElement.numberType}}
+ <div ng-if="!prStDe.dataElement.optionSetValue" ng-switch="prStDe.dataElement.valueType">
+ <div ng-switch-when="NUMBER">
+ <input type="number"
+ number-type={{prStDe.dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="currentEvent[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">
+ <input type="number"
+ number-type={{prStDe.dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="currentEvent[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="currentEvent[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="currentEvent[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="currentEvent[prStDe.dataElement.id]"
@@ -79,30 +127,28 @@
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
- <div ng-switch-when="string">
- <span ng-if="prStDe.dataElement.textType==='longText'">
- <textarea rows="3"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- class="form-control"
- ng-model="currentEvent[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
- ng-blur="saveDatavalue(prStDe, innerForm.foo)"
- name="foo">
- </textarea>
- </span>
- <span ng-if="prStDe.dataElement.textType!=='longText'">
- <input type="text"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- class="form-control"
- ng-model="currentEvent[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
- ng-blur="saveDatavalue(prStDe, innerForm.foo)"
- name="foo"/>
- </span>
- </div>
- <div ng-switch-when="bool">
+ <div ng-switch-when="LONG_TEXT">
+ <textarea rows="3"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ class="form-control"
+ ng-model="currentEvent[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDe, innerForm.foo)"
+ name="foo">
+ </textarea>
+ </div>
+ <div ng-switch-when="TEXT">
+ <input type="text"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ class="form-control"
+ ng-model="currentEvent[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDe, innerForm.foo)"
+ name="foo"/>
+ </div>
+ <div ng-switch-when="BOOLEAN">
<select ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
class="form-control"
ng-model="currentEvent[prStDe.dataElement.id]"
@@ -115,7 +161,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
@@ -129,7 +175,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)'
@@ -141,7 +187,7 @@
</div>
<div ng-switch-default>
<input type="text"
- class="form-control"
+ class="form-control"
ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
@@ -244,20 +290,68 @@
</span>
</div>
</div>
- <div ng-if="!prStDes[de.dataElement.id].dataElement.optionSetValue" ng-switch="prStDes[de.dataElement.id].dataElement.type">
- <div ng-switch-when="int">
- <input type="number"
- d2-number-validator
- number-type={{prStDe.dataElement.numberType}}
- class="form-control"
- ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
- ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
- ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
- name="foo"/>
- </div>
- <div ng-switch-when="bool">
+ <div ng-if="!prStDes[de.dataElement.id].dataElement.optionSetValue" ng-switch="prStDes[de.dataElement.id].dataElement.valueType">
+ <div ng-switch-when="NUMBER">
+ <input type="number"
+ d2-number-validator
+ number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
+ ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
+ name="foo"/>
+ </div>
+ <div ng-switch-when="INTEGER">
+ <input type="number"
+ d2-number-validator
+ number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
+ ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
+ name="foo"/>
+ </div>
+ <div ng-switch-when="INTEGER_POSITIVE">
+ <input type="number"
+ d2-number-validator
+ number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
+ ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
+ name="foo"/>
+ </div>
+ <div ng-switch-when="INTEGER_NEGATIVE">
+ <input type="number"
+ d2-number-validator
+ number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
+ ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
+ name="foo"/>
+ </div>
+ <div ng-switch-when="INTEGER_ZERO_OR_POSITIVE">
+ <input type="number"
+ d2-number-validator
+ number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
+ class="form-control"
+ ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
+ ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
+ name="foo"/>
+ </div>
+ <div ng-switch-when="BOOLEAN">
<select class="form-control"
ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
@@ -270,7 +364,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
@@ -284,7 +378,7 @@
blur-or-change="saveDatavalue(prStDes[de.dataElement.id])"
name="foo"/>
</div>
- <div ng-switch-when="trueOnly">
+ <div ng-switch-when="TRUE_ONLY">
<input type="checkbox"
class="form-control"
ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
@@ -294,9 +388,8 @@
ng-change="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
- <div ng-switch-when="string">
- <span ng-if="prStDes[de.dataElement.id].dataElement.textType==='longText'">
- <textarea rows="3"
+ <div ng-switch-when="LONG_TEXT">
+ <textarea rows="3"
class="form-control"
ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
@@ -304,18 +397,17 @@
ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo">
- </textarea>
- </span>
- <span ng-if="prStDes[de.dataElement.id].dataElement.textType!=='longText'">
- <input type="text"
+ </textarea>
+ </div>
+ <div ng-switch-when="TEXT">
+ <input type="text"
class="form-control"
ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
- name="foo"/>
- </span>
+ name="foo"/>
</div>
<div ng-switch-default>
<input type="text"
=== 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-09-03 15:45:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2015-09-03 16:09:29 +0000
@@ -17,7 +17,6 @@
SessionStorageService,
MetaDataFactory,
DateUtils,
- OptionSetService,
OrgUnitFactory,
OperatorFactory,
ProgramFactory,
=== 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-09-03 13:13:08 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-09-03 16:09:29 +0000
@@ -545,7 +545,7 @@
var att = attributesById[key];
var operator = '';
if(vc.property && vc.value && att && att.valueType){
- if(att.valueType === 'number' && dhis2.validation.isNumber(vc.value)){
+ if(att.valueType === 'NUMBER' && dhis2.validation.isNumber(vc.value)){
vc.value = parseInt(vc.value);
}
if(vc.operator === 0){
@@ -574,7 +574,7 @@
for(var k in attributesById){
if( formTei[k] ){
var att = attributesById[k];
- tei.attributes.push({attribute: att.id, value: formTei[k], displayName: att.name, type: att.valueType});
+ tei.attributes.push({attribute: att.id, value: formTei[k], displayName: att.name, valueType: att.valueType});
formEmpty = false;
}
delete tei[k];
@@ -925,7 +925,7 @@
if(att.valueType){
type = att.valueType;
}
- if(type === 'trueOnly'){
+ if(type === 'TRUE_ONLY'){
if(destination === 'USER'){
val = val === 'true' ? true : '';
}
@@ -935,7 +935,7 @@
}
else{
if(val){
- if( type === 'number' ){
+ if( type === 'NUMBER' ){
if(dhis2.validation.isNumber(val)){
//val = new Number(val);
val = parseInt(val);
@@ -945,7 +945,7 @@
val = parseInt('0');
}
}
- if(type === 'date'){
+ if(type === 'DATE'){
if(destination === 'USER'){
val = DateUtils.formatFromApiToUser(val);
}
@@ -1250,13 +1250,13 @@
angular.forEach(attributes, function(attribute){
- if(attribute.valueType === 'date' || attribute.valueType === 'number'){
+ if(attribute.valueType === 'DATE' || attribute.valueType === 'NUMBER'){
var q = '';
if(attribute.operator === OperatorFactory.defaultOperators[0]){
if(attribute.exactValue && attribute.exactValue !== ''){
query.hasValue = true;
- if(attribute.valueType === 'date'){
+ if(attribute.valueType === 'DATE'){
attribute.exactValue = DateUtils.formatFromUserToApi(attribute.exactValue);
}
q += 'EQ:' + attribute.exactValue + ':';
@@ -1265,14 +1265,14 @@
if(attribute.operator === OperatorFactory.defaultOperators[1]){
if(attribute.startValue && attribute.startValue !== ''){
query.hasValue = true;
- if(attribute.valueType === 'date'){
+ if(attribute.valueType === 'DATE'){
attribute.startValue = DateUtils.formatFromUserToApi(attribute.startValue);
}
q += 'GT:' + attribute.startValue + ':';
}
if(attribute.endValue && attribute.endValue !== ''){
query.hasValue = true;
- if(attribute.valueType === 'date'){
+ if(attribute.valueType === 'DATE'){
attribute.endValue = DateUtils.formatFromUserToApi(attribute.endValue);
}
q += 'LT:' + attribute.endValue + ':';
@@ -1515,9 +1515,9 @@
var columns = attributes ? angular.copy(attributes) : [];
//also add extra columns which are not part of attributes (orgunit for example)
- columns.push({id: 'orgUnitName', name: $translate.instant('registering_unit'), valueType: 'string', displayInListNoProgram: false});
- columns.push({id: 'created', name: $translate.instant('registration_date'), valueType: 'date', displayInListNoProgram: false});
- columns.push({id: 'inactive', name: $translate.instant('inactive'), valueType: 'boolean', displayInListNoProgram: false});
+ columns.push({id: 'orgUnitName', name: $translate.instant('registering_unit'), valueType: 'TEXT', displayInListNoProgram: false});
+ columns.push({id: 'created', name: $translate.instant('registration_date'), valueType: 'DATE', displayInListNoProgram: false});
+ columns.push({id: 'inactive', name: $translate.instant('inactive'), valueType: 'BOOLEAN', displayInListNoProgram: false});
//generate grid column for the selected program/attributes
angular.forEach(columns, function(column){
@@ -1529,7 +1529,7 @@
}
column.showFilter = false;
filterTypes[column.id] = column.valueType;
- if(column.valueType === 'date' || column.valueType === 'number' ){
+ if(column.valueType === 'DATE' || column.valueType === 'NUMBER' ){
filterText[column.id]= {};
}
});
@@ -1560,7 +1560,7 @@
};
})
-.service('EventUtils', function(DateUtils, CommonUtils, PeriodService, CalendarService, OptionSetService, $filter, orderByFilter){
+.service('EventUtils', function(DateUtils, CommonUtils, PeriodService, CalendarService, $filter, orderByFilter){
var getEventDueDate = function(eventsByStage, programStage, enrollment){
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-08-26 19:49:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-09-03 16:09:29 +0000
@@ -337,7 +337,7 @@
var p = d.promise();
dhis2.tc.store.get('programStages', programStage.id).done(function(obj) {
if(!obj || obj.version !== programStage.version) {
- promise = promise.then( getD2Object( programStage.id, 'programStages', '../api/programStages', 'fields=id,name,sortOrder,version,dataEntryForm,captureCoordinates,blockEntryForm,autoGenerateEvent,allowGenerateNextVisit,generatedByEnrollmentDate,remindCompleted,reportDateDescription,minDaysFromStart,repeatable,openAfterEnrollment,standardInterval,periodType,reportDateToUse,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,code,name,description,formName,type,numberType,textType,optionSetValue,optionSet[id]]]', 'idb' ) );
+ promise = promise.then( getD2Object( programStage.id, 'programStages', '../api/programStages', 'fields=id,name,sortOrder,version,dataEntryForm,captureCoordinates,blockEntryForm,autoGenerateEvent,allowGenerateNextVisit,generatedByEnrollmentDate,remindCompleted,reportDateDescription,minDaysFromStart,repeatable,openAfterEnrollment,standardInterval,periodType,reportDateToUse,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,code,name,description,formName,valueType,optionSetValue,optionSet[id]]]', 'idb' ) );
}
d.resolve();
});