dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39436
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19963: event-capture: type -> valueType - WIP
------------------------------------------------------------
revno: 19963
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-03 12:36:07 +0200
message:
event-capture: type -> valueType - WIP
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/scripts/event-capture.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.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-08-25 14:54:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-09-03 10:36:07 +0000
@@ -168,7 +168,7 @@
$scope.filterTypes = {};
$scope.newDhis2Event = {};
- $scope.eventGridColumns.push({name: 'form_id', id: 'uid', type: 'string', compulsory: false, showFilter: false, show: false});
+ $scope.eventGridColumns.push({name: 'form_id', id: 'uid', valueType: 'string', compulsory: false, showFilter: false, show: false});
$scope.filterTypes['uid'] = 'string';
$scope.eventGridColumns.push({name: $scope.selectedProgramStage.reportDateDescription ? $scope.selectedProgramStage.reportDateDescription : 'incident_date', id: 'event_date', type: 'date', compulsory: false, showFilter: false, show: true});
@@ -184,7 +184,7 @@
//for date type dataelements, filtering is based on start and end dates
$scope.eventGridColumns.push({name: prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name,
id: prStDe.dataElement.id,
- type: prStDe.dataElement.type,
+ valueType: prStDe.dataElement.valueType,
compulsory: prStDe.compulsory,
showFilter: false,
show: prStDe.displayInReports});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2015-08-26 19:49:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2015-09-03 10:36:07 +0000
@@ -32,7 +32,7 @@
dhis2.ec.store = new dhis2.storage.Store({
name: 'dhis2ec',
adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
- objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events', 'programValidations', 'programRules', 'programRuleVariables', 'programIndicators', 'ouLevels', 'constants']
+ objectStores: ['programs', 'programStages', 'categories', 'categoryOptions', 'geoJsons', 'optionSets', 'events', 'programValidations', 'programRules', 'programRuleVariables', 'programIndicators', 'ouLevels', 'constants']
});
(function($) {
@@ -151,6 +151,8 @@
promise = promise.then( getMetaPrograms );
promise = promise.then( getPrograms );
promise = promise.then( getProgramStages );
+ promise = promise.then( getCategories );
+ promise = promise.then( getCategoryOptions );
promise = promise.then( getMetaProgramValidations );
promise = promise.then( getProgramValidations );
promise = promise.then( getMetaProgramIndicators );
@@ -243,7 +245,7 @@
$.ajax({
url: '../api/programs.json',
type: 'GET',
- data:'filter=programType:eq:WITHOUT_REGISTRATION&paging=false&fields=id,name,version,programStages[id,version,programStageSections[id],programStageDataElements[dataElement[id,optionSet[id,version]]]]'
+ data:'filter=programType:eq:WITHOUT_REGISTRATION&paging=false&fields=id,name,version,categoryCombo[id,categories[id,categoryOptions[id]]],programStages[id,version,programStageSections[id],programStageDataElements[dataElement[id,optionSet[id,version]]]]'
}).done( function(response) {
def.resolve( response.programs ? response.programs: [] );
}).fail(function(){
@@ -350,7 +352,100 @@
var p = d.promise();
dhis2.ec.store.get('programStages', program.programStages[0].id).done(function(obj) {
if(!obj || obj.version !== program.programStages[0].version) {
- promise = promise.then( getD2Object( program.programStages[0].id, 'programStages', '../api/programStages', 'fields=id,name,version,description,reportDateDescription,captureCoordinates,dataEntryForm,minDaysFromStart,repeatable,preGenerateUID,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,sortOrder,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,name,type,optionSetValue,numberType,textType,formName,optionSet[id]]]', 'idb' ) );
+ promise = promise.then( getD2Object( program.programStages[0].id, 'programStages', '../api/programStages', 'fields=id,name,version,description,reportDateDescription,captureCoordinates,dataEntryForm,minDaysFromStart,repeatable,preGenerateUID,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,sortOrder,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,name,valueType,optionSetValue,formName,optionSet[id]]]', 'idb' ) );
+ }
+
+ d.resolve();
+ });
+
+ return p;
+ });
+ }
+ });
+
+ build.done(function() {
+ def.resolve();
+
+ promise = promise.done( function () {
+ mainDef.resolve( programs );
+ } );
+ }).fail(function(){
+ mainDef.resolve( null );
+ });
+
+ builder.resolve();
+
+ return mainPromise;
+}
+
+function getCategories( programs )
+{
+ if(!programs){
+ return;
+ }
+
+ var catigories = [];
+ _.each( _.values( programs ), function ( program ) {
+ if( program && program.categoryCombo && program.categoryCombo.categories ) {
+ _.each(_.values(program.categoryCombo.categories), function(cat){
+ catigories.push( cat );
+ });
+ }
+ });
+
+ if(catigories.length > 0 ){
+ return checkAndGetD2Objects( {programs: programs, self: catigories}, 'categories', '../api/categories', 'fields=id,name,categoryOptions[id]');
+ }
+}
+
+function getCategoryOptions( programs )
+{
+ if(!programs){
+ return;
+ }
+
+ var categoryOptions = [];
+ _.each( _.values( programs ), function ( program ) {
+ if( program && program.categoryCombo && program.categoryCombo.categories ) {
+ _.each(_.values(program.categoryCombo.categories), function(cat){
+ if(cat.categoryOptions){
+ _.each(_.values(cat.categoryOptions), function(opt){
+ categoryOptions.push( opt );
+ });
+ }
+ });
+ }
+ });
+
+ if(categoryOptions.length > 0 ){
+ return checkAndGetD2Objects( {programs: programs, self: categoryOptions}, 'categoryOptions', '../api/categoryOptions', 'fields=id,name');
+ }
+}
+
+function getCategoyOptions( programs )
+{
+ if( !programs ){
+ return;
+ }
+
+ var mainDef = $.Deferred();
+ var mainPromise = mainDef.promise();
+
+ var def = $.Deferred();
+ var promise = def.promise();
+
+ var builder = $.Deferred();
+ var build = builder.promise();
+
+ _.each( _.values( programs ), function ( program ) {
+
+ if(program.categoryCombo && program.categoryCombo.id){
+ build = build.then(function() {
+ var d = $.Deferred();
+ var p = d.promise();
+ dhis2.ec.store.get('categoryCombo', program.categoryCombo.id).done(function(obj) {
+ if(!obj || obj.version !== program.categoryCombo.version) {
+ promise = promise.then( getD2Object( program.categoryCombo.id, 'categoryCombo', '../api/categoryCombos', 'fields=id,name,categories[id]', 'idb' ) );
}
d.resolve();
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2015-08-25 14:54:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2015-09-03 10:36:07 +0000
@@ -71,80 +71,122 @@
</tr>
<tr ng-repeat="eventGridColumn in eventGridColumns" ng-if="eventGridColumn.id !== 'comment' && eventGridColumn.id !== 'uid' && eventGridColumn.id !== 'event_date' && !isHidden(eventGridColumn.id)">
<td >
- {{eventGridColumn.name}}<span ng-if="eventGridColumn.compulsory" class="required">*</span>
+ {{eventGridColumn.name}} - {{eventGridColumn.valueType}}<span ng-if="eventGridColumn.compulsory" class="required">*</span>
</td>
<td >
- <ng-form name="innerForm">
- <div ng-if="prStDes[eventGridColumn.id].dataElement.optionSetValue">
- <div ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length >= 7">
- <ui-select ng-model="currentEvent[eventGridColumn.id]"
- theme="select2"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- input-field-id={{eventGridColumn.id}}
- on-select={{saveDatavalue()}}
- class='form-control'>
- <ui-select-match allow-clear="true" class="form-control" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
- <ui-select-choices repeat="option.name as option in optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options | filter: $select.search | limitTo:30">
- <span ng-bind-html="option.name | highlight: $select.search"></span>
- </ui-select-choices>
- </ui-select>
- </div>
- <div ng-if="selectedProgram.dataEntryMethod && optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length < 7">
- <label>
- <input type="radio"
- name="foo"
- input-field-id={{eventGridColumn.id}}
- ng-change="saveDatavalue()"
- ng-required={{eventGridColumn.compulsory}}
- ng-model="currentEvent[eventGridColumn.id]"
- value=""> {{'no_value' | translate}}<br>
- </label>
- <label ng-repeat="option in optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options">
- <input type="radio"
- name={{eventGridColumn.id}}
- input-field-id={{eventGridColumn.id}}
- ng-change="saveDatavalue()"
- ng-required={{eventGridColumn.compulsory}}
- ng-model="currentEvent[eventGridColumn.id]"
- value={{option.name}}> {{option.name}}<br>
- </label>
- </div>
- </div>
- <div ng-if="!prStDes[eventGridColumn.id].dataElement.optionSetValue" ng-switch="eventGridColumn.type">
- <div ng-switch-when="int">
- <input type="number"
- d2-number-validator
- number-type={{prStDes[eventGridColumn.id].dataElement.numberType}}
- ng-model="currentEvent[eventGridColumn.id]"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- input-field-id={{eventGridColumn.id}}
- ng-blur="saveDatavalue()"
- class="form-control"/>
- </div>
- <div ng-switch-when="string">
- <span ng-if="eventGridColumn.textType==='longText'">
- <textarea rows="3"
+ <ng-form name="innerForm">
+ <div ng-switch="eventGridColumn.valueType">
+ <div ng-switch-when="OPTION_SET">
+ <div ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length >= 7">
+ <ui-select ng-model="currentEvent[eventGridColumn.id]"
+ theme="select2"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ input-field-id={{eventGridColumn.id}}
+ on-select={{saveDatavalue()}}
+ class='form-control'>
+ <ui-select-match allow-clear="true" class="form-control" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
+ <ui-select-choices repeat="option.name as option in optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options | filter: $select.search | limitTo:30">
+ <span ng-bind-html="option.name | highlight: $select.search"></span>
+ </ui-select-choices>
+ </ui-select>
+ </div>
+ <div ng-if="selectedProgram.dataEntryMethod && optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length < 7">
+ <label>
+ <input type="radio"
+ name="foo"
+ input-field-id={{eventGridColumn.id}}
+ ng-change="saveDatavalue()"
+ ng-required={{eventGridColumn.compulsory}}
+ ng-model="currentEvent[eventGridColumn.id]"
+ value=""> {{'no_value' | translate}}<br>
+ </label>
+ <label ng-repeat="option in optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options">
+ <input type="radio"
+ name={{eventGridColumn.id}}
+ input-field-id={{eventGridColumn.id}}
+ ng-change="saveDatavalue()"
+ ng-required={{eventGridColumn.compulsory}}
+ ng-model="currentEvent[eventGridColumn.id]"
+ value={{option.name}}> {{option.name}}<br>
+ </label>
+ </div>
+ </div>
+ <div ng-switch-when="NUMBER">
+ <input type="number"
+ d2-number-validator
+ number-type={{prStDes[eventGridColumn.id].dataElement.numberType}}
+ ng-model="currentEvent[eventGridColumn.id]"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ input-field-id={{eventGridColumn.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control"/>
+ </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-required={{eventGridColumn.compulsory}}
+ name="foo"
+ input-field-id={{eventGridColumn.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control"/>
+ </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-required={{eventGridColumn.compulsory}}
+ name="foo"
+ input-field-id={{eventGridColumn.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control"/>
+ </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-required={{eventGridColumn.compulsory}}
+ name="foo"
+ input-field-id={{eventGridColumn.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control"/>
+ </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-required={{eventGridColumn.compulsory}}
+ name="foo"
+ input-field-id={{eventGridColumn.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control"/>
+ </div>
+ <div ng-switch-when="TEXT">
+ <input type="text"
+ ng-model="currentEvent[eventGridColumn.id]"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ input-field-id={{eventGridColumn.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control"/>
+ </div>
+ <div ng-switch-when="LONG_TEXT">
+ <textarea rows="3"
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
name="foo"
input-field-id={{eventGridColumn.id}}
ng-blur="saveDatavalue()"
class="form-control">
- </textarea>
- </span>
- <span ng-if="eventGridColumn.textType!=='longText'">
- <input type="text"
- ng-model="currentEvent[eventGridColumn.id]"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- input-field-id={{eventGridColumn.id}}
- ng-blur="saveDatavalue()"
- class="form-control"/>
- </span>
+ </textarea>
</div>
- <div ng-switch-when="bool">
+ <div ng-switch-when="BOOLEAN">
<select ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
name="foo"
@@ -156,7 +198,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
@@ -169,7 +211,7 @@
blur-or-change="saveDatavalue()"
class="form-control">
</div>
- <div ng-switch-when="datetime">
+ <div ng-switch-when="DATETIME">
<input type="text"
placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
d2-date
@@ -180,7 +222,7 @@
input-field-id={{eventGridColumn.id}}
style="width:99%;"/>
</div>
- <div ng-switch-when="trueOnly">
+ <div ng-switch-when="TRUE_ONLY">
<input type="checkbox"
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
@@ -291,47 +333,50 @@
<tbody>
<tr ng-repeat="de in section.programStageDataElements" ng-if="!isHidden(de.dataElement.id)">
<td >
- {{prStDes[de.dataElement.id].dataElement.formName ? prStDes[de.dataElement.id].dataElement.formName : prStDes[de.dataElement.id].dataElement.name}}<span ng-if="prStDes[de.dataElement.id].compulsory" class="required">*</span> </td>
+ {{prStDes[de.dataElement.id].dataElement.formName ? prStDes[de.dataElement.id].dataElement.formName : prStDes[de.dataElement.id].dataElement.name}}
+ {{prStDes[de.dataElement.id].dataElement.valueType}}
+ <span ng-if="prStDes[de.dataElement.id].compulsory" class="required">*</span>
+ </td>
<td >
- <ng-form name="innerForm">
- <div ng-if="prStDes[de.dataElement.id].dataElement.optionSetValue">
- <span ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options.length > 8">
- <ui-select ng-model="currentEvent[de.dataElement.id]"
- theme="select2"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- name="foo"
- input-field-id={{de.dataElement.id}}
- on-select={{saveDatavalue()}}
- class='form-control'>
- <ui-select-match allow-clear="true" class="form-control" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
- <ui-select-choices repeat="option.name as option in optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options | filter: $select.search | limitTo:30">
- <span ng-bind-html="option.name | highlight: $select.search"></span>
- </ui-select-choices>
- </ui-select>
- </span>
- <span ng-if="selectedProgram.dataEntryMethod && prStDes[de.dataElement.id].dataElement.optionSet.options.length < 7">
- <label>
- <input type="radio"
- name="foo"
- input-field-id={{de.dataElement.id}}
- ng-change="saveDatavalue()"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-model="currentEvent[de.dataElement.id]"
- value="">{{'no_value' | translate}}<br>
- </label>
- <label ng-repeat="option in optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options">
- <input type="radio"
- name={{de.dataElement.id}}
- input-field-id={{de.dataElement.id}}
- ng-change="saveDatavalue()"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-model="currentEvent[de.dataElement.id]"
- value={{option.name}}> {{option.name}}<br>
- </label>
- </span>
- </div>
- <div ng-if="!prStDes[de.dataElement.id].dataElement.optionSetValue" ng-switch="prStDes[de.dataElement.id].dataElement.type">
- <div ng-switch-when="int">
+ <ng-form name="innerForm">
+ <div ng-switch="prStDes[de.dataElement.id].dataElement.valueType">
+ <div ng-switch-when="OPTION_SET">
+ <div ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options.length >= 7">
+ <ui-select ng-model="currentEvent[de.dataElement.id]"
+ theme="select2"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ name="foo"
+ input-field-id={{de.dataElement.id}}
+ on-select={{saveDatavalue()}}
+ class='form-control'>
+ <ui-select-match allow-clear="true" class="form-control" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
+ <ui-select-choices repeat="option.name as option in optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options | filter: $select.search | limitTo:30">
+ <span ng-bind-html="option.name | highlight: $select.search"></span>
+ </ui-select-choices>
+ </ui-select>
+ </div>
+ <div ng-if="selectedProgram.dataEntryMethod && prStDes[de.dataElement.id].dataElement.optionSet.options.length < 7">
+ <label>
+ <input type="radio"
+ name="foo"
+ input-field-id={{de.dataElement.id}}
+ ng-change="saveDatavalue()"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-model="currentEvent[de.dataElement.id]"
+ value="">{{'no_value' | translate}}<br>
+ </label>
+ <label ng-repeat="option in optionSets[prStDes[de.dataElement.id].dataElement.optionSet.id].options">
+ <input type="radio"
+ name={{de.dataElement.id}}
+ input-field-id={{de.dataElement.id}}
+ ng-change="saveDatavalue()"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-model="currentEvent[de.dataElement.id]"
+ value={{option.name}}> {{option.name}}<br>
+ </label>
+ </div>
+ </div>
+ <div ng-switch-when="NUMBER">
<input type="number"
d2-number-validator
number-type={{prStDes[de.dataElement.id].dataElement.numberType}}
@@ -342,40 +387,82 @@
ng-blur="saveDatavalue()"
class="form-control"/>
</div>
- <div ng-switch-when="string">
- <span ng-if="prStDes[de.dataElement.id].dataElement.textType==='longText'">
- <textarea rows="3"
- ng-model="currentEvent[de.dataElement.id]"
- ng-required={{prStDes[de.dataElement.id].compulsory}}
- name="foo"
- input-field-id={{de.dataElement.id}}
- ng-blur="saveDatavalue()"
- class="form-control">
- </textarea>
- </span>
- <span ng-if="prStDes[de.dataElement.id].dataElement.textType!=='longText'">
- <input type="text"
+ <div ng-switch-when="INTEGER">
+ <input type="number"
+ d2-number-validator
+ number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
+ ng-model="currentEvent[de.dataElement.id]"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ name="foo"
+ input-field-id={{de.dataElement.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control"/>
+ </div>
+ <div ng-switch-when="INTEGER_POSITIVE">
+ <input type="number"
+ d2-number-validator
+ number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
+ ng-model="currentEvent[de.dataElement.id]"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ name="foo"
+ input-field-id={{de.dataElement.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control"/>
+ </div>
+ <div ng-switch-when="INTEGER_NEGATIVE">
+ <input type="number"
+ d2-number-validator
+ number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
+ ng-model="currentEvent[de.dataElement.id]"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ name="foo"
+ input-field-id={{de.dataElement.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control"/>
+ </div>
+ <div ng-switch-when="INTEGER_ZERO_OR_POSITIVE">
+ <input type="number"
+ d2-number-validator
+ number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
+ ng-model="currentEvent[de.dataElement.id]"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ name="foo"
+ input-field-id={{de.dataElement.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control"/>
+ </div>
+ <div ng-switch-when="TEXT">
+ <input type="text"
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
name="foo"
input-field-id={{de.dataElement.id}}
ng-blur="saveDatavalue()"
- class="form-control">
- </span>
- </div>
- <div ng-switch-when="bool">
+ class="form-control">
+ </div>
+ <div ng-switch-when="LONG_TEXT">
+ <textarea rows="3"
+ ng-model="currentEvent[de.dataElement.id]"
+ ng-required={{prStDes[de.dataElement.id].compulsory}}
+ name="foo"
+ input-field-id={{de.dataElement.id}}
+ ng-blur="saveDatavalue()"
+ class="form-control">
+ </textarea>
+ </div>
+ <div ng-switch-when="BOOLEAN">
<select ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
name="foo"
input-field-id={{de.dataElement.id}}
ng-change="saveDatavalue()"
class="form-control">
- <option value="">{{pleaseSelectLabel}}</option>
- <option value="false">{{'no'| translate}}</option>
- <option value="true">{{'yes'| translate}}</option>
+ <option value="">{{pleaseSelectLabel}}</option>
+ <option value="false">{{'no'| translate}}</option>
+ <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
@@ -388,7 +475,7 @@
blur-or-change="saveDatavalue()"
class="form-control"/>
</div>
- <div ng-switch-when="datetime">
+ <div ng-switch-when="DATETIME">
<input type="text"
placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
d2-date
@@ -401,7 +488,7 @@
blur-or-change="saveDatavalue()"
class="form-control"/>
</div>
- <div ng-switch-when="trueOnly">
+ <div ng-switch-when="TRUE_ONLY">
<input type="checkbox"
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
@@ -416,12 +503,12 @@
name="foo"
input-field-id={{de.dataElement.id}}
ng-blur="saveDatavalue()"
- class="form-control"/>
+ class="form-control"/>
</div>
- </div>
+ </div>
<div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
</div>
- </ng-form>
+ </ng-form>
</td>
</tr>
</tbody>