dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39728
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20138: tracker-capture: attribute inheritance during relationship assignment is now fully implemented.
------------------------------------------------------------
revno: 20138
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-14 18:13:56 +0200
message:
tracker-capture: attribute inheritance during relationship assignment is now fully implemented.
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.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/views/tei.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-tracker-capture/components/relationship/relationship-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2015-09-14 15:51:56 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2015-09-14 16:13:56 +0000
@@ -203,6 +203,12 @@
$scope.selectedRelationship = {};
$scope.relationship = {};
+
+ var invalidTeis = [];
+ invalidTeis.push($scope.selectedTei.trackedEntityInstance);
+ angular.forEach($scope.selectedTei.relationships, function(rel){
+ invalidTeis.push(rel.trackedEntityInstanceB);
+ });
//Selections
$scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
@@ -374,7 +380,7 @@
}
//process tei grid
- $scope.trackedEntityList = TEIGridService.format(data,false, $scope.optionSets);
+ $scope.trackedEntityList = TEIGridService.format(data,false, $scope.optionSets, invalidTeis);
$scope.showTrackedEntityDiv = true;
$scope.teiFetched = true;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2015-09-11 15:16:03 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2015-09-14 16:13:56 +0000
@@ -257,7 +257,7 @@
}
//process tei grid
- $scope.trackedEntityList = TEIGridService.format(data,false, $scope.optionSets);
+ $scope.trackedEntityList = TEIGridService.format(data,false, $scope.optionSets, null);
$scope.showTrackedEntityDiv = true;
$scope.teiFetched = true;
$scope.doSearch = 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 2015-09-14 14:10:12 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-09-14 16:13:56 +0000
@@ -1495,7 +1495,8 @@
.service('TEIGridService', function(OrgUnitService, OptionSetService, DateUtils, $translate, AttributesFactory){
return {
- format: function(grid, map, optionSets){
+ format: function(grid, map, optionSets, invalidTeis){
+ invalidTeis = !invalidTeis ? [] : invalidTeis;
if(!grid || !grid.rows){
return;
}
@@ -1519,47 +1520,49 @@
OrgUnitService.open().then(function(){
angular.forEach(grid.rows, function(row){
- var entity = {};
- var isEmpty = true;
-
- entity.id = row[0];
- entity.created = DateUtils.formatFromApiToUser( row[1] );
- entity.orgUnit = row[3];
- entity.type = row[4];
- entity.inactive = row[5] !== "" ? row[5] : false;
-
- OrgUnitService.get(row[3]).then(function(ou){
- if(ou){
- entity.orgUnitName = ou.n;
- }
- });
-
- for(var i=6; i<row.length; i++){
- if(row[i] && row[i] !== ''){
- isEmpty = false;
- var val = row[i];
-
- if(attributes[grid.headers[i].name] &&
- attributes[grid.headers[i].name].optionSetValue &&
- optionSets &&
- attributes[grid.headers[i].name].optionSet &&
- optionSets[attributes[grid.headers[i].name].optionSet.id] ){
- val = OptionSetService.getName(optionSets[attributes[grid.headers[i].name].optionSet.id].options, val);
- }
- if(attributes[grid.headers[i].name] && attributes[grid.headers[i].name].valueType === 'date'){
- val = DateUtils.formatFromApiToUser( val );
- }
-
- entity[grid.headers[i].name] = val;
- }
- }
-
- if(!isEmpty){
- if(map){
- entityList[entity.id] = entity;
- }
- else{
- entityList.push(entity);
+ if(invalidTeis.indexOf(row[0]) === -1 ){
+ var entity = {};
+ var isEmpty = true;
+
+ entity.id = row[0];
+ entity.created = DateUtils.formatFromApiToUser( row[1] );
+ entity.orgUnit = row[3];
+ entity.type = row[4];
+ entity.inactive = row[5] !== "" ? row[5] : false;
+
+ OrgUnitService.get(row[3]).then(function(ou){
+ if(ou){
+ entity.orgUnitName = ou.n;
+ }
+ });
+
+ for(var i=6; i<row.length; i++){
+ if(row[i] && row[i] !== ''){
+ isEmpty = false;
+ var val = row[i];
+
+ if(attributes[grid.headers[i].name] &&
+ attributes[grid.headers[i].name].optionSetValue &&
+ optionSets &&
+ attributes[grid.headers[i].name].optionSet &&
+ optionSets[attributes[grid.headers[i].name].optionSet.id] ){
+ val = OptionSetService.getName(optionSets[attributes[grid.headers[i].name].optionSet.id].options, val);
+ }
+ if(attributes[grid.headers[i].name] && attributes[grid.headers[i].name].valueType === 'date'){
+ val = DateUtils.formatFromApiToUser( val );
+ }
+
+ entity[grid.headers[i].name] = val;
+ }
+ }
+
+ if(!isEmpty){
+ if(map){
+ entityList[entity.id] = entity;
+ }
+ else{
+ entityList.push(entity);
+ }
}
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html 2015-08-26 10:41:01 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html 2015-09-14 16:13:56 +0000
@@ -29,7 +29,6 @@
<tbody id="list">
<tr ng-repeat="trackedEntity in trackedEntityList.rows | orderBy:d2Sort:reverse"
ng-click="selectedTei.trackedEntityInstance ? assignRelationship(trackedEntity) : showDashboard(trackedEntity)"
- ng-if="selectedTei.trackedEntityInstance ? trackedEntity.id !== selectedTei.trackedEntityInstance : true"
ng-class="{true: 'inactive-tei'} [trackedEntity.inactive]"
title="{{selectedTei.trackedEntityInstance ? 'select' : 'go_to_dashboard'| translate}}">
<td ng-repeat="gridColumn in gridColumns| filter:{show: true}">