← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20582: tracker-capture: registering/selecting tracker associate is now complete

 

------------------------------------------------------------
revno: 20582
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-10-08 13:26:14 +0200
message:
  tracker-capture: registering/selecting tracker associate is now complete
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/registration.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties
  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-tracker-capture/components/registration/registration.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	2015-09-24 12:19:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	2015-10-08 11:26:14 +0000
@@ -13,7 +13,9 @@
                             {{'entity_type'| translate}}
                         </td>
                         <td>
-                            <select class="form-control" ng-model="trackedEntities.selected" ng-options="trackedEntity.name for trackedEntity in trackedEntities.available | orderBy: 'name'">                                
+                            <select class="form-control" 
+                                    ng-model="trackedEntities.selected"                                     
+                                    ng-options="trackedEntity.name for trackedEntity in trackedEntities.available | orderBy: 'name'">                                
                             </select>                            
                         </td>
                     </tr>                   

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/registration.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/registration.html	2015-09-24 12:19:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/registration.html	2015-10-08 11:26:14 +0000
@@ -4,7 +4,7 @@
     <form name="outerForm" novalidate>
 
         <!-- Entity type begins -->
-        <div ng-if="!selectedProgram">
+        <div ng-if="!selectedProgramForRelative">
             <h3>{{'category'| translate}}</h3>
             <table class="dhis2-list-table-striped dhis2-table-hover">
                 <tr>
@@ -12,7 +12,10 @@
                         {{'entity_type'| translate}}
                     </td>
                     <td>
-                        <select class="form-control" ng-model="trackedEntities.selected" ng-options="trackedEntity.name for trackedEntity in trackedEntities.available | orderBy: 'name'">                                
+                        <select class="form-control" 
+                                ng-model="trackedEntities.selected" 
+                                ng-disabled="selectedAttribute && selectedAttribute.trackedEntity"
+                                ng-options="trackedEntity.name for trackedEntity in trackedEntities.available | orderBy: 'name'">                                
                         </select>                            
                     </td>
                 </tr>                   
@@ -25,7 +28,7 @@
         <div class="vertical-spacing" ng-if="customFormExists">
 
             <!-- enrollment and incidence dates begin -->
-            <div ng-if="selectedProgram && !customForm.hasProgramDate">
+            <div ng-if="selectedProgramForRelative && !customForm.hasProgramDate">
                 <div ng-include="'components/registration/enrollment-dates-form.html'"></div>
             </div>
             <!-- enrollment and incidence dates end -->
@@ -37,7 +40,7 @@
 
         <!-- default registration form begins -->
         <div class="vertical-spacing" ng-if="!customFormExists">            
-            <div ng-if="selectedProgram" ng-include="'components/registration/enrollment-dates-form.html'"></div>
+            <div ng-if="selectedProgramForRelative" ng-include="'components/registration/enrollment-dates-form.html'"></div>
             <div ng-include="'components/registration/default-registration-form.html'"></div>
         </div>
         <!-- default registration form ends -->

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add-controller.js	2015-10-08 08:03:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add-controller.js	2015-10-08 11:26:14 +0000
@@ -95,6 +95,7 @@
     $scope.searchFilterExists = false;   
     $scope.defaultOperators = OperatorFactory.defaultOperators;
     $scope.boolOperators = OperatorFactory.boolOperators;
+    $scope.selectedTrackedEntity = null;
     
     $scope.trackedEntityList = null; 
     $scope.enrollment = {programStartDate: '', programEndDate: '', operator: $scope.defaultOperators[0]};
@@ -125,7 +126,10 @@
         }
         
         CurrentSelection.setRelationshipOwner({});
-        //$scope.selectedTei = {};
+        
+        if($scope.selectedAttribute && $scope.selectedAttribute.trackedEntity && $scope.selectedAttribute.trackedEntity.id){
+            $scope.selectedTrackedEntity = $scope.selectedAttribute.trackedEntity;
+        }
     }
     
     if(angular.isObject($scope.programs) && $scope.programs.length === 1){
@@ -246,6 +250,20 @@
             }
         }
         
+        if( $scope.addingTeiAssociate ){            
+            if(!$scope.selectedTrackedEntity){
+                var dialogOptions = {
+                    headerText: 'searching_error',
+                    bodyText: $translate.instant('no_enity_for_tracker_associate_attribute')
+                };
+                DialogService.showDialog({}, dialogOptions);
+                return;
+            }
+            else{
+                $scope.programUrl = $scope.programUrl ? $scope.programUrl + '&trackedEntity=' + $scope.selectedTrackedEntity.id : 'trackedEntity=' + $scope.selectedTrackedEntity.id;
+            }
+        }
+        
         $scope.fetchTei();
     };
     

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add.html	2015-10-06 10:52:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/tei-add.html	2015-10-08 11:26:14 +0000
@@ -76,7 +76,7 @@
                     <div class="col-sm-4 vertical-spacing">
                         <select ng-model="selectedProgramForRelative"
                                 class="form-control"
-                                ng-disabled="programs.length < 1 || (selectedProgramForRelative && selectedProgram.relatedProgram && relatedProgramRelationship)"
+                                ng-disabled="programs.length < 1 || (selectedProgramForRelative && selectedProgram.relatedProgram && relatedProgramRelationship) || selectedAttribute && selectedAttribute.trackedEntity"
                                 ng-options="program as program.name for program in programs | orderBy: 'name'" 
                                 ng-change="setAttributesForSearch(selectedProgramForRelative)">
                             <option value="">{{'please_select_a_program'| translate}}</option>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-10-08 07:53:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-10-08 11:26:14 +0000
@@ -272,6 +272,8 @@
 event_creation_error=Error in event creation
 relationship_error=Error in relationship assignment
 tracker_associate_error=Error in tracker associate assignment
+searching_error=Searching Error
+no_enity_for_tracker_associate_attribute=Selected attribute has invalid tracked entity
 error=Error
 success=Success
 validation_error=Validation Error

=== 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-10-07 09:09:53 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2015-10-08 11:26:14 +0000
@@ -455,7 +455,7 @@
             dhis2.tc.store.get('attributes', teAttribute.id).done(function(obj) {
                 if((!obj || obj.version !== teAttribute.version) && attributesInPromise.indexOf(teAttribute.id) === -1) {
                     attributesInPromise.push( teAttribute.id );
-                    promise = promise.then( getD2Object( teAttribute.id, 'attributes', '../api/trackedEntityAttributes', 'fields=id,name,code,version,description,valueType,optionSetValue,confidential,inherit,sortOrderInVisitSchedule,sortOrderInListNoProgram,displayOnVisitSchedule,displayInListNoProgram,unique,programScope,orgunitScope,confidential,optionSet[id,version]', 'idb' ) );
+                    promise = promise.then( getD2Object( teAttribute.id, 'attributes', '../api/trackedEntityAttributes', 'fields=id,name,code,version,description,valueType,optionSetValue,confidential,inherit,sortOrderInVisitSchedule,sortOrderInListNoProgram,displayOnVisitSchedule,displayInListNoProgram,unique,programScope,orgunitScope,confidential,optionSet[id,version],trackedEntity[id,name]', 'idb' ) );
                 }
                 d.resolve();
             });