dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33653
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17215: minor
------------------------------------------------------------
revno: 17215
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-10-22 17:36:30 +0200
message:
minor
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/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/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-10-22 15:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-10-22 15:36:30 +0000
@@ -337,10 +337,11 @@
$scope.saveDatavalue = function(prStDe){
+ $scope.currentElement = {id: prStDe.dataElement.id, saved: false};
+
//check for input validity
$scope.dataEntryOuterForm.submitted = true;
- if( $scope.dataEntryOuterForm.$invalid ){
- $scope.currentElement = {id: prStDe.dataElement.id, saved: false};
+ if( $scope.dataEntryOuterForm.$invalid ){
return false;
}
@@ -374,7 +375,7 @@
]
};
DHIS2EventFactory.updateForSingleValue(ev).then(function(response){
- $scope.currentElement = {id: prStDe.dataElement.id, saved: true};
+ $scope.currentElement.saved = true;
});
}
}
=== 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 2014-10-22 15:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-10-22 15:36:30 +0000
@@ -820,7 +820,7 @@
var attributes = {};
$(inputElement[0].attributes).each(function() {
- attributes[this.nodeName] = this.nodeValue;
+ attributes[this.nodeName] = this.value;
});
var deId = '', newInputField;
@@ -832,30 +832,44 @@
attributes['name'] = deId;
}
+ var maxDate = programStageDataElements[deId].allowFutureDate ? '' : 0;
//check data element type and generate corresponding angular input field
if(programStageDataElements[deId].dataElement.type == "int"){
newInputField = '<input type="number" ' +
this.getAttributesAsString(attributes) +
' ng-model="currentEvent.' + deId + '"' +
- ' ng-class="getInputNotifcationClass(' + deId + ',true)"' +
+ ' ng-class="getInputNotifcationClass(programStageDataElements.' + deId + '.dataElement.id,true)"' +
' ng-blur="saveDatavalue(programStageDataElements.'+ deId + ')"' +
' ng-required="programStageDataElements.' + deId + '.compulsory">';
}
if(programStageDataElements[deId].dataElement.type == "string"){
- newInputField = '<input type="text" ' +
+ if(programStageDataElements[deId].dataElement.optionSet){
+ var optionSetId = programStageDataElements[deId].dataElement.optionSet.id;
+ newInputField = '<input type="text" ' +
this.getAttributesAsString(attributes) +
' ng-model="currentEvent.' + deId + '" ' +
- ' ng-class="getInputNotifcationClass(' + deId + ',true)"' +
+ ' ng-class="getInputNotifcationClass(programStageDataElements.' + deId + '.dataElement.id,true)"' +
' ng-required="programStageDataElements.' + deId + '.compulsory"' +
- ' ng-blur="saveDatavalue(programStageDataElements.'+ deId + ')"' +
- ' typeahead="option.code as option.name for option in programStageDataElements.'+deId+'.dataElement.optionSet.options | filter:$viewValue | limitTo:20"' +
+ ' ng-blur="saveDatavalue(programStageDataElements.'+ deId + ')"' +
+ ' typeahead-editable="false" ' +
+ ' typeahead="option.name as option.name for option in optionSets.optionSets.'+optionSetId+'.options | filter:$viewValue | limitTo:20"' +
' typeahead-open-on-focus ng-required="programStageDataElements.'+deId+'.compulsory">';
+ }
+ else{
+ newInputField = '<input type="text" ' +
+ this.getAttributesAsString(attributes) +
+ ' ng-model="currentEvent.' + deId + '" ' +
+ ' ng-class="getInputNotifcationClass(programStageDataElements.' + deId + '.dataElement.id,true)"' +
+ ' ng-required="programStageDataElements.' + deId + '.compulsory"' +
+ ' ng-blur="saveDatavalue(programStageDataElements.'+ deId + ')"' +
+ ' ng-required="programStageDataElements.'+deId+'.compulsory">';
+ }
}
if(programStageDataElements[deId].dataElement.type == "bool"){
newInputField = '<select ' +
this.getAttributesAsString(attributes) +
' ng-model="currentEvent.' + deId + '" ' +
- ' ng-class="getInputNotifcationClass(' + deId + ',true)"' +
+ ' ng-class="getInputNotifcationClass(programStageDataElements.' + deId + '.dataElement.id,true)"' +
' ng-change="saveDatavalue(programStageDataElements.'+ deId + ')"' +
' ng-required="programStageDataElements.' + deId + '.compulsory">' +
'<option value="">{{\'please_select\'| translate}}</option>' +
@@ -867,8 +881,9 @@
newInputField = '<input type="text" ' +
this.getAttributesAsString(attributes) +
' ng-model="currentEvent.' + deId + '"' +
- ' ng-class="getInputNotifcationClass(' + deId + ',true)"' +
+ ' ng-class="getInputNotifcationClass(programStageDataElements.' + deId + '.dataElement.id,true)"' +
' d2-date' +
+ ' max-date="' + maxDate + '"' + '\'' +
' blur-or-change="saveDatavalue(programStageDataElements.'+ deId + ')"' +
' ng-required="programStageDataElements.' + deId + '.compulsory">';
}
@@ -876,7 +891,7 @@
newInputField = '<input type="checkbox" ' +
this.getAttributesAsString(attributes) +
' ng-model="currentEvent.' + deId + '"' +
- ' ng-class="getInputNotifcationClass(' + deId + ',true)"' +
+ ' ng-class="getInputNotifcationClass(programStageDataElements.' + deId + '.dataElement.id,true)"' +
' ng-change="saveDatavalue(programStageDataElements.'+ deId + ')"' +
' ng-required="programStageDataElements.' + deId + '.compulsory">';
}
@@ -1117,7 +1132,6 @@
};
})
-
/*this is just a hack - there should be better way */
.service('ValidDate', function(){
var dateValidation;