dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33198
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16934: tracker capture - minor performance improvment; respecting program setting for radio type data entry
------------------------------------------------------------
revno: 16934
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-10-02 12:25:39 +0200
message:
tracker capture - minor performance improvment; respecting program setting for radio type data entry
modified:
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-tracker-capture/components/dataentry/dataentry-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html
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/i18n/en.json
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-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2014-09-23 10:48:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2014-10-02 10:25:39 +0000
@@ -82,7 +82,7 @@
</div>
<div ng-switch-when="string">
<div class="container-fluid" ng-if="programStageDataElements[eventGridColumn.id].dataElement.optionSet">
- <span ng-if="!selectedProgram.dataEntryMethod || programStageDataElements[eventGridColumn.id].dataElement.optionSet.options.length > 7">
+ <span ng-if="!selectedProgram.dataEntryMethod || programStageDataElements[eventGridColumn.id].dataElement.optionSet.options.length >= 7">
<input type="text"
ng-model="currentEvent[eventGridColumn.id]"
typeahead="option.code as option.name for option in programStageDataElements[eventGridColumn.id].dataElement.optionSet.options | filter:$viewValue | limitTo:20"
=== 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-01 15:19:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-10-02 10:25:39 +0000
@@ -67,9 +67,17 @@
$scope.selectedEntity &&
$scope.selectedEnrollment){
- angular.forEach($scope.selectedProgram.programStages, function(stage){
- $scope.selectedProgramWithStage[stage.id] = stage;
+ angular.forEach($scope.selectedProgram.programStages, function(st){
+
+ ProgramStageFactory.get(st.id).then(function(stage){
+ $scope.selectedProgramWithStage[stage.id] = stage;
+ });
});
+
+ setTimeout(function () {
+ $scope.getEvents();
+ }, 100);
+
$scope.getEvents();
}
});
@@ -84,7 +92,6 @@
if(dhis2Event.enrollment === $scope.selectedEnrollment.enrollment){
var eventStage = $scope.selectedProgramWithStage[dhis2Event.programStage];
-
if(angular.isObject(eventStage)){
dhis2Event.name = eventStage.name;
@@ -103,7 +110,6 @@
dhis2Event = EventUtils.setEventOrgUnitName(dhis2Event);
}
}
-
});
}
@@ -216,32 +222,32 @@
}
else{
$scope.dhis2Events.splice(0,0,newEvent);
- /*$scope.dhis2Events = orderByFilter($scope.dhis2Events, '-sortingDate');
- $scope.dhis2Events.reverse();*/
- }
+ }
+
$scope.showDataEntry(newEvent);
}
});
};
- $scope.showDataEntry = function(event){
- $scope.dueDateSaved = false;
- $scope.eventDateSaved = false;
+ $scope.showDataEntry = function(event){
+
+ //$scope.dueDateSaved = false;
+ //$scope.eventDateSaved = false;
if(event){
if($scope.currentEvent && $scope.currentEvent.event === event.event){
//clicked on the same stage, do toggling
- $scope.currentEvent = null;
+ $scope.currentEvent = {};
$scope.currentElement = {id: '', saved: false};
$scope.showDataEntryDiv = !$scope.showDataEntryDiv;
}
else{
$scope.currentElement = {};
- $scope.currentEvent = event;
+ $scope.currentEvent = event;
$scope.showDataEntryDiv = true;
$scope.showDummyEventDiv = false;
$scope.showEventCreationDiv = false;
-
+
if($scope.currentEvent.notes){
angular.forEach($scope.currentEvent.notes, function(note){
note.storedDate = DateUtils.formatToHrsMins(note.storedDate);
@@ -277,45 +283,42 @@
});
}
- ProgramStageFactory.get($scope.currentEvent.programStage).then(function(stage){
- $scope.currentStage = stage;
-
- $scope.programStageDataElements = [];
- angular.forEach($scope.currentStage.programStageDataElements, function(prStDe){
- $scope.programStageDataElements[prStDe.dataElement.id] = prStDe;
- });
-
- $scope.customForm = $scope.currentStage.dataEntryForm ? $scope.currentStage.dataEntryForm.htmlCode : null;
- $scope.displayCustomForm = $scope.customForm ? true:false;
-
- $scope.allowProvidedElsewhereExists = false;
- angular.forEach($scope.currentStage.programStageDataElements, function(prStDe){
- $scope.currentStage.programStageDataElements[prStDe.dataElement.id] = prStDe.dataElement;
- if(prStDe.allowProvidedElsewhere){
- $scope.allowProvidedElsewhereExists = true;
- $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] = false;
- }
- });
-
- angular.forEach($scope.currentEvent.dataValues, function(dataValue){
- var val = dataValue.value;
- if(val){
- var de = $scope.currentStage.programStageDataElements[dataValue.dataElement];
- if( de && de.type === 'int' && val){
- val = parseInt(val);
- dataValue.value = val;
- }
- $scope.currentEvent[dataValue.dataElement] = val;
-
- if(dataValue.providedElsewhere){
- $scope.currentEvent.providedElsewhere[dataValue.dataElement] = dataValue.providedElsewhere;
- }
+
+ $scope.currentStage = $scope.selectedProgramWithStage[$scope.currentEvent.programStage];
+
+ $scope.programStageDataElements = [];
+ angular.forEach($scope.currentStage.programStageDataElements, function(prStDe){
+ $scope.programStageDataElements[prStDe.dataElement.id] = prStDe;
+ });
+
+ $scope.customForm = $scope.currentStage.dataEntryForm ? $scope.currentStage.dataEntryForm.htmlCode : null;
+ $scope.displayCustomForm = $scope.customForm ? true:false;
+
+ $scope.allowProvidedElsewhereExists = false;
+ angular.forEach($scope.currentStage.programStageDataElements, function(prStDe){
+ $scope.currentStage.programStageDataElements[prStDe.dataElement.id] = prStDe.dataElement;
+ if(prStDe.allowProvidedElsewhere){
+ $scope.allowProvidedElsewhereExists = true;
+ }
+ });
+
+ angular.forEach($scope.currentEvent.dataValues, function(dataValue){
+ var val = dataValue.value;
+ if(val){
+ var de = $scope.currentStage.programStageDataElements[dataValue.dataElement];
+ if( de && de.type === 'int' && val){
+ val = parseInt(val);
+ //dataValue.value = val;
}
- });
+ }
+ $scope.currentEvent[dataValue.dataElement] = val;
+ if(dataValue.providedElsewhere){
+ $scope.currentEvent.providedElsewhere[dataValue.dataElement] = dataValue.providedElsewhere;
+
+ }
+ });
- $scope.currentEvent.dataValues = [];
- $scope.currentEventOriginal = angular.copy($scope.currentEvent);
- });
+ $scope.currentEventOriginal = angular.copy($scope.currentEvent);
};
$scope.saveDatavalue = function(prStDe){
@@ -362,8 +365,7 @@
};
$scope.saveDatavalueLocation = function(prStDe){
-
- console.log('I am called: ',$scope.currentEvent.providedElsewhere[prStDe.dataElement.id] );
+
$scope.updateSuccess = false;
if(!angular.isUndefined($scope.currentEvent.providedElsewhere[prStDe.dataElement.id])){
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2014-10-01 11:13:12 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2014-10-02 10:25:39 +0000
@@ -17,10 +17,11 @@
<div ng-show="dataentryWidget.expand" class="panel-body dashboard-widget-container">
<div ng-if="showEventColors">
- <table class="table table-bordered" style="width: 100%;">
+ <span class='bold'>{{'legend' | translate}}</span>
+ <table class="table table-bordered" style="width: 100%;">
<tr>
<td ng-class="eventColor.color" ng-repeat="eventColor in eventColors">
- {{eventColor.description | translate}}
+ <span class="bold">{{eventColor.description | translate}}</span>
</td>
</tr>
</table>
=== 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 2014-10-01 15:19:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2014-10-02 10:25:39 +0000
@@ -28,26 +28,51 @@
ng-blur="saveDatavalue(prStDe)"
name="foo"/>
<span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" class="error">{{'number_required'| translate}}</span>
- </div>
- <div ng-switch-when="string">
- <span ng-if="prStDe.dataElement.optionSet">
- <input type="text"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- ng-model="currentEvent[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- typeahead="option.code as option.name for option in prStDe.dataElement.optionSet.options | filter:$viewValue | limitTo:20"
- typeahead-open-on-focus
- ng-blur="saveDatavalue(prStDe)"
- name="foo"/>
- </span>
- <span ng-if="!prStDe.dataElement.optionSet">
- <input type="text"
- ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
- ng-model="currentEvent[prStDe.dataElement.id]"
- ng-required={{prStDe.compulsory}}
- ng-blur="saveDatavalue(prStDe)"
- name="foo"/>
- </span>
+ </div>
+ <div ng-switch-when="string">
+ <div ng-if="prStDe.dataElement.optionSet">
+ <div ng-if="!selectedProgram.dataEntryMethod || prStDe.dataElement.optionSet.options.length >= 7">
+ <input type="text"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="currentEvent[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ typeahead="option.code as option.name for option in prStDe.dataElement.optionSet.options | filter:$viewValue | limitTo:20"
+ typeahead-open-on-focus
+ ng-blur="saveDatavalue(prStDe)"
+ name="foo"/>
+ </div>
+ <div ng-if="selectedProgram.dataEntryMethod && prStDe.dataElement.optionSet.options.length < 7">
+ <label>
+ <input type="radio"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
+ name={{currentEvent[prStDe.dataElement.id]}}
+ ng-required={{prStDe.compulsory}}
+ ng-model="currentEvent[prStDe.dataElement.id]"
+ ng-change="saveDatavalue(prStDe)"
+ value=""> {{'no_value' | translate}}<br>
+ </label><br>
+ <span ng-repeat="option in prStDe.dataElement.optionSet.options">
+ <label>
+ <input type="radio"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
+ name={{currentEvent[prStDe.dataElement.id]}}
+ ng-required={{prStDe.compulsory}}
+ ng-model="currentEvent[prStDe.dataElement.id]"
+ ng-change="saveDatavalue(prStDe)"
+ value={{option.code}}> {{option.name}}
+ </label><br>
+ </span>
+ </div>
+ </div>
+ <div ng-if="!prStDe.dataElement.optionSet">
+ <input type="text"
+ ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+ ng-model="currentEvent[prStDe.dataElement.id]"
+ ng-required={{prStDe.compulsory}}
+ ng-blur="saveDatavalue(prStDe)"
+ name="foo"/>
+ </div>
+
</div>
<div ng-switch-when="bool">
<select ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
@@ -78,7 +103,6 @@
ng-required={{prStDe.compulsory}}
ng-change="saveDatavalue(prStDe)"
name="foo"/>
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
</div>
</div>
</ng-form>
@@ -87,7 +111,8 @@
<div class="align-center" ng-show="prStDe.allowProvidedElsewhere">
<input type="checkbox"
ng-model="currentEvent.providedElsewhere[prStDe.dataElement.id]"
- ng-change="saveDatavalueLocation(prStDe)"/> </div>
+ ng-change="saveDatavalueLocation(prStDe)"/>
+ </div>
</td>
</tr>
</table>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-10-01 15:19:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-10-02 10:25:39 +0000
@@ -129,6 +129,7 @@
"overdue_events": "Overdue Events",
"overdue_events_description": "Generate a report of overdue events for a selected program and organisation unit. The report displays list of tracked entity instances and their events that are not conducted on scheduled due dates.",
"upcoming_event": "Upcoming event",
+ "legend": "Legend",
"event_color_legend": "What do the colors mean?",
"completed": "COMPLETED",
"executed": "EXECUTED",
@@ -142,6 +143,7 @@
"unmark_for_followup": "Remove from followup",
"only_marked_for_followup": "Only marked for followup",
"registered_data": "Registered data",
+ "no_value": "NO_VALUE",
"no_data_found": "No data found",
"no_data": "No data",
"data_exists": "Data exists",
=== 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 2014-10-01 08:08:35 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2014-10-02 10:25:39 +0000
@@ -377,7 +377,7 @@
return $.ajax( {
url: '../api/programs.json',
type: 'GET',
- data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,version,relationshipText,relationshipFromA,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,realionshipText,relationshipFromA,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],programStages[id,name,version,minDaysFromStart,reportDateDescription,repeatable,autoGenerateEvent],programTrackedEntityAttributes[displayInList,mandatory,trackedEntityAttribute[id]]'
+ data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,version,dataEntryMethod,relationshipText,relationshipFromA,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,realionshipText,relationshipFromA,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],programStages[id,name,version,minDaysFromStart,reportDateDescription,repeatable,autoGenerateEvent],programTrackedEntityAttributes[displayInList,mandatory,trackedEntityAttribute[id]]'
}).done( function( response ){
_.each( _.values( response.programs ), function ( program ) {