← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18546: tracker-capure: reset relative search when OU is selected

 

------------------------------------------------------------
revno: 18546
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-10 09:57:34 +0100
message:
  tracker-capure: reset relative search when OU is selected
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/add-relationship.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.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/relationship/add-relationship.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/add-relationship.html	2015-02-24 13:10:51 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/add-relationship.html	2015-03-10 08:57:34 +0000
@@ -61,6 +61,7 @@
             <div class='relationship-container' ng-show="!teiForRelationship">
                 <select ng-model="selectedRelationshipSource.value"
                         class="form-control"
+                        ng-change='getRelative()'
                         ng-options="relationshipSource | translate for relationshipSource in relationshipSources">
                     <option value="">{{'please_select_source'| translate}}</option>
                 </select>

=== 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-03-06 14:43:54 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js	2015-03-10 08:57:34 +0000
@@ -206,6 +206,7 @@
     
     //set attributes as per selected program
     $scope.setAttributesForSearch = function(program){
+        
         $scope.selectedProgramForRelative = program;
         if( angular.isObject($scope.selectedProgramForRelative)){
             AttributesFactory.getByProgram($scope.selectedProgramForRelative).then(function(atts){
@@ -251,8 +252,7 @@
         $scope.teiForRelationship = relationshipInfo.tei;
     });
 
-    $scope.search = function(mode){ 
-        
+    var resetFields = function(){
         $scope.teiForRelationship = null;
         $scope.teiFetched = false;    
         $scope.emptySearchText = false;
@@ -266,6 +266,20 @@
         $scope.queryUrl = null;
         $scope.programUrl = null;
         $scope.attributeUrl = {url: null, hasValue: false};
+    };
+    
+    $scope.getRelative = function(){
+        
+        resetFields();
+        
+        if($scope.selectedRelationshipSource.value === $scope.relationshipSources[0]){
+            $scope.search($scope.searchMode.listAll);
+        }
+    };
+    
+    $scope.search = function(mode){ 
+        
+        resetFields();
         
         $scope.selectedSearchMode = mode;