dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40448
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20506: tracker associate value type input field
------------------------------------------------------------
revno: 20506
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-10-05 15:54:45 +0200
message:
tracker associate value type input field
modified:
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-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-25 13:33:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-10-05 13:54:45 +0000
@@ -489,6 +489,7 @@
var attMaxDate = trackedEntityFormAttributes[attId].allowFutureDate ? '' : 0;
var att = trackedEntityFormAttributes[attId];
+ var isTrackerAssociate = att.valueType === 'TRACKER_ASSOCIATE';
if (att) {
@@ -496,8 +497,8 @@
' element-id="' + i + '"' +
this.getAttributesAsString(attributes) +
' d2-focus-next-on-enter' +
- ' ng-model="selectedTei.' + attId + '" ' +
- ' ng-disabled="editingDisabled || isHidden(attributesById.' + attId + '.id)"' +
+ ' ng-model="selectedTei.' + attId + '" ' +
+ ' ng-disabled="editingDisabled || isHidden(attributesById.' + attId + '.id) || ' + isTrackerAssociate + '"' +
' d2-validation ' +
' ng-required=" ' + (att.mandatory || att.unique) + '" ';
@@ -514,13 +515,14 @@
}
else {
//check attribute type and generate corresponding angular input field
- if (att.valueType === "number") {
- newInputField = '<input type="number" ' +
+ if (att.valueType === "NUMBER" ) {
+ newInputField = '<input type="number" ' +
' d2-number-validator ' +
+ ' number-type="' + att.valueType + '" ' +
' ng-blur="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
commonInputFieldProperty + ' >';
}
- else if (att.valueType === "bool") {
+ else if (att.valueType === "BOOLEAN") {
newInputField = '<select ' +
' ng-change="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
commonInputFieldProperty + ' > ' +
@@ -529,7 +531,7 @@
' <option value="true">{{\'yes\'| translate}}</option>' +
'</select> ';
}
- else if (att.valueType === "date") {
+ else if (att.valueType === "DATE") {
newInputField = '<input type="text" ' +
' placeholder="{{dhis2CalendarFormat.keyDateFormat}}" ' +
' max-date="' + attMaxDate + '"' + '\'' +
@@ -537,16 +539,32 @@
' blur-or-change="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
commonInputFieldProperty + ' >';
}
- else if (att.valueType === "trueOnly") {
+ else if (att.valueType === "TRUE_ONLY") {
newInputField = '<input type="checkbox" ' +
' ng-change="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
commonInputFieldProperty + ' >';
}
- else if (att.valueType === "email") {
+ else if (att.valueType === "EMAIL") {
newInputField = '<input type="email" ' +
' ng-blur="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
commonInputFieldProperty + ' >';
}
+ else if (att.valueType === "TRACKER_ASSOCIATE") {
+ newInputField = '<input type="text" ' +
+ ' ng-blur="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
+ commonInputFieldProperty + ' >' +
+ '<a href ng-class="{true: \'disable-clicks\', false: \'\'} [editingDisabled]" ng-click="getTrackerAssociate(attributesById.' + attId + ')" title="{{\'add\' | translate}} {{attributesById.' + attId + '.name}}" ' +
+ '<i class="fa fa-external-link vertical-center"></i> ' +
+ '</a> ' +
+ '<a href ng-class="{true: \'disable-clicks\', false: \'\'} [editingDisabled]" ng-click="selectedTei.' + attId + ' = null" title="{{\'remove\' | translate}} {{attributesById.' + attId + '.name}}" ' +
+ '<i class="fa fa-trash-o vertical-center"></i> ' +
+ '</a>';
+ }
+ else if (att.valueType === "LONG_TEXT") {
+ newInputField = '<textarea row ="3" ' +
+ ' ng-blur="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +
+ commonInputFieldProperty + ' >';
+ }
else {
newInputField = '<input type="text" ' +
' ng-blur="teiValueUpdated(selectedTei,\'' + attId + '\')" ' +