← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15964: tracker capture - when no attribute is set to mandatory, enforce filling at least one attribute s...

 

------------------------------------------------------------
revno: 15964
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Fri 2014-07-04 12:10:13 +0200
message:
  tracker capture - when no attribute is set to mandatory, enforce filling at least one attribute so that we avoid registering empty tei; WIP for registrtaion and enrollment operations from relationship widget.
removed:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-and-enrollment.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-and-relationship.html
added:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/tei.html
modified:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/add-relationship.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html
  dhis-2/dhis-web/dhis-web-tracker-capture/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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2014-06-30 05:56:38 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2014-07-04 10:10:13 +0000
@@ -35,24 +35,26 @@
     //if no program, display attributesInNoProgram
     $scope.processTeiAttributes = function(){        
  
-        if($scope.selectedProgram && $scope.selectedEnrollment){
-            //show attribute for selected program and enrollment
-            AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){    
-                $scope.selectedTei.attributes = $scope.showRequiredAttributes(atts,$scope.selectedTei.attributes, true);
-            }); 
-        }
-        if($scope.selectedProgram && !$scope.selectedEnrollment){
-            //show attributes for selected program            
-            AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){    
-                $scope.selectedTei.attributes = $scope.showRequiredAttributes(atts,$scope.selectedTei.attributes, false);
-            }); 
-        }
-        if(!$scope.selectedProgram && !$scope.selectedEnrollment){
-            //show attributes in no program            
-            AttributesFactory.getWithoutProgram().then(function(atts){                
-                $scope.selectedTei.attributes = $scope.showRequiredAttributes(atts,$scope.selectedTei.attributes, false);                
-            });
-        }        
+        if($scope.selectedTei.attributes){
+            if($scope.selectedProgram && $scope.selectedEnrollment){
+                //show attribute for selected program and enrollment
+                AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){    
+                    $scope.selectedTei.attributes = $scope.showRequiredAttributes(atts,$scope.selectedTei.attributes, true);
+                }); 
+            }
+            if($scope.selectedProgram && !$scope.selectedEnrollment){
+                //show attributes for selected program            
+                AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){    
+                    $scope.selectedTei.attributes = $scope.showRequiredAttributes(atts,$scope.selectedTei.attributes, false);
+                }); 
+            }
+            if(!$scope.selectedProgram && !$scope.selectedEnrollment){
+                //show attributes in no program            
+                AttributesFactory.getWithoutProgram().then(function(atts){                
+                    $scope.selectedTei.attributes = $scope.showRequiredAttributes(atts,$scope.selectedTei.attributes, false);                
+                });
+            }
+        }              
     };
     
     $scope.showRequiredAttributes = function(requiredAttributes, teiAttributes, fromEnrollment){        

=== removed file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-and-enrollment.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-and-enrollment.html	2014-07-03 11:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-and-enrollment.html	1970-01-01 00:00:00 +0000
@@ -1,102 +0,0 @@
-<div class="bordered-div col-md-12" ng-controller="RegistrationController">    
-    <div class="registration-container">
-        <form name="outerForm" novalidate>
-            
-            <div ng-if='!selectedProgram'>
-                <h3>{{'category' | translate}}</h3>
-                 <table class="table-borderless table-striped">
-                    <tr>
-                        <td>
-                            {{'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>                            
-                        </td>
-                    </tr>                   
-                </table>
-                <hr>
-            </div>
-            
-            <h3>{{'profile' | translate}}</h3>
-            <table class="table-borderless table-striped">
-                <tr ng-repeat="attribute in attributes">
-                    <td>
-                        {{attribute.name}}
-                    </td>
-                    <td>
-                        <ng-form name="innerForm">     
-                            <div ng-switch="attribute.valueType">
-                                <div ng-switch-when="date">
-                                    <input type="text" name="foo" class="form-control" ng-date ng-model="attribute.value" ng-required="attribute.mandatory" />
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                                <div ng-switch-when="trueOnly">
-                                    <input type="checkbox" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory" />
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                                <div ng-switch-when="bool">
-                                    <select name="foo" ng-model="attribute.value" class="form-control" ng-required="attribute.mandatory">
-                                        <option value="">{{'please_select'| translate}}</option>                        
-                                        <option value="0">{{'no'| translate}}</option>
-                                        <option value="1">{{'yes'| translate}}</option>
-                                    </select>
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                                <div ng-switch-when="optionSet">
-                                    <input type="text"
-                                           name="foo"
-                                           class="form-control"
-                                           ng-model="attribute.value"                                                 
-                                           typeahead="option for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
-                                           typeahead-open-on-focus
-                                           ng-required="attribute.mandatory"
-                                           />
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                                <div ng-switch-when="number">
-                                    <input type="number" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                                <div ng-switch-default>
-                                    <input type="text" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                            </div>
-                        </ng-form>
-                    </td>
-                </tr>                        
-            </table>
-            
-            <div ng-if='selectedProgram'>
-                <hr>
-                <h3>{{'enrollment' | translate}}</h3>
-                <table class="dhis2-list-table-striped dhis2-table-hover">
-                    <tr>
-                        <td>
-                            {{selectedProgram.dateOfEnrollmentDescription}}
-                        </td>
-                        <td>
-                            <input type="text" name="dateOfEnrollment" class="form-control" ng-date ng-model="enrollment.incidentDate" ng-required="true"/>
-                            <span ng-show="outerForm.submitted && outerForm.dateOfEnrollment.$invalid" class="error">{{'required'| translate}}</span>
-                        </td>
-                    </tr>     
-                    <tr ng-if="selectedProgram.displayIncidentDate">
-                        <td>
-                            {{selectedProgram.dateOfIncidentDescription}}
-                        </td>
-                        <td>
-                            <input type="text" class="form-control" ng-date ng-model="enrollment.enrollmentDate" />
-                        </td>
-                    </tr>
-                </table>
-            </div>
-            
-            <div class="vertical-spacing">                
-                <button type="button" class="btn btn-primary" ng-click="registerEntity(true)">{{'save_and_continue'| translate}}</button>
-                <button type="button" class="btn btn-success small-horizonal-spacing" ng-click="registerEntity(false)">{{'save_and_add_new'| translate}}</button>
-                <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="showRegistration()">{{'cancel'| translate}}</button>
-            </div>
-        </form>
-    </div>
-</div>
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-and-relationship.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-and-relationship.html	2014-07-03 11:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-and-relationship.html	1970-01-01 00:00:00 +0000
@@ -1,102 +0,0 @@
-<div class="bordered-div col-md-12" ng-controller="RegistrationController">    
-    <div class="registration-container">
-        <form name="outerForm" novalidate>
-            
-            <div ng-if='!selectedProgram'>
-                <h3>{{'category' | translate}}</h3>
-                 <table class="table-borderless table-striped">
-                    <tr>
-                        <td>
-                            {{'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>                            
-                        </td>
-                    </tr>                   
-                </table>
-                <hr>
-            </div>
-            
-            <h3>{{'profile' | translate}}</h3>
-            <table class="table-borderless table-striped">
-                <tr ng-repeat="attribute in attributes">
-                    <td>
-                        {{attribute.name}}
-                    </td>
-                    <td>
-                        <ng-form name="innerForm">     
-                            <div ng-switch="attribute.valueType">
-                                <div ng-switch-when="date">
-                                    <input type="text" name="foo" class="form-control" ng-date ng-model="attribute.value" ng-required="attribute.mandatory" />
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                                <div ng-switch-when="trueOnly">
-                                    <input type="checkbox" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory" />
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                                <div ng-switch-when="bool">
-                                    <select name="foo" ng-model="attribute.value" class="form-control" ng-required="attribute.mandatory">
-                                        <option value="">{{'please_select'| translate}}</option>                        
-                                        <option value="0">{{'no'| translate}}</option>
-                                        <option value="1">{{'yes'| translate}}</option>
-                                    </select>
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                                <div ng-switch-when="optionSet">
-                                    <input type="text"
-                                           name="foo"
-                                           class="form-control"
-                                           ng-model="attribute.value"                                                 
-                                           typeahead="option for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
-                                           typeahead-open-on-focus
-                                           ng-required="attribute.mandatory"
-                                           />
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                                <div ng-switch-when="number">
-                                    <input type="number" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                                <div ng-switch-default>
-                                    <input type="text" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
-                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                                </div>
-                            </div>
-                        </ng-form>
-                    </td>
-                </tr>                        
-            </table>
-            
-            <div ng-if='selectedProgram'>
-                <hr>
-                <h3>{{'enrollment' | translate}}</h3>
-                <table class="dhis2-list-table-striped dhis2-table-hover">
-                    <tr>
-                        <td>
-                            {{selectedProgram.dateOfEnrollmentDescription}}
-                        </td>
-                        <td>
-                            <input type="text" name="dateOfEnrollment" class="form-control" ng-date ng-model="enrollment.incidentDate" ng-required="true"/>
-                            <span ng-show="outerForm.submitted && outerForm.dateOfEnrollment.$invalid" class="error">{{'required'| translate}}</span>
-                        </td>
-                    </tr>     
-                    <tr ng-if="selectedProgram.displayIncidentDate">
-                        <td>
-                            {{selectedProgram.dateOfIncidentDescription}}
-                        </td>
-                        <td>
-                            <input type="text" class="form-control" ng-date ng-model="enrollment.enrollmentDate" />
-                        </td>
-                    </tr>
-                </table>
-            </div>
-            
-            <div class="vertical-spacing">                
-                <button type="button" class="btn btn-primary" ng-click="registerEntity(true)">{{'save_and_continue'| translate}}</button>
-                <button type="button" class="btn btn-success small-horizonal-spacing" ng-click="registerEntity(false)">{{'save_and_add_new'| translate}}</button>
-                <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="showRegistration()">{{'cancel'| translate}}</button>
-            </div>
-        </form>
-    </div>
-</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2014-07-02 16:25:28 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2014-07-04 10:10:13 +0000
@@ -12,6 +12,7 @@
     //do translation of the registration page
     TranslationService.translate();   
     
+    $scope.valueExists = false;
     $scope.selectedOrgUnit = storage.get('SELECTED_OU');
     $scope.enrollment = {enrollmentDate: '', incidentDate: ''};   
     
@@ -51,14 +52,23 @@
         }
         
         //get tei attributes and their values
+        //but there could be a case where attributes are non-mandatory and
+        //registration form comes empty, in this case enforce at least one value
+        $scope.valueExists = false;
         var registrationAttributes = [];    
         angular.forEach($scope.attributes, function(attribute){
             if(!angular.isUndefined(attribute.value)){
                 var att = {attribute: attribute.id, value: attribute.value};
                 registrationAttributes.push(att);
+                $scope.valueExists = true;
             } 
         });       
         
+        if(!$scope.valueExists){
+            //registration form is empty
+            return false;
+        }
+        
         //prepare tei model and do registration
         $scope.tei = {trackedEntity: selectedTrackedEntity, orgUnit: $scope.selectedOrgUnit.id, attributes: registrationAttributes };   
         var teiId = '';

=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	2014-07-04 10:10:13 +0000
@@ -0,0 +1,107 @@
+<div class="bordered-div col-md-12" ng-controller="RegistrationController">    
+    <div class="registration-container">
+        <form name="outerForm" novalidate>
+            
+            <div ng-if='!selectedProgram'>
+                <h3>{{'category' | translate}}</h3>
+                 <table class="table-borderless table-striped">
+                    <tr>
+                        <td>
+                            {{'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>                            
+                        </td>
+                    </tr>                   
+                </table>
+                <hr>
+            </div>
+            
+            <h3>{{'profile' | translate}}</h3>
+            <table class="table-borderless table-striped">
+                <tr ng-repeat="attribute in attributes">
+                    <td>
+                        {{attribute.name}}
+                    </td>
+                    <td>
+                        <ng-form name="innerForm">     
+                            <div ng-switch="attribute.valueType">
+                                <div ng-switch-when="date">
+                                    <input type="text" name="foo" class="form-control" ng-date ng-model="attribute.value" ng-required="attribute.mandatory" />
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                                <div ng-switch-when="trueOnly">
+                                    <input type="checkbox" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory" />
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                                <div ng-switch-when="bool">
+                                    <select name="foo" ng-model="attribute.value" class="form-control" ng-required="attribute.mandatory">
+                                        <option value="">{{'please_select'| translate}}</option>                        
+                                        <option value="0">{{'no'| translate}}</option>
+                                        <option value="1">{{'yes'| translate}}</option>
+                                    </select>
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                                <div ng-switch-when="optionSet">
+                                    <input type="text"
+                                           name="foo"
+                                           class="form-control"
+                                           ng-model="attribute.value"                                                 
+                                           typeahead="option for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
+                                           typeahead-open-on-focus
+                                           ng-required="attribute.mandatory"
+                                           />
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                                <div ng-switch-when="number">
+                                    <input type="number" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                                <div ng-switch-default>
+                                    <input type="text" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                            </div>
+                        </ng-form>
+                    </td>
+                </tr>                        
+            </table>
+            
+            <div ng-if='selectedProgram'>
+                <hr>
+                <h3>{{'enrollment' | translate}}</h3>
+                <table class="dhis2-list-table-striped dhis2-table-hover">
+                    <tr>
+                        <td>
+                            {{selectedProgram.dateOfEnrollmentDescription}}
+                        </td>
+                        <td>
+                            <input type="text" name="dateOfEnrollment" class="form-control" ng-date ng-model="enrollment.incidentDate" ng-required="true"/>
+                            <span ng-show="outerForm.submitted && outerForm.dateOfEnrollment.$invalid" class="error">{{'required'| translate}}</span>
+                        </td>
+                    </tr>     
+                    <tr ng-if="selectedProgram.displayIncidentDate">
+                        <td>
+                            {{selectedProgram.dateOfIncidentDescription}}
+                        </td>
+                        <td>
+                            <input type="text" class="form-control" ng-date ng-model="enrollment.enrollmentDate" />
+                        </td>
+                    </tr>
+                </table>
+            </div>
+            
+            
+            <div ng-if="!valueExists  && outerForm.submitted">
+                <div class="alert alert-warning">{{'form_is_empty_fill_at_least_one'| translate}}</div> 
+            </div>
+            
+            <div class="vertical-spacing">                
+                <button type="button" class="btn btn-primary" ng-click="registerEntity(true)">{{'save_and_continue'| translate}}</button>
+                <button type="button" class="btn btn-success small-horizonal-spacing" ng-click="registerEntity(false)">{{'save_and_add_new'| translate}}</button>
+                <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="showRegistration()">{{'cancel'| translate}}</button>
+            </div>
+        </form>
+    </div>
+</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/add-relationship.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/add-relationship.html	2014-07-03 12:40:31 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/add-relationship.html	2014-07-04 10:10:13 +0000
@@ -32,26 +32,54 @@
             </div>
             <div class="col-md-7">
                 <div class='align-center bold'>B ({{selectedRelationshipType.bIsToA}})</div>
-                <div class='relationship-container'>      
+                <div class='relationship-container' ng-show="teiForRelationship">
+                    <table class="table table-striped table-compact table-borderless">
+                        <tr ng-repeat="gridColumn in gridColumns">
+                            <td>
+                                {{gridColumn.name}}
+                            </td>
+                            <td >                                                
+                                {{teiForRelationship[gridColumn.id]}}                                                
+                            </td> 
+                        </tr>
+                    </table>
+                </div>
+                <div class='relationship-container' ng-show="!teiForRelationship">      
                     <select ng-model="selectedRelationshipSource"
                             class="form-control"
                             ng-options="relationshipSource | translate for relationshipSource in relationshipSources">
                         <option value="">{{'please_select_source'| translate}}</option>
                     </select>
-
-                    <div id="searchDropDownParent" class="input-group vertical-spacing" ng-show="selectedRelationshipSource === 'search_from_existing'">
-                        <input type="text" placeholder="{{'search_from_existing'| translate}}" ng-model="searchText" class="form-control expanded" ng-class="{true: 'invalid - input'} [!searchText && emptySearchText]" ng-focus="showHideSearch()">
+                    <div class="input-group vertical-spacing" ng-if="selectedRelationshipSource === 'search_from_existing'">
+                        <input type="text" placeholder="{{'type_here_for_simple_search'| translate}}" ng-model="searchText.value" class="form-control expanded" ng-class="{true: 'invalid - input'} [!searchText && emptySearchText]" ng-focus="showHideSearch(true)">
                         <div class="input-group-btn">
-                            <button class="btn btn-default without-border-radius trim" type="button" title="{{'advanced_search'| translate}}" data-toggle="dropdown" ng-click="showHideSearch()"><i class="fa fa-caret-down"></i></button>
-                            <button class="btn btn-primary trim" type="button" title="{{'search'| translate}}" ng-click="search(searchMode.freeText)"><i class="fa fa-search"></i></button>
-                            <div id="searchDropDown" class="dropdown-menu dropdown-menu-right">
-                                <form ng-include="'views/search.html'">                       
-                                </form>                    
-                            </div>
+                            <button class="btn btn-default without-border-radius trim" type="button" title="{{'advanced_search'| translate}}" ng-click="showHideSearch(false)"><i class="fa fa-caret-down"></i></button>
+                            <button class="btn btn-primary trim" type="button" title="{{'search'| translate}}" ng-click="search(searchMode.freeText)"><i class="fa fa-search"></i></button>                            
                         </div>                
                     </div>
-                    <div ng-show="selectedRelationshipSource === 'register_new'">
-                        <div ng-include="'components/registration/registration-and-relationship.html'"></div>
+                    <div ng-if="showSearchDiv && selectedRelationshipSource === 'search_from_existing'">
+                        <!--<form ng-include="'components/relationship/search.html'">                       
+                        </form>  -->
+                        <div ng-include="'components/relationship/search.html'"></div>     
+                        <span>&nbsp;</span>
+                    </div>
+                    <!-- entity grid begins -->
+                    <div class="row" ng-if="showTrackedEntityDiv">
+                        <img class="col-md-12" src="../images/ajax-loader-bar.gif" ng-if="!teiFetched"/>
+                        <div class="col-md-12" ng-include="'components/relationship/tei.html'"></div>                        
+                    </div>
+                    <!-- entity grid ends -->
+
+                    <!--- Error display for search begins -->
+                    <div class="row" ng-if="emptySearchAttribute || !searchText.value && emptySearchText">
+                        <div class="col-md-12 vertical-spacing">
+                            <div class="alert alert-danger">{{'search_input_required'| translate}}</div>         
+                        </div>
+                    </div>
+                    <!--- Error display for search ends -->
+
+                    <div ng-if="selectedRelationshipSource === 'register_new'">
+                        <div ng-include="'components/relationship/registration.html'"></div>
                     </div>
                 </div>
             </div>

=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html	2014-07-04 10:10:13 +0000
@@ -0,0 +1,102 @@
+<div ng-controller="RegistrationController">    
+
+        <form name="outerForm" novalidate>
+            
+            <div ng-if='!selectedProgram'>
+                <h3>{{'category' | translate}}</h3>
+                 <table class="table-borderless table-striped">
+                    <tr>
+                        <td>
+                            {{'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>                            
+                        </td>
+                    </tr>                   
+                </table>
+                <hr>
+            </div>
+            
+            <h3>{{'profile' | translate}}</h3>
+            <table class="table-borderless table-striped">
+                <tr ng-repeat="attribute in attributes">
+                    <td>
+                        {{attribute.name}}
+                    </td>
+                    <td>
+                        <ng-form name="innerForm">     
+                            <div ng-switch="attribute.valueType">
+                                <div ng-switch-when="date">
+                                    <input type="text" name="foo" class="form-control" ng-date ng-model="attribute.value" ng-required="attribute.mandatory" />
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                                <div ng-switch-when="trueOnly">
+                                    <input type="checkbox" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory" />
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                                <div ng-switch-when="bool">
+                                    <select name="foo" ng-model="attribute.value" class="form-control" ng-required="attribute.mandatory">
+                                        <option value="">{{'please_select'| translate}}</option>                        
+                                        <option value="0">{{'no'| translate}}</option>
+                                        <option value="1">{{'yes'| translate}}</option>
+                                    </select>
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                                <div ng-switch-when="optionSet">
+                                    <input type="text"
+                                           name="foo"
+                                           class="form-control"
+                                           ng-model="attribute.value"                                                 
+                                           typeahead="option for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
+                                           typeahead-open-on-focus
+                                           ng-required="attribute.mandatory"
+                                           />
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                                <div ng-switch-when="number">
+                                    <input type="number" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                                <div ng-switch-default>
+                                    <input type="text" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
+                            </div>
+                        </ng-form>
+                    </td>
+                </tr>                        
+            </table>
+            
+            <div ng-if='selectedProgram'>
+                <hr>
+                <h3>{{'enrollment' | translate}}</h3>
+                <table class="dhis2-list-table-striped dhis2-table-hover">
+                    <tr>
+                        <td>
+                            {{selectedProgram.dateOfEnrollmentDescription}}
+                        </td>
+                        <td>
+                            <input type="text" name="dateOfEnrollment" class="form-control" ng-date ng-model="enrollment.incidentDate" ng-required="true"/>
+                            <span ng-show="outerForm.submitted && outerForm.dateOfEnrollment.$invalid" class="error">{{'required'| translate}}</span>
+                        </td>
+                    </tr>     
+                    <tr ng-if="selectedProgram.displayIncidentDate">
+                        <td>
+                            {{selectedProgram.dateOfIncidentDescription}}
+                        </td>
+                        <td>
+                            <input type="text" class="form-control" ng-date ng-model="enrollment.enrollmentDate" />
+                        </td>
+                    </tr>
+                </table>
+            </div>
+            
+            <div class="vertical-spacing">                
+                <button type="button" class="btn btn-primary" ng-click="registerEntity(true)">{{'save_and_continue'| translate}}</button>
+                <button type="button" class="btn btn-success small-horizonal-spacing" ng-click="registerEntity(false)">{{'save_and_add_new'| translate}}</button>
+                <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="closeRegistration()">{{'cancel'| translate}}</button>
+            </div>
+        </form>
+
+</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js	2014-07-03 11:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js	2014-07-04 10:10:13 +0000
@@ -7,19 +7,20 @@
 
     TranslationService.translate();        
 
-    $scope.relationshipTypes = [];    
+    $scope.relationshipTypes = []; 
     
     RelationshipFactory.getAll().then(function(rels){
         $scope.relationshipTypes = rels;    
     }); 
     
+    
     //listen for the selected entity       
     $scope.$on('dashboard', function(event, args) { 
-        var selections = CurrentSelection.get();
-        $scope.selectedTei = angular.copy(selections.tei);
-        $scope.trackedEntity = selections.te;
-        $scope.selectedProgram = selections.pr;   
-        $scope.selectedEnrollment = selections.enrollment;     
+        $scope.selections = CurrentSelection.get();
+        $scope.selectedTei = angular.copy($scope.selections.tei);
+        $scope.trackedEntity = $scope.selections.te;
+        $scope.selectedProgram = $scope.selections.pr;   
+        $scope.selectedEnrollment = $scope.selections.enrollment;     
 
     });
     
@@ -32,6 +33,9 @@
                 relationshipTypes: function () {
                     return $scope.relationshipTypes;
                 },
+                selections: function () {
+                    return $scope.selections;
+                },
                 selectedTei: function(){
                     return $scope.selectedTei;
                 }
@@ -41,24 +45,237 @@
         modalInstance.result.then(function (relationships) {
             $scope.selectedTei.relationships = relationships;
         });
-    };     
+    };   
+    
 })
 
 //Controller for adding new relationship
 .controller('AddRelationshipController', 
     function($scope, 
+            OperatorFactory,
+            AttributesFactory,
+            EntityQueryFactory,
+            TEIService,
+            TEIGridService,
+            Paginator,
+            storage,
             $modalInstance, 
             relationshipTypes,
+            selections,
             selectedTei){
     
     $scope.relationshipTypes = relationshipTypes;
     $scope.selectedTei = selectedTei;
     $scope.relationshipSources = ['search_from_existing','register_new'];
     
+    //Selection
+    $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+    $scope.selectedProgram = selections.pr;
+    $scope.selectedTei = selections.tei;
+    
+    
+    $scope.ouModes = [{name: 'SELECTED'}, 
+                    {name: 'CHILDREN'}, 
+                    {name: 'DESCENDANTS'},
+                    {name: 'ACCESSIBLE'}
+                  ];         
+    $scope.selectedOuMode = $scope.ouModes[0];
+    
+    //Paging
+    $scope.pager = {pageSize: 50, page: 1, toolBarDisplay: 5};   
+    
+    //EntityList
+    $scope.showTrackedEntityDiv = false;
+    
+    //Searching
+    $scope.showSearchDiv = false;
+    $scope.searchText = {value: null};
+    $scope.emptySearchText = false;
+    $scope.searchFilterExists = false;   
+    $scope.defaultOperators = OperatorFactory.defaultOperators;
+    $scope.boolOperators = OperatorFactory.boolOperators;
+    
+    $scope.trackedEntityList = null; 
+    $scope.enrollment = {programStartDate: '', programEndDate: '', operator: $scope.defaultOperators[0]};
+   
+    $scope.searchMode = { 
+                            listAll: 'LIST_ALL', 
+                            freeText: 'FREE_TEXT', 
+                            attributeBased: 'ATTRIBUTE_BASED'
+                        };
+    
+    if($scope.selectedProgram){
+        AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
+            $scope.attributes = atts; 
+            $scope.attributes = $scope.generateAttributeFilters($scope.attributes);
+            $scope.gridColumns = $scope.generateGridColumns($scope.attributes);
+        });           
+    }
+    else{
+        AttributesFactory.getWithoutProgram().then(function(atts){
+            $scope.attributes = atts;  
+            $scope.attributes = $scope.generateAttributeFilters($scope.attributes);
+            $scope.gridColumns = $scope.generateGridColumns($scope.attributes);
+        });
+    }
+   
+    $scope.search = function(mode){ 
+        
+        $scope.teiForRelationship = null;
+        $scope.teiFetched = false;    
+        $scope.emptySearchText = false;
+        $scope.emptySearchAttribute = false;
+        $scope.showSearchDiv = false;
+        $scope.showRegistrationDiv = false;  
+        $scope.showTrackedEntityDiv = false;
+        $scope.trackedEntityList = null; 
+        $scope.teiCount = null;
+
+        $scope.queryUrl = null;
+        $scope.programUrl = null;
+        $scope.attributeUrl = {url: null, hasValue: false};
+        
+        $scope.selectedSearchMode = mode;
+        $scope.attributes = $scope.generateAttributeFilters($scope.attributes);
+        $scope.gridColumns = $scope.generateGridColumns($scope.attributes);
+   
+        if($scope.selectedProgram){
+            $scope.programUrl = 'program=' + $scope.selectedProgram.id;
+        }        
+        
+        //check search mode
+        if( $scope.selectedSearchMode === $scope.searchMode.freeText ){ 
+            
+            if(!$scope.searchText.value){                
+                $scope.emptySearchText = true;
+                $scope.teiFetched = false;   
+                $scope.teiCount = null;
+                return;
+            }       
+ 
+            $scope.queryUrl = 'query=' + $scope.searchText.value;                     
+        }
+        
+        if( $scope.selectedSearchMode === $scope.searchMode.attributeBased ){            
+            $scope.searchText.value = null;
+            $scope.attributeUrl = EntityQueryFactory.getAttributesQuery($scope.attributes, $scope.enrollment);
+            
+            if(!$scope.attributeUrl.hasValue && !$scope.selectedProgram){
+                $scope.emptySearchAttribute = true;
+                $scope.teiFetched = false;   
+                $scope.teiCount = null;
+                return;
+            }
+        }
+        
+        $scope.doSearch();
+    };
+    
+    $scope.doSearch = function(){
+
+        //get events for the specified parameters
+        TEIService.search($scope.selectedOrgUnit.id, 
+                                            $scope.selectedOuMode.name,
+                                            $scope.queryUrl,
+                                            $scope.programUrl,
+                                            $scope.attributeUrl.url,
+                                            $scope.pager).then(function(data){
+            //$scope.trackedEntityList = data;            
+            if(data.rows){
+                $scope.teiCount = data.rows.length;
+            }                    
+            
+            if( data.metaData.pager ){
+                $scope.pager = data.metaData.pager;
+                $scope.pager.toolBarDisplay = 5;
+
+                Paginator.setPage($scope.pager.page);
+                Paginator.setPageCount($scope.pager.pageCount);
+                Paginator.setPageSize($scope.pager.pageSize);
+                Paginator.setItemCount($scope.pager.total);                    
+            }
+            
+            //process tei grid
+            $scope.trackedEntityList = TEIGridService.format(data);
+            $scope.showTrackedEntityDiv = true;
+            $scope.teiFetched = true;            
+        });
+    };
+    
+    $scope.jumpToPage = function(){
+        $scope.search($scope.selectedSearchMode);
+    };
+    
+    $scope.resetPageSize = function(){
+        $scope.pager.page = 1;        
+        $scope.search($scope.selectedSearchMode);
+    };
+    
+    $scope.getPage = function(page){    
+        $scope.pager.page = page;
+        $scope.search($scope.selectedSearchMode);
+    };
+    
+    $scope.generateAttributeFilters = function(attributes){
+
+        angular.forEach(attributes, function(attribute){
+            if(attribute.valueType === 'number' || attribute.valueType === 'date'){
+                attribute.operator = $scope.defaultOperators[0];
+            }
+        });
+                    
+        return attributes;
+    };
+
+    //generate grid columns from teilist attributes
+    $scope.generateGridColumns = function(attributes){
+
+        var columns = attributes ? angular.copy(attributes) : [];
+       
+        //also add extra columns which are not part of attributes (orgunit for example)
+        columns.push({id: 'orgUnitName', name: 'Organisation unit', type: 'string', displayInListNoProgram: false});
+        columns.push({id: 'created', name: 'Registration date', type: 'string', displayInListNoProgram: false});
+        
+        //generate grid column for the selected program/attributes
+        angular.forEach(columns, function(column){
+            if(column.id === 'orgUnitName' && $scope.selectedOuMode.name !== 'SELECTED'){
+                column.show = true;
+            }
+            
+            if(column.displayInListNoProgram){
+                column.show = true;
+            }           
+           
+            if(column.type === 'date'){
+                 $scope.filterText[column.id]= {start: '', end: ''};
+            }
+        });        
+        return columns;        
+    };   
+    
+    $scope.showHideSearch = function(simpleSearch){
+        if(simpleSearch){
+            $scope.showSearchDiv = false;
+        }
+        else{
+            $scope.showSearchDiv = !$scope.showSearchDiv;
+        }        
+    };    
+    
     $scope.close = function () {
       $modalInstance.close('');
     };
     
+    $scope.closeRegistration = function(){
+        console.log('registration close');
+        $scope.selectedRelationshipSource = '';
+    };
+    
+    $scope.assignRelationship = function(selectedTei){
+        $scope.teiForRelationship = selectedTei;     
+        console.log('selected is:  ', $scope.teiForRelationship);
+    };
+    
     $scope.add = function(){       
         console.log('I will add new relationship');     
     };    

=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html	2014-07-04 10:10:13 +0000
@@ -0,0 +1,115 @@
+<div class="search-container-main">
+    <div class="search-container">    
+        <table data-stop-propagation="true" class="table-borderless table-striped">
+            <tr>
+                <td>{{'org_unit'| translate}}</td>
+                <td>                    
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="selected" value="SELECTED"> {{'SELECTED'| translate}}</label><br/>
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="children" value="CHILDREN"> {{'CHILDREN'| translate}}</label><br/>
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="descendants" value="DESCENDANTS"> {{'DESCENDANTS'| translate}}</label><br/>
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="accessible" value="ACCESSIBLE"> {{'ACCESSIBLE'| translate}}</label>
+                </td>
+            </tr>
+            <tr ng-if="selectedProgram">
+                <td>{{'enrollment_date'| translate}}</td>
+                <td>
+                    <div class="dataelement-filter">
+                        <div class="filter-operator">
+                            <select ng-model="enrollment.operator" class="form-control-select2" ng-options="operator | translate for operator in defaultOperators">
+                            </select>
+                        </div>
+                        <div class="filter-value" ng-show="enrollment.operator === defaultOperators[0]">
+                            <input type="text" placeholder="{{'exact_date'| translate}}" class="form-control-select2" ng-date ng-model="enrollment.programExactDate"/>
+                        </div>
+                        <div class="filter-value" ng-show="enrollment.operator === defaultOperators[1]">
+                            <div class="container-1-2">
+                                <input type="text" placeholder="{{'start_date'| translate}}" class="form-control-select2" ng-date ng-model="enrollment.programStartDate"/>
+                            </div>
+                            <div class="container-1-2">
+                                <input type="text" placeholder="{{'end_date'| translate}}" class="form-control-select2" ng-date ng-model="enrollment.programEndDate"/>                
+                            </div>
+                        </div>                    
+                    </div>                
+                </td>
+            </tr>
+            <tr ng-repeat="attribute in attributes">
+                <td>
+                    {{attribute.name}}
+                </td>
+                <td>
+                    <div ng-switch="attribute.valueType">
+                        <div ng-switch-when="number">
+                            <div class="dataelement-filter">                                                
+                                <div class="filter-operator">
+                                    <select ng-model="attribute.operator" class="form-control-select2" ng-options="operator | translate for operator in defaultOperators">
+                                    </select>
+                                </div>
+                                <div class="filter-value" ng-show="attribute.operator === defaultOperators[0]">
+                                    <input type="number" placeholder="{{'exact_value'| translate}}" class="form-control-select2" ng-model="attribute.exactValue"/>
+                                </div>
+                                <div class="filter-value" ng-show="attribute.operator === defaultOperators[1]">
+                                    <div class="container-1-2">
+                                        <input type="number" placeholder="{{'from'| translate}}" class="form-control-select2" ng-model="attribute.startValue"/>
+                                    </div>
+                                    <div class="container-1-2">
+                                        <input type="number" placeholder="{{'to'| translate}}" class="form-control-select2" ng-model="attribute.endValue"/>                
+                                    </div>
+                                </div>                            
+                            </div>                        
+                        </div>
+                        <div ng-switch-when="date">
+                            <div class="dataelement-filter">
+                                <div class="filter-operator">
+                                    <select ng-model="attribute.operator" class="form-control-select2" ng-options="operator | translate for operator in defaultOperators">
+                                    </select>
+                                </div>
+                                <div class="filter-value" ng-show="attribute.operator === defaultOperators[0]">
+                                    <input type="text" placeholder="{{'exact_date'| translate}}" class="form-control-select2" ng-date ng-model="attribute.exactValue"/>
+                                </div>
+                                <div class="filter-value" ng-show="attribute.operator === defaultOperators[1]">
+                                    <div class="container-1-2">
+                                        <input type="text" placeholder="{{'start_date'| translate}}" class="form-control-select2" ng-date ng-model="attribute.startValue"/>
+                                    </div>
+                                    <div class="container-1-2">
+                                        <input type="text" placeholder="{{'end_date'| translate}}" class="form-control-select2" ng-date ng-model="attribute.endValue"/>                
+                                    </div>
+                                </div>                            
+                            </div> 
+                        </div>                        
+                        <div ng-switch-when="optionSet">
+                            <select multiple ui-select2  ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
+                                <option ng-repeat="option in attribute.optionSet.options" value="{{option}}">{{option}}</option>
+                            </select>
+                        </div>
+                        <div ng-switch-when="bool">
+                            <select multiple ui-select2  ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
+                                <option ng-repeat="option in boolOperators" value="{{option}}">{{option| translate}}</option>
+                            </select>
+                        </div> 
+                        <div ng-switch-default>
+                            <input type="text" class="form-control-select2" ng-model="attribute.value" /> 
+                        </div>
+                    </div>
+                </td>
+            </tr>         
+        </table>
+    </div>
+
+    <div class="horizonal-spacing">
+        <button type="button"
+                class="btn btn-primary"
+                ng-click="search(searchMode.attributeBased)">
+            {{'search'| translate}}
+        </button>
+        <button type="button" 
+                class="btn btn-success small-horizonal-spacing" 
+                ng-click="search(searchMode.listAll)">
+            {{'list_all'| translate}}
+        </button>
+        <button type="button" 
+                class="btn btn-default small-horizonal-spacing" 
+                ng-click="showHideSearch()">
+            {{'cancel'| translate}}
+        </button>
+    </div>
+</div>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/tei.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/tei.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/tei.html	2014-07-04 10:10:13 +0000
@@ -0,0 +1,39 @@
+<div ng-switch="teiCount">                    
+    <div ng-switch-when="undefined">
+        <div class="alert alert-warning vertical-spacing">
+            {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
+        </div>
+    </div>
+    <div ng-switch-when="0">  
+        <div class="alert alert-warning vertical-spacing">
+            {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
+        </div>
+    </div>    
+    <div ng-switch-default> 
+        
+        <!-- entity begins -->
+        <div class="vertical-spacing">
+            <table class="table table-striped dhis2-table-hover">               
+                <thead>                        
+                    <tr>
+                        <th ng-show="gridColumn.show" ng-repeat="gridColumn in gridColumns">
+                            {{gridColumn.name}}
+                        </th>                                    
+                    </tr>                        
+                </thead>
+                <tbody id="list">
+                    <tr ng-repeat="trackedEntity in trackedEntityList.rows" 
+                        ng-click="assignRelationship(trackedEntity)">
+                        <td ng-show="gridColumn.show"                                            
+                            ng-repeat="gridColumn in gridColumns">                                                
+                            {{trackedEntity[gridColumn.id]}}                                                
+                        </td>
+                    </tr>
+                </tbody>        
+            </table>
+        </div>
+        <!-- entity ends -->  
+        <serverside-paginator></serverside-paginator> 
+                  
+    </div>
+</div> 
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-07-03 11:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-07-04 10:10:13 +0000
@@ -26,11 +26,13 @@
     "search": "Search",
     "advanced_search": "Advanced search",
     "search_for": "Search for",
+    "type_here_for_simple_search": "Type your criteria here for simple search",
     "type_your_search_criteria_here": "Type your search criteria here",
     "search_input_required": "Please specify a search criteria",
     "registered_entities": "Registered entities",
     "empty_entity_list": "There are no registered entities",
     "empty": "Empty",
+    "form_is_empty_fill_at_least_one": "Form is empty, please fill at least one.",
     "total_number_of_pages": "No. of pages",
     "rows_per_page": "No. of rows per page",
     "jump_to_page": "Jump to page",
@@ -83,10 +85,10 @@
     "dataentry": "Data Entry",
     "current_selections": "Current selections",
     "org_unit": "Organisation unit",
-    "selected": "Selected",
-    "immediate_children": "Immediate children",
-    "all_children": "All children",
-    "all_accessible": "All accessible",
+    "SELECTED": "Selected",
+    "CHILDREN": "Immediate children",
+    "DESCENDANTS": "All children",
+    "ACCESSIBLE": "All accessible",
     "data_element": "Data element",
     "value": "Value",
     "provided_elsewhere": "Provided elsewhere",

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-07-03 11:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-07-04 10:10:13 +0000
@@ -21,13 +21,12 @@
     //Selection
     $scope.selectedOrgUnit = '';
     $scope.selectedProgram = '';
-    $scope.ouModes = [
-                    {name: 'SELECTED', id: 1}, 
-                    {name: 'CHILDREN', id: 2}, 
-                    {name: 'DESCENDANTS', id: 3},
-                    {name: 'ACCESSIBLE', id: 4}
-                  ];                  
-    $scope.ouMode = $scope.ouModes[0];
+    $scope.ouModes = [{name: 'SELECTED'}, 
+                    {name: 'CHILDREN'}, 
+                    {name: 'DESCENDANTS'},
+                    {name: 'ACCESSIBLE'}
+                  ];         
+    $scope.selectedOuMode = $scope.ouModes[0];
     
     //Paging
     $scope.pager = {pageSize: 50, page: 1, toolBarDisplay: 5};   
@@ -179,7 +178,7 @@
         
         if( $scope.selectedSearchMode === $scope.searchMode.attributeBased ){
             
-            $scope.attributeUrl = EntityQueryFactory.getQueryForAttributes($scope.attributes, $scope.enrollment);
+            $scope.attributeUrl = EntityQueryFactory.getAttributesQuery($scope.attributes, $scope.enrollment);
             
             if(!$scope.attributeUrl.hasValue && !$scope.selectedProgram){
                 $scope.emptySearchAttribute = true;
@@ -196,7 +195,7 @@
         
         //get events for the specified parameters
         TEIService.search($scope.selectedOrgUnit.id, 
-                                            $scope.ouMode.name,
+                                            $scope.selectedOuMode.name,
                                             $scope.queryUrl,
                                             $scope.programUrl,
                                             $scope.attributeUrl.url,
@@ -258,7 +257,7 @@
         
         //generate grid column for the selected program/attributes
         angular.forEach(columns, function(column){
-            if(column.id === 'orgUnitName' && $scope.ouMode.name !== 'SELECTED'){
+            if(column.id === 'orgUnitName' && $scope.selectedOuMode.name !== 'SELECTED'){
                 column.show = true;    
             }
             

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2014-07-03 11:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2014-07-04 10:10:13 +0000
@@ -138,7 +138,7 @@
     $("#searchDropDown").width(searchParentWidth);
     $('#searchDropDown').on('click', "[data-stop-propagation]", function(e) {
         e.stopPropagation();
-    });    
+    });   
 
 });
 

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html	2014-07-03 11:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html	2014-07-04 10:10:13 +0000
@@ -55,7 +55,7 @@
         </div>
 
         <div id="searchDropDownParent" class="input-group col-md-5">
-            <input type="text" placeholder="{{'type_your_search_criteria_here'| translate}}" ng-model="searchText" class="form-control expanded" ng-class="{true: 'invalid-input'} [!searchText && emptySearchText]" ng-focus="showHideSearch()" ng-disabled="showRegistrationDiv">
+            <input type="text" placeholder="{{'type_here_for_simple_search'| translate}}" ng-model="searchText" class="form-control expanded" ng-class="{true: 'invalid-input'} [!searchText && emptySearchText]" ng-focus="showHideSearch()" ng-disabled="showRegistrationDiv">
             <div class="input-group-btn">
                 <button class="btn btn-default without-border-radius trim" type="button" title="{{'advanced_search'| translate}}" data-toggle="dropdown" ng-click="showHideSearch()" ng-disabled="showRegistrationDiv"><i class="fa fa-caret-down"></i></button>
                 <button class="btn btn-primary trim" type="button" title="{{'search'| translate}}" ng-disabled="showRegistrationDiv" ng-click="search(searchMode.freeText)"><i class="fa fa-search"></i></button>
@@ -92,7 +92,7 @@
     <!--registration form begins -->
     <div class="row" ng-if="showRegistrationDiv">
         <div class="col-md-8">
-            <div ng-include="'components/registration/registration-and-enrollment.html'"></div>             
+            <div ng-include="'components/registration/registration.html'"></div>             
         </div>
     </div>
     <!-- registration form ends -->

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html	2014-07-03 12:40:31 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html	2014-07-04 10:10:13 +0000
@@ -3,11 +3,11 @@
         <table data-stop-propagation="true" class="table-borderless table-striped">
             <tr>
                 <td>{{'org_unit'| translate}}</td>
-                <td>
-                    <label><input type="radio" ng-model="ouMode.name" name="selected" value="SELECTED"> {{'selected'| translate}}</label><br/>
-                    <label><input type="radio" ng-model="ouMode.name" name="children" value="CHILDREN"> {{'immediate_children'| translate}}</label><br/>
-                    <label><input type="radio" ng-model="ouMode.name" name="descendants" value="DESCENDANTS"> {{'all_children'| translate}}</label><br/>
-                    <label><input type="radio" ng-model="ouMode.name" name="accessible" value="ACCESSIBLE"> {{'all_accessible'| translate}}</label>
+                <td>                    
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="selected" value="SELECTED"> {{'SELECTED'| translate}}</label><br/>
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="children" value="CHILDREN"> {{'CHILDREN'| translate}}</label><br/>
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="descendants" value="DESCENDANTS"> {{'DESCENDANTS'| translate}}</label><br/>
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="accessible" value="ACCESSIBLE"> {{'ACCESSIBLE'| translate}}</label>
                 </td>
             </tr>
             <tr ng-if="selectedProgram">

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/tei.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/tei.html	2014-06-30 15:43:13 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/tei.html	2014-07-04 10:10:13 +0000
@@ -1,11 +1,11 @@
 <div ng-switch="teiCount">                    
     <div ng-switch-when="undefined">
-        <div class="alert alert-warning vertical-spacing col-md-8">
+        <div class="alert alert-warning vertical-spacing">
             {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
         </div>
     </div>
     <div ng-switch-when="0">  
-        <div class="alert alert-warning vertical-spacing col-md-8">
+        <div class="alert alert-warning vertical-spacing">
             {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
         </div>
     </div>    
@@ -34,44 +34,6 @@
         </div>
         <!-- entity ends -->  
         <serverside-paginator></serverside-paginator> 
-                
-        <!--<div ng-switch="trackedEntityList.rows.length">
-            <div ng-switch-when="undefined">
-                <p>
-                    {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}}                        
-                </p>
-            </div>
-            <div ng-switch-when="0">
-                <p>
-                    {{'no'| translate}} {{selectedProgram.trackedEntity.name|| 'records' | translate}} {{'found'| translate}} 
-                </p>
-            </div>
-            <div ng-switch-default>
-                
-  
-                <div class="vertical-spacing">
-                    <table class="table table-striped dhis2-table-hover">               
-                        <thead>                        
-                            <tr>
-                                <th ng-show="gridColumn.show" ng-repeat="gridColumn in gridColumns">
-                                    {{gridColumn.name}}
-                                </th>                                    
-                            </tr>                        
-                        </thead>
-                        <tbody id="list">
-                            <tr ng-repeat="trackedEntity in trackedEntityList.rows" 
-                                ng-click="showDashboard(trackedEntity)">
-                                <td ng-show="gridColumn.show"                                            
-                                    ng-repeat="gridColumn in gridColumns">                                                
-                                    {{trackedEntity[gridColumn.id]}}                                                
-                                </td>
-                            </tr>
-                        </tbody>        
-                    </table>
-                </div>
-
-                <serverside-paginator></serverside-paginator>                    
-            </div>
-        </div>  -->                      
+                  
     </div>
 </div> 
\ No newline at end of file