← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18169: tracker-capture: centralized default/custom registration/enrollment/profile forms

 

------------------------------------------------------------
revno: 18169
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-02-03 18:12:51 +0100
message:
  tracker-capture: centralized default/custom registration/enrollment/profile forms
removed:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/default-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/custom-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-form.html
added:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/default-registration-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/enrollment-dates-form.html
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.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/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-02-03 15:59:38 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-02-03 17:12:51 +0000
@@ -11,6 +11,7 @@
                 CurrentSelection,
                 TEIService,
                 TEFormService,
+                CustomFormService,
                 EnrollmentService,
                 ModalService,
                 DialogService) {
@@ -18,8 +19,18 @@
     $scope.today = DateUtils.getToday();
     $scope.selectedOrgUnit = storage.get('SELECTED_OU');
     
+    $scope.attributes = [];
+    $scope.attributesById = [];
+    AttributesFactory.getAll().then(function(atts){
+        angular.forEach(atts, function(att){
+            $scope.attributesById[att.id] = att;
+        });
+    });
+    
     //listen for the selected items
+    var selections = {};
     $scope.$on('selectedItems', function(event, args) {   
+        $scope.attributes = [];
         $scope.enrollments = [];
         $scope.historicalEnrollments = [];
         $scope.showEnrollmentDiv = false;
@@ -30,8 +41,14 @@
         var selectedEnrollment = null;
         $scope.newEnrollment = {};
         
-        var selections = CurrentSelection.get();
+        selections = CurrentSelection.get();
+        
         $scope.selectedTei = angular.copy(selections.tei); 
+        angular.forEach($scope.selectedTei.attributes, function(att){
+            $scope.selectedTei[att.attribute] = att.value;
+        });
+        delete $scope.selectedTei.attributes;
+        
         $scope.selectedEntity = selections.te;
         $scope.selectedProgram = selections.pr;
         $scope.optionSets = selections.optionSets;
@@ -94,19 +111,16 @@
         
         if(!$scope.selectedEnrollment){//prepare for possible enrollment
             AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
-                $scope.attributes = atts;
-                $scope.attributesForEnrollment = [];
-                for(var i=0; i<atts.length; i++){
-                    var exists = false;
-                    for(var j=0; j<$scope.selectedTei.attributes.length && !exists; j++){
-                        if(atts[i].id === $scope.selectedTei.attributes[j].attribute){
-                            exists = true;                                
-                        }
-                    }
-                    if(!exists){
-                        $scope.attributesForEnrollment.push(atts[i]);
-                    }
-                }
+                $scope.attributes = atts;                
+                $scope.selectedProgram.hasCustomForm = false;               
+                TEFormService.getByProgram($scope.selectedProgram, atts).then(function(teForm){                    
+                    if(angular.isObject(teForm)){                        
+                        $scope.selectedProgram.hasCustomForm = true;
+                        $scope.selectedProgram.displayCustomForm = $scope.selectedProgram.hasCustomForm ? true:false;
+                        $scope.trackedEntityForm = teForm;
+                        $scope.customForm = CustomFormService.getForTrackedEntity($scope.trackedEntityForm, 'ENROLLMENT');
+                    }                    
+                });
             });                
         }
         
@@ -221,8 +235,17 @@
         });
     };
     
-    $scope.broadCastSelections = function(listeners){        
-        CurrentSelection.set({tei: $scope.selectedTei, te: $scope.selectedEntity, prs: $scope.programs, pr: $scope.selectedProgram, enrollments: $scope.enrollments, selectedEnrollment: $scope.selectedEnrollment, optionSets: $scope.optionSets});
+    $scope.broadCastSelections = function(listeners){
+        
+        var tei = angular.copy(selections.tei);
+        tei.attributes = [];
+        for(var k in $scope.attributesById){
+            if( $scope.selectedTei[k] ){
+                tei.attributes.push({attribute: $scope.attributesById[k].id, value: $scope.selectedTei[k], type: $scope.attributesById[k].valueType});
+            }
+        }
+        
+        CurrentSelection.set({tei: tei, te: $scope.selectedEntity, prs: $scope.programs, pr: $scope.selectedProgram, enrollments: $scope.enrollments, selectedEnrollment: $scope.selectedEnrollment, optionSets: $scope.optionSets});
         $timeout(function(){
             $rootScope.$broadcast(listeners, {});
         }, 100);
@@ -313,4 +336,8 @@
         EnrollmentService.update($scope.selectedEnrollment).then(function(data){         
         });
     };
+    
+    $scope.switchRegistrationForm = function(){
+        $scope.selectedProgram.displayCustomForm = !$scope.selectedProgram.displayCustomForm;
+    };
 });
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2015-01-20 16:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2015-02-03 17:12:51 +0000
@@ -1,18 +1,21 @@
 <div class="panel panel-info" ng-controller="EnrollmentController">
     <div class="panel-heading handle bold">
-        
+
         {{enrollmentWidget.title| translate}}
         <span class="nav-pills" ng-show="selectedProgram && currentEnrollment && currentEnrollment !== selectedEnrollment">
-            | <a href ng-click="loadEnrollmentDetails(currentEnrollment)" title="{{'current'| translate}}"><span ng-class="{true: 'widget-link-active', false: 'widget-link'} [showEnrollmentDiv]">{{'current'| translate}}</span></a>
+            | <a href ng-click="loadEnrollmentDetails(currentEnrollment)" title="{{'current'| translate}}"><span ng-class="{true: 'widget - link - active', false: 'widget - link'} [showEnrollmentDiv]">{{'current'| translate}}</span></a>
         </span>
         <span class="nav-pills" ng-show="selectedProgram && !currentEnrollment">
-            | <a href ng-click="showNewEnrollment()" title="{{'new'| translate}}"><span ng-class="{true: 'widget-link-active', false: 'widget-link'} [showEnrollmentDiv]">{{'new'| translate}}</span></a>
+            | <a href ng-click="showNewEnrollment()" title="{{'new'| translate}}"><span ng-class="{true: 'widget - link - active', false: 'widget - link'} [showEnrollmentDiv]">{{'new'| translate}}</span></a>
         </span>
         <span class="nav-pills" ng-show="hasEnrollmentHistory">
-            | <a href ng-click="showEnrollmentHistory()" title="{{'history'| translate}}"><span ng-class="{true: 'widget-link-active', false: 'widget-link'} [showEnrollmentHistoryDiv]">{{'history'| translate}}</span></a>
+            | <a href ng-click="showEnrollmentHistory()" title="{{'history'| translate}}"><span ng-class="{true: 'widget - link - active', false: 'widget - link'} [showEnrollmentHistoryDiv]">{{'history'| translate}}</span></a>
         </span>       
 
         <span class="pull-right widget-link">
+            <a ng-if="customForm" class="small-horizonal-spacing" href ng-click="switchRegistrationForm()" title="{{selectedProgram.displayCustomForm ? 'default_form' : 'custom_form'| translate}}">
+                <span><i class="fa fa-file-text"></i></span>
+            </a>
             <a class="small-horizonal-spacing" href ng-click="expandCollapse(enrollmentWidget)">
                 <span ng-show="enrollmentWidget.expand"><i class="fa fa-chevron-up" title="{{'collapse'| translate}}"></i></span>
                 <span ng-show="!enrollmentWidget.expand"><i class="fa fa-chevron-down" title="{{'expand'| translate}}"></i></span>
@@ -21,9 +24,10 @@
         </span>
     </div>
     <div ng-show="enrollmentWidget.expand" class="panel-body dashboard-widget-container">
+        
         <!-- operations on selected enrollment begins -->
         <div ng-if="selectedEnrollment">
-            
+
             <table class="table-borderless table-striped">
                 <tr class="col-md-12">
                     <td class="col-md-6">
@@ -76,127 +80,62 @@
                 </button>
 
             </div>
-            
+
         </div>
         <!-- operations on selected enrollment ends -->
 
         <!-- new enrollment registration form begins -->
         <form name="outerForm" novalidate>
             <div ng-if="showEnrollmentDiv">
-                <table class="table-borderless">
-                    <tr class="col-md-12">
-                        <td class="col-md-6">
-                            {{selectedProgram.dateOfEnrollmentDescription}}
-                        </td>
-                        <td class="col-md-6">
-                            <input type="text" 
-                                   placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
-                                   name="dateOfEnrollment" 
-                                   class="form-control" 
-                                   d2-date 
-                                   max-date="selectedProgram.selectEnrollmentDatesInFuture ? '' : 0"
-                                   ng-model="newEnrollment.dateOfEnrollment" 
-                                   ng-required="true"/>
-                            <span ng-show="outerForm.submitted && outerForm.dateOfEnrollment.$invalid" class="red">{{'required'| translate}}</span>
-                        </td>
-                    </tr>     
-                    <tr class="col-md-12" ng-if="selectedProgram.displayIncidentDate">
-                        <td class="col-md-6">
-                            {{selectedProgram.dateOfIncidentDescription}}
-                        </td>
-                        <td class="col-md-6">
-                            <input type="text" 
-                                   placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
-                                   class="form-control" 
-                                   d2-date
-                                   max-date="selectedProgram.selectIncidentDatesInFuture ? '' : 0"
-                                   ng-model="newEnrollment.dateOfIncident" 
-                                   max-date="today"/>
-                        </td>
-                    </tr>
-                </table>
-                <hr ng-if='attributesForEnrollment'>
-
-                <table class="table-borderless table-striped">
-                    <tr class="col-md-12" ng-repeat="attribute in attributesForEnrollment">
-                        <td class="col-md-6">
-                            {{attribute.name}}
-                        </td>
-                        <td class="col-md-6">
-                    <ng-form name="innerForm">
-                        <div ng-switch="attribute.valueType">
-                            <div ng-switch-when="date">
-                                <input type="text" 
-                                       placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
-                                       class="form-control" 
-                                       name="foo" 
-                                       max-date="attribute.allowFutureDate ? '' : 0"
-                                       d2-date 
-                                       ng-model="attribute.value" 
-                                       ng-required="attribute.mandatory"/>                                        
-                            </div>
-                            <div ng-switch-when="trueOnly">
-                                <input type="checkbox" class="form-control" name="foo" ng-model="attribute.value" ng-required="attribute.mandatory"/>                                        
-                            </div>
-                            <div ng-switch-when="bool">
-                                <select ng-model="attribute.value" name="foo" class="form-control" ng-required="attribute.mandatory">
-                                    <option value="">{{'please_select'| translate}}</option>                        
-                                    <option value="false">{{'no'| translate}}</option>
-                                    <option value="true">{{'yes'| translate}}</option>
-                                </select>                                        
-                            </div>
-                            <div ng-switch-when="optionSet">
-                                <div ng-if="!selectedProgram.dataEntryMethod || optionSets[attribute.optionSet.id].options.length >= 7">
-                                    <input type="text" 
-                                           name="foo"
-                                           class="form-control"
-                                           ng-model="attribute.value"                                                 
-                                           typeahead="option.name as option.name for option in optionSets[attribute.optionSet.id].options | filter:$viewValue | limitTo:20" 
-                                           typeahead-open-on-focus
-                                           typeahead-editable="false"
-                                           ng-required="attribute.mandatory"/>
-                                </div>
-                                <div ng-if="selectedProgram.dataEntryMethod && optionSets[attribute.optionSet.id].options.length < 7">
-                                    <label>                                        
-                                        <input type="radio"
-                                               name={{attribute.id}}
-                                               ng-required="attribute.mandatory"
-                                               ng-model="attribute.value"
-                                               value=""> {{'no_value'| translate}}<br>                                       
-                                    </label><br>
-                                    <span ng-repeat="option in optionSets[attribute.optionSet.id].options">
-                                        <label>
-                                            <input type="radio"
-                                                   name={{attribute.id}}
-                                                   ng-required="attribute.mandatory"
-                                                   ng-model="attribute.value" 
-                                                   value={{option.name}}> {{option.name}}
-                                        </label><br>
-                                    </span>                                            
-                                </div>
-                            </div>
-                            <div ng-switch-when="number">
-                                <input type="number" 
-                                       class="form-control" 
-                                       name="foo" 
-                                       ng-model="attribute.value" 
-                                       ng-required="attribute.mandatory"/>                                        
-                            </div>
-                            <div ng-switch-default>
-                                <input type="text" 
-                                       class="form-control" 
-                                       name="foo" 
-                                       ng-model="attribute.value" 
-                                       ng-required="attribute.mandatory"/>                                        
-                            </div>
-                        </div>
-                    </ng-form>
-                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" style="color:red;font-size:12px">{{'required'| translate}}</span>
-                    </td>
-                    </tr>                        
-                </table>
-
-                <div class="vertical-spacing col-md-12">            
+                <div class="row col-sm-12 vertical-spacing" ng-if="selectedProgram && selectedProgram.displayCustomForm">
+                    <div ng-if="!customForm.hasProgramDate">
+                        <table class="dhis2-list-table-striped dhis2-table-hover">
+                            <tr>
+                                <td>
+                                    {{selectedProgram.dateOfEnrollmentDescription}}
+                                </td>
+                                <td>
+                                    <input type="text" 
+                                           placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
+                                           name="dateOfEnrollment" 
+                                           class="form-control" 
+                                           d2-date 
+                                           ng-model="selectedEnrollment.dateOfEnrollment" 
+                                           max-date="selectedProgram.selectEnrollmentDatesInFuture ? '' : 0"
+                                           min-date=""
+                                           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" 
+                                           placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+                                           name="dateOfIncident"
+                                           class="form-control" 
+                                           d2-date 
+                                           max-date="selectedProgram.selectIncidentDatesInFuture ? '' : 0"
+                                           min-date=""
+                                           ng-model="selectedEnrollment.dateOfIncident"/>
+                                </td>
+                            </tr>
+                        </table>
+                    </div>
+                    <div ng-include="'../dhis-web-commons/customform/custom-form.html'"></div>
+                </div>
+                <div class="row col-sm-12 vertical-spacing" ng-if="!selectedProgram.displayCustomForm">
+                    <div ng-include="'views/enrollment-dates-form.html'"></div>
+                    <div ng-include="'views/default-registration-form.html'"></div>
+                </div>
+
+                <div ng-if="formEmpty && outerForm.submitted">
+                    <div class="alert alert-warning">{{'form_is_empty_fill_at_least_one'| translate}}</div> 
+                </div>
+
+                <div class="vertical-spacing row col-sm-12">            
                     <button type="button" 
                             class="btn btn-primary"
                             ng-click="enroll()">
@@ -237,6 +176,7 @@
         </div>
         <!-- operations on historical enrollment ends -->
 
+        <!-- various alerts begin -->
         <div ng-if="selectedProgram && !selectedEnrollment && !showEnrollmentDiv && !hasEnrollmentHistory">
             <div class="alert alert-warning">{{'not_yet_enrolled_enrollment'| translate}}</div> 
         </div>
@@ -249,6 +189,7 @@
         <div ng-if="!programExists">
             <div class="alert alert-danger">{{'no_program_exists_enrollment'| translate}}</div> 
         </div>
+        <!-- various alerts end -->
 
     </div>
 </div>
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/default-form.html	2015-02-03 15:59:38 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/default-form.html	1970-01-01 00:00:00 +0000
@@ -1,77 +0,0 @@
-<table class="table-borderless table-striped">
-    <tr ng-repeat="attribute in attributes">
-        <td>
-            {{attribute.name}}<span ng-if="attribute.mandatory" class="required">*</span>
-        </td>
-        <td>
-            <ng-form name="innerForm">
-                <span ng-switch="attribute.valueType">
-                    <span ng-switch-when="date">
-                        <input type="text" 
-                               placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
-                               name="foo" 
-                               class="form-control" 
-                               d2-date
-                               max-date="attribute.allowFutureDate ? '' : 0"
-                               ng-model="selectedTei[attribute.id]"
-                               ng-disabled="editingDisabled" 
-                               ng-required="attribute.mandatory"/>
-                    </span>
-                    <span ng-switch-when="trueOnly">
-                        <input type="checkbox" 
-                               name="foo" 
-                               class="form-control" 
-                               ng-model="selectedTei[attribute.id]" 
-                               ng-disabled="editingDisabled" 
-                               ng-required="attribute.mandatory"/>
-                    </span>
-                    <span ng-switch-when="bool">
-                        <select name="foo" 
-                                ng-model="selectedTei[attribute.id]" 
-                                class="form-control" 
-                                ng-disabled="editingDisabled" 
-                                ng-required="attribute.mandatory">
-                            <option value="">{{'please_select'| translate}}</option>                        
-                            <option value="false">{{'no'| translate}}</option>
-                            <option value="true">{{'yes'| translate}}</option>
-                        </select>
-                    </span>
-                    <span ng-switch-when="optionSet">
-                        <input type="text"
-                               name="foo"
-                               class="form-control"
-                               ng-model="selectedTei[attribute.id]"                                                 
-                               typeahead="option.name as option.name for option in optionSets[attributesById[attribute.id].optionSet.id].options | filter:$viewValue | limitTo:20" 
-                               typeahead-open-on-focus                                           
-                               ng-disabled="editingDisabled" ng-required="attribute.mandatory"/>
-                    </span>
-                    <span ng-switch-when="number">
-                        <input type="text" 
-                               name="foo" 
-                               class="form-control" 
-                               ng-model="selectedTei[attribute.id]" 
-                               ng-disabled="editingDisabled" 
-                               ng-required="attribute.mandatory"/>
-                    </span>
-                    <span ng-switch-when="email">
-                        <input type="email" 
-                               name="foo" 
-                               class="form-control" 
-                               ng-model="selectedTei[attribute.id]" 
-                               ng-disabled="editingDisabled" 
-                               ng-required="attribute.mandatory"/>
-                    </span>
-                    <span ng-switch-default>
-                        <input type="text" 
-                               name="foo" 
-                               class="form-control" 
-                               ng-model="selectedTei[attribute.id]" 
-                               ng-disabled="editingDisabled" 
-                               ng-required="attribute.mandatory"/>                                    
-                    </span>
-                </span>
-            </ng-form>
-            <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-        </td>
-    </tr>           
-</table>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html	2015-02-03 15:59:38 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html	2015-02-03 17:12:51 +0000
@@ -24,7 +24,7 @@
                     <div ng-include="'../dhis-web-commons/customform/custom-form.html'"></div>
                 </div>
                 <div class="vertical-spacing" ng-if="!selectedProgram.displayCustomForm">            
-                    <div ng-include="'components/profile/default-form.html'"></div>
+                    <div ng-include="'views/default-registration-form.html'"></div>
                 </div>
 
                 <div ng-if="!editingDisabled" class="vertical-spacing">

=== removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/custom-form.html'
=== removed file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-form.html	2015-02-02 13:42:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-form.html	1970-01-01 00:00:00 +0000
@@ -1,138 +0,0 @@
-<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" placeholder="{{dhis2CalendarFormat.keyDateFormat}}" name="foo" class="form-control" d2-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="false">{{'no'| translate}}</option>
-                            <option value="true">{{'yes'| translate}}</option>
-                        </select>
-                        <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
-                    </div>                            
-                    <div ng-switch-when="optionSet">
-                        <div ng-if="!selectedProgram">
-                            <input type="text"
-                                   name="foo"
-                                   class="form-control"
-                                   ng-model="attribute.value"                                                 
-                                   typeahead="option.name as option.name for option in optionSets[attribute.optionSet.id].options | filter:$viewValue | limitTo:20" 
-                                   typeahead-open-on-focus
-                                   ng-required="attribute.mandatory"/>
-                        </div>
-                        <div ng-if="selectedProgram">
-                            <div ng-if="!selectedProgram.dataEntryMethod || optionSets[attribute.optionSet.id].options.length >= 7">
-                                <input type="text" 
-                                       name="foo"
-                                       class="form-control"
-                                       ng-model="attribute.value"                                                 
-                                       typeahead="option.name as option.name for option in optionSets[attribute.optionSet.id].options | filter:$viewValue | limitTo:20" 
-                                       typeahead-open-on-focus
-                                       typeahead-editable=false
-                                       ng-required="attribute.mandatory"/>
-                            </div>
-                            <div ng-if="selectedProgram.dataEntryMethod && optionSets.optionSet[attribute.optionSet.id].options.length < 7">
-                                <label>                                        
-                                    <input type="radio"
-                                           name={{attribute.id}}
-                                           ng-required="attribute.mandatory"
-                                           ng-model="attribute.value"
-                                           value=""> {{'no_value'| translate}}<br>                                       
-                                </label><br>
-                                <span ng-repeat="option in optionSets[attribute.optionSet.id].options">
-                                    <label>
-                                        <input type="radio"
-                                               name={{attribute.id}}
-                                               ng-required="attribute.mandatory"
-                                               ng-model="attribute.value" 
-                                               value={{option.name}}> {{option.name}}
-                                    </label><br>
-                                </span>                                            
-                            </div>
-                        </div>                                
-                        <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-when="email">
-                        <input type="email" 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" 
-                       placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
-                       name="dateOfEnrollment" 
-                       class="form-control" 
-                       d2-date 
-                       ng-model="enrollment.dateOfEnrollment" 
-                       max-date="selectedProgram.selectEnrollmentDatesInFuture ? '' : 0"
-                       min-date=""
-                       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" 
-                       placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
-                       name="dateOfIncident"
-                       class="form-control" 
-                       d2-date 
-                       max-date="selectedProgram.selectIncidentDatesInFuture ? '' : 0"
-                       min-date=""
-                       ng-model="enrollment.dateOfIncident"/>
-            </td>
-        </tr>
-    </table>
-</div>
\ No newline at end of file

=== 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-02-02 13:42:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	2015-02-03 17:12:51 +0000
@@ -2,46 +2,61 @@
     <form name="outerForm" novalidate>        
         <div class="row col-sm-12 vertical-spacing" ng-if="selectedProgram && selectedProgram.displayCustomForm">
             <div ng-if="!customForm.hasProgramDate">
-                <table>
-                    <table class="dhis2-list-table-striped dhis2-table-hover">
-                        <tr>
-                            <td>
-                                {{selectedProgram.dateOfEnrollmentDescription}}
-                            </td>
-                            <td>
-                                <input type="text" 
-                                       placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
-                                       name="dateOfEnrollment" 
-                                       class="form-control" 
-                                       d2-date 
-                                       ng-model="enrollment.dateOfEnrollment" 
-                                       max-date="selectedProgram.selectEnrollmentDatesInFuture ? '' : 0"
-                                       min-date=""
-                                       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" 
-                                       placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
-                                       name="dateOfIncident"
-                                       class="form-control" 
-                                       d2-date 
-                                       max-date="selectedProgram.selectIncidentDatesInFuture ? '' : 0"
-                                       min-date=""
-                                       ng-model="enrollment.dateOfIncident"/>
-                            </td>
-                        </tr>
-                    </table>
+                <table class="dhis2-list-table-striped dhis2-table-hover">
+                    <tr>
+                        <td>
+                            {{selectedProgram.dateOfEnrollmentDescription}}
+                        </td>
+                        <td>
+                            <input type="text" 
+                                   placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
+                                   name="dateOfEnrollment" 
+                                   class="form-control" 
+                                   d2-date 
+                                   ng-model="enrollment.dateOfEnrollment" 
+                                   max-date="selectedProgram.selectEnrollmentDatesInFuture ? '' : 0"
+                                   min-date=""
+                                   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" 
+                                   placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+                                   name="dateOfIncident"
+                                   class="form-control" 
+                                   d2-date 
+                                   max-date="selectedProgram.selectIncidentDatesInFuture ? '' : 0"
+                                   min-date=""
+                                   ng-model="enrollment.dateOfIncident"/>
+                        </td>
+                    </tr>
+                </table>
             </div>
             <div ng-include="'../dhis-web-commons/customform/custom-form.html'"></div>
         </div>
-        <div class="row col-sm-12 vertical-spacing" ng-if="!selectedProgram.displayCustomForm">            
-            <div ng-include="'components/registration/default-form.html'"></div>
+        <div class="row col-sm-12 vertical-spacing" ng-if="!selectedProgram.displayCustomForm">
+            <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>
+            <div ng-if="selectedProgram" ng-include="'views/enrollment-dates-form.html'"></div>            
+            <div ng-include="'views/default-registration-form.html'"></div>
         </div>
 
         <div ng-if="formEmpty && outerForm.submitted">

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/default-registration-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/default-registration-form.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/default-registration-form.html	2015-02-03 17:12:51 +0000
@@ -0,0 +1,78 @@
+<h3>{{'profile'| translate}}</h3>
+<table class="table-borderless table-striped">
+    <tr ng-repeat="attribute in attributes">
+        <td>
+            {{attribute.name}}<span ng-if="attribute.mandatory" class="required">*</span>
+        </td>
+        <td>
+            <ng-form name="innerForm">
+                <span ng-switch="attribute.valueType">
+                    <span ng-switch-when="date">
+                        <input type="text" 
+                               placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
+                               name="foo" 
+                               class="form-control" 
+                               d2-date
+                               max-date="attribute.allowFutureDate ? '' : 0"
+                               ng-model="selectedTei[attribute.id]"
+                               ng-disabled="editingDisabled" 
+                               ng-required="attribute.mandatory"/>
+                    </span>
+                    <span ng-switch-when="trueOnly">
+                        <input type="checkbox" 
+                               name="foo" 
+                               class="form-control" 
+                               ng-model="selectedTei[attribute.id]" 
+                               ng-disabled="editingDisabled" 
+                               ng-required="attribute.mandatory"/>
+                    </span>
+                    <span ng-switch-when="bool">
+                        <select name="foo" 
+                                ng-model="selectedTei[attribute.id]" 
+                                class="form-control" 
+                                ng-disabled="editingDisabled" 
+                                ng-required="attribute.mandatory">
+                            <option value="">{{'please_select'| translate}}</option>                        
+                            <option value="false">{{'no'| translate}}</option>
+                            <option value="true">{{'yes'| translate}}</option>
+                        </select>
+                    </span>
+                    <span ng-switch-when="optionSet">
+                        <input type="text"
+                               name="foo"
+                               class="form-control"
+                               ng-model="selectedTei[attribute.id]"                                                 
+                               typeahead="option.name as option.name for option in optionSets[attributesById[attribute.id].optionSet.id].options | filter:$viewValue | limitTo:20" 
+                               typeahead-open-on-focus                                           
+                               ng-disabled="editingDisabled" ng-required="attribute.mandatory"/>
+                    </span>
+                    <span ng-switch-when="number">
+                        <input type="text" 
+                               name="foo" 
+                               class="form-control" 
+                               ng-model="selectedTei[attribute.id]" 
+                               ng-disabled="editingDisabled" 
+                               ng-required="attribute.mandatory"/>
+                    </span>
+                    <span ng-switch-when="email">
+                        <input type="email" 
+                               name="foo" 
+                               class="form-control" 
+                               ng-model="selectedTei[attribute.id]" 
+                               ng-disabled="editingDisabled" 
+                               ng-required="attribute.mandatory"/>
+                    </span>
+                    <span ng-switch-default>
+                        <input type="text" 
+                               name="foo" 
+                               class="form-control" 
+                               ng-model="selectedTei[attribute.id]" 
+                               ng-disabled="editingDisabled" 
+                               ng-required="attribute.mandatory"/>                                    
+                    </span>
+                </span>
+            </ng-form>
+            <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+        </td>
+    </tr>           
+</table>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/enrollment-dates-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/enrollment-dates-form.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/enrollment-dates-form.html	2015-02-03 17:12:51 +0000
@@ -0,0 +1,35 @@
+<table class="dhis2-list-table-striped dhis2-table-hover">
+    <tr>
+        <td>
+            {{selectedProgram.dateOfEnrollmentDescription}}
+        </td>
+        <td>
+            <input type="text" 
+                   placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
+                   name="dateOfEnrollment" 
+                   class="form-control" 
+                   d2-date 
+                   ng-model="enrollment.dateOfEnrollment" 
+                   max-date="selectedProgram.selectEnrollmentDatesInFuture ? '' : 0"
+                   min-date=""
+                   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" 
+                   placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
+                   name="dateOfIncident"
+                   class="form-control" 
+                   d2-date 
+                   max-date="selectedProgram.selectIncidentDatesInFuture ? '' : 0"
+                   min-date=""
+                   ng-model="enrollment.dateOfIncident"/>
+        </td>
+    </tr>
+</table>
+<hr>
\ No newline at end of file