dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38172
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19490: tracker-capture: removed trackedEntityForm as forms are now part of program
------------------------------------------------------------
revno: 19490
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-06-22 14:07:24 +0200
message:
tracker-capture: removed trackedEntityForm as forms are now part of program
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.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
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-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js 2015-06-17 08:54:51 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js 2015-06-22 12:07:24 +0000
@@ -8,7 +8,6 @@
AttributesFactory,
DHIS2EventFactory,
TEService,
- TEFormService,
CustomFormService,
EnrollmentService,
DialogService,
@@ -102,15 +101,15 @@
var mode = _mode ? _mode : 'ENROLLMENT';
AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
$scope.attributes = atts;
- $scope.customFormExists = false;
- if($scope.selectedProgram && $scope.selectedProgram.id){
- TEFormService.getByProgram($scope.selectedProgram, $scope.attributes).then(function(teForm){
- if(angular.isObject(teForm)){
- $scope.customFormExists = true;
- $scope.trackedEntityForm = teForm;
- $scope.customForm = CustomFormService.getForTrackedEntity($scope.trackedEntityForm, mode);
- }
- });
+ $scope.customFormExists = false;
+ if($scope.selectedProgram && $scope.selectedProgram.id && $scope.selectedProgram.dataEntryForm && $scope.selectedProgram.dataEntryForm.htmlCode){
+ $scope.customFormExists = true;
+ $scope.trackedEntityForm = $scope.selectedProgram.dataEntryForm;
+ $scope.trackedEntityForm.attributes = $scope.attributes;
+ $scope.trackedEntityForm.selectIncidentDatesInFuture = $scope.selectedProgram.selectIncidentDatesInFuture;
+ $scope.trackedEntityForm.selectEnrollmentDatesInFuture = $scope.selectedProgram.selectEnrollmentDatesInFuture;
+ $scope.trackedEntityForm.displayIncidentDate = $scope.selectedProgram.displayIncidentDate;
+ $scope.customForm = CustomFormService.getForTrackedEntity($scope.trackedEntityForm, mode);
}
});
};
=== 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-06-21 22:18:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-06-22 12:07:24 +0000
@@ -10,7 +10,7 @@
var store = new dhis2.storage.Store({
name: "dhis2tc",
adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
- objectStores: ['programs', 'programStages', 'trackedEntities', 'trackedEntityForms', 'attributes', 'relationshipTypes', 'optionSets', 'programValidations', 'ouLevels', 'programRuleVariables', 'programRules','constants']
+ objectStores: ['programs', 'programStages', 'trackedEntities', 'attributes', 'relationshipTypes', 'optionSets', 'programValidations', 'ouLevels', 'programRuleVariables', 'programRules','constants']
});
return{
currentStore: store
@@ -629,36 +629,6 @@
};
})
-/* Service for getting tracked entity Form */
-.factory('TEFormService', function(TCStorageService, $q, $rootScope) {
-
- return {
- getByProgram: function(program, attributes){
-
- var def = $q.defer();
-
- TCStorageService.currentStore.open().done(function(){
- TCStorageService.currentStore.get('trackedEntityForms', program.id).done(function(teForm){
- $rootScope.$apply(function(){
- var trackedEntityForm = teForm;
- if(angular.isObject(trackedEntityForm)){
- trackedEntityForm.attributes = attributes;
- trackedEntityForm.selectIncidentDatesInFuture = program.selectIncidentDatesInFuture;
- trackedEntityForm.selectEnrollmentDatesInFuture = program.selectEnrollmentDatesInFuture;
- trackedEntityForm.displayIncidentDate = program.displayIncidentDate;
- def.resolve(trackedEntityForm);
- }
- else{
- def.resolve(null);
- }
- });
- });
- });
- return def.promise;
- }
- };
-})
-
/* Service for getting tracked entity instances */
.factory('TEIService', function($http, $q, AttributesFactory) {
=== 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-06-21 22:18:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-06-22 12:07:24 +0000
@@ -29,7 +29,7 @@
dhis2.tc.store = new dhis2.storage.Store({
name: 'dhis2tc',
adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
- objectStores: ['programs', 'programStages', 'trackedEntities', 'trackedEntityForms', 'attributes', 'relationshipTypes', 'optionSets', 'programValidations', 'programIndicators', 'ouLevels', 'programRuleVariables', 'programRules','constants']
+ objectStores: ['programs', 'programStages', 'trackedEntities', 'attributes', 'relationshipTypes', 'optionSets', 'programValidations', 'programIndicators', 'ouLevels', 'programRuleVariables', 'programRules','constants']
});
(function($) {
@@ -150,7 +150,6 @@
promise = promise.then( getProgramValidations );
promise = promise.then( getMetaProgramIndicators );
promise = promise.then( getProgramIndicators );
- promise = promise.then( getTrackedEntityForms );
promise = promise.then( getOrgUnitLevels );
promise.done(function() {
@@ -339,7 +338,7 @@
return $.ajax( {
url: '../api/programs.json',
type: 'GET',
- data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,type,version,dataEntryMethod,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,relationshipText,relationshipFromA,relatedProgram[id,name],relationshipType[id,name],trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],userRoles[id,name],programStages[id,name,version,minDaysFromStart,standardInterval,periodType,generatedByEnrollmentDate,reportDateDescription,repeatable,autoGenerateEvent,openAfterEnrollment,reportDateToUse],programTrackedEntityAttributes[displayInList,mandatory,allowFutureDate,trackedEntityAttribute[id,unique]]'
+ data: 'paging=false&filter=id:eq:' + id +'&fields=id,name,type,version,dataEntryMethod,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,selectEnrollmentDatesInFuture,selectIncidentDatesInFuture,onlyEnrollOnce,externalAccess,displayOnAllOrgunit,registration,relationshipText,relationshipFromA,relatedProgram[id,name],relationshipType[id,name],trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],userRoles[id,name],programStages[id,name,version,minDaysFromStart,standardInterval,periodType,generatedByEnrollmentDate,reportDateDescription,repeatable,autoGenerateEvent,openAfterEnrollment,reportDateToUse],dataEntryForm[name,style,htmlCode,format],programTrackedEntityAttributes[displayInList,mandatory,allowFutureDate,trackedEntityAttribute[id,unique]]'
}).done( function( response ){
_.each( _.values( response.programs ), function ( program ) {
@@ -988,35 +987,6 @@
return mainPromise;
}
-function getTrackedEntityForms( )
-{
- dhis2.tc.store.getKeys( 'trackedEntityForms').done(function(res){
- if(res.length > 0){
- return;
- }
- var def = $.Deferred();
-
- $.ajax({
- url: '../api/trackedEntityForms.json?paging=false&fields=id,program[id,name],dataEntryForm[name,htmlCode]',
- type: 'GET'
- }).done(function(response) {
- _.each( _.values( response.trackedEntityForms ), function ( trackedEntityForm ) {
-
- if( trackedEntityForm && trackedEntityForm.id){
- trackedEntityForm.id = trackedEntityForm.program.id;
- dhis2.tc.store.set( 'trackedEntityForms', trackedEntityForm );
- }
- });
-
- def.resolve();
- }).fail(function(){
- def.resolve();
- });
-
- return def.promise();
- });
-}
-
function getOrgUnitLevels()
{
dhis2.tc.store.getKeys( 'ouLevels').done(function(res){
=== 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-06-22 10:06:28 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-06-22 12:07:24 +0000
@@ -346,16 +346,16 @@
}
return null;
},
- getForTrackedEntity: function (trackedEntity, target) {
- if (!trackedEntity) {
+ getForTrackedEntity: function (trackedEntityForm, target) {
+ if (!trackedEntityForm) {
return null;
}
- var htmlCode = trackedEntity.dataEntryForm ? trackedEntity.dataEntryForm.htmlCode : null;
+ var htmlCode = trackedEntityForm.htmlCode ? trackedEntityForm.htmlCode : null;
if (htmlCode) {
var trackedEntityFormAttributes = [];
- angular.forEach(trackedEntity.attributes, function (att) {
+ angular.forEach(trackedEntityForm.attributes, function (att) {
trackedEntityFormAttributes[att.id] = att;
});
@@ -457,7 +457,7 @@
programId = attributes['programid'];
if (programId === 'enrollmentDate') {
fieldName = 'dateOfEnrollment';
- var enMaxDate = trackedEntity.selectEnrollmentDatesInFuture ? '' : 0;
+ var enMaxDate = trackedEntityForm.selectEnrollmentDatesInFuture ? '' : 0;
newInputField = '<input type="text" ' +
' name="' + fieldName + '"' +
' element-id="' + i + '"' +
@@ -470,9 +470,9 @@
' max-date="' + enMaxDate + '"' +
' ng-required="true"> ';
}
- if (programId === 'dateOfIncident' && trackedEntity.displayIncidentDate) {
+ if (programId === 'dateOfIncident' && trackedEntityForm.displayIncidentDate) {
fieldName = 'dateOfIncident';
- var inMaxDate = trackedEntity.selectIncidentDatesInFuture ? '' : 0;
+ var inMaxDate = trackedEntityForm.selectIncidentDatesInFuture ? '' : 0;
newInputField = '<input type="text" ' +
' name="' + fieldName + '"' +
' element-id="' + i + '"' +