← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15432: refactored tracker capture into multiple components, updated code for changes in web-api

 

------------------------------------------------------------
revno: 15432
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Tue 2014-05-27 14:38:36 +0200
message:
  refactored tracker capture into multiple components, updated code for changes in web-api
removed:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/trackedEntityList.html
added:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/
  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.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration/
  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.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/
  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.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/search/
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/tei.html
modified:
  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/index.html
  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/directives.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.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/styles/style.css
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/dataentry.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/enrollment.html
  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/registration.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.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
=== added directory 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components'
=== added directory 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry'
=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2014-05-27 12:38:36 +0000
@@ -0,0 +1,141 @@
+trackerCapture.controller('DataEntryController',
+        function($scope, 
+                $filter,
+                orderByFilter,
+                storage,
+                DHIS2EventFactory,
+                OrgUnitService,
+                TranslationService) {
+
+    TranslationService.translate();
+     
+    //listen for the selected items
+    $scope.$on('dataentry', function(event, args) {  
+        
+        var today = moment();
+        today = Date.parse(today);
+        today = $filter('date')(today, 'yyyy-MM-dd');
+
+        $scope.currentEvent = null;
+        $scope.allowEventCreation = false;
+        $scope.repeatableStages = [];        
+        $scope.dhis2Events = [];       
+    
+        $scope.selectedEntity = args.selectedEntity;
+        $scope.selectedOrgUnit = args.selectedOrgUnit;
+        $scope.selectedProgramId = args.selectedProgramId;        
+        $scope.selectedEnrollment = args.selectedEnrollment;        
+        
+        if($scope.selectedOrgUnit && 
+                $scope.selectedProgramId && 
+                $scope.selectedEntity && 
+                $scope.selectedEnrollment){
+            
+            DHIS2EventFactory.getByEntity($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgramId).then(function(data){
+                $scope.dhis2Events = data;
+                
+                if(angular.isUndefined($scope.dhis2Events)){
+                    
+                    $scope.dhis2Events = [];
+                    
+                    console.log('need to create new ones:  ', $scope.selectedEnrollment);
+                    
+                    if($scope.selectedEnrollment.status === 'ACTIVE'){
+                        //create events for the selected enrollment
+                        var program = storage.get($scope.selectedProgramId);
+                        var programStages = [];
+                        
+                        angular.forEach(program.programStages, function(ps){  
+                            ps = storage.get(ps.id);
+                            programStages.push(ps);
+                            
+                            var eventDate = moment(moment().add('d', ps.minDaysFromStart), 'YYYY-MM-DD')._d;
+                            eventDate = Date.parse(eventDate);
+                            eventDate = $filter('date')(eventDate, 'yyyy-MM-dd');
+                            var dhis2Event = {programStage: ps.id, 
+                                              orgUnit: $scope.selectedOrgUnitId, 
+                                              eventDate: eventDate,
+                                              name: ps.name,
+                                              status: 'ACTIVE'};
+                            
+                            $scope.dhis2Events.push(dhis2Event);    
+                            
+                        });
+                    }
+                }
+                
+                angular.forEach($scope.dhis2Events, function(dhis2Event){
+                    
+                    var ps = storage.get(dhis2Event.programStage);
+                    //check if a stage is repeatable
+                    if(ps.repeatable){
+                        $scope.allowEventCreation = true;
+                        if($scope.repeatableStages.indexOf(ps) === -1){
+                            $scope.repeatableStages.push(ps);
+                        }
+                    }
+                            
+                    dhis2Event.name = ps.name;
+                    dhis2Event.eventDate = moment(dhis2Event.eventDate, 'YYYY-MM-DD')._d;
+                    dhis2Event.eventDate = Date.parse(dhis2Event.eventDate);
+                    dhis2Event.eventDate = $filter('date')(dhis2Event.eventDate, 'yyyy-MM-dd');
+                    
+                    if(dhis2Event.status === 'COMPLETED'){
+                        dhis2Event.statusColor = 'stage-completed';
+                    }
+                    else{
+                        dhis2Event.statusColor = 'stage-on-time';
+
+                        if(moment(today).isAfter(dhis2Event.eventDate)){
+                            dhis2Event.statusColor = 'stage-overdue';
+                        }                        
+                    } 
+                    
+                    if(dhis2Event.orgUnit){
+                        OrgUnitService.open().then(function(){
+                            OrgUnitService.get(dhis2Event.orgUnit).then(function(ou){
+                                if(ou){
+                                    dhis2Event.orgUnitName = ou.n;
+                                }                                                       
+                            });                            
+                        }); 
+                    }                                                             
+                });
+
+                $scope.dhis2Events = orderByFilter($scope.dhis2Events, '-eventDate');
+                $scope.dhis2Events.reverse();              
+            });          
+        }
+    });
+    
+    $scope.createNewEvent = function(){
+        console.log('need to create new event:  ', $scope.repeatableStages);        
+    };
+    
+    $scope.showDataEntry = function(event){
+        
+        if(event){
+            
+            $scope.currentEvent = event;
+            $scope.currentEvent.providedElsewhere = [];
+            $scope.currentEvent.dataValues = [];
+            $scope.currentStage = storage.get($scope.currentEvent.programStage); 
+           
+            angular.forEach($scope.currentStage.programStageDataElements, function(prStDe){
+                $scope.currentStage.programStageDataElements[prStDe.dataElement.id] = prStDe.dataElement;
+                if(prStDe.allowProvidedElsewhere){
+                    $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] = '';   
+                }                
+            });
+            
+            angular.forEach($scope.currentEvent.dataValues, function(dataValue){
+                var val = dataValue.value;
+                var de = $scope.currentStage.programStageDataElements[dataValue.dataElement];
+                if( de && de.type === 'int' && val){
+                    val = parseInt(val);
+                    dataValue.value = val;
+                }                   
+            });     
+        }     
+    };    
+});
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2014-05-27 12:38:36 +0000
@@ -0,0 +1,103 @@
+<div class="panel panel-default" ng-controller="DataEntryController">
+    <div class="panel-heading">
+        {{dataentryWidget.title| translate}} 
+        <span class="nav-pills" ng-show="selectedEnrollment && allowEventCreation">
+            | <span><a href ng-click="createNewEvent()" title="{{'create_new_event_repeatable'| translate}}">{{'create_new_event'| translate}}</a></span>            
+        </span>
+        <span class="pull-right">
+            <a href ng-click="removeWidget(dataentryWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>            
+        </span>        
+    </div>
+
+    <div ng-show="dhis2Events">            
+        <table class="table-borderless">
+            <tbody>
+                <tr>
+                    <td class="inline-block" ng-repeat="dhis2Event in dhis2Events track by $index">
+                        <span class="block orgunit-container">{{dhis2Event.orgUnitName}}</span>                                              
+                        <span class="stage-container"                                                     
+                              ng-class="{'current-stage': currentEvent.programStage == dhis2Event.programStage, '{{dhis2Event.statusColor}}': true}"                                                      
+                              ng-click="showDataEntry(dhis2Event)">
+                            {{dhis2Event.name}}<br/>
+                            {{dhis2Event.eventDate}}                                                    
+                        </span>
+                        <i class="fa fa-arrow-right" ng-show="$index < dhis2Events.length-1"></i>
+                    </td>                        
+                </tr>
+            </tbody>                
+        </table>
+        <hr>
+        <div ng-show="currentEvent">
+            <table class="table-borderless table-striped">
+                <thead>
+                    <tr>
+                        <th>
+                            {{'data_element' | translate}}
+                        </th>
+                        <th>
+                            {{'value' | translate}}
+                        </th>
+                        <th>
+                            {{'provided_elsewhere' | translate}}
+                        </th>
+                    </tr>
+                </thead>
+                    
+                <tr ng-repeat="prStDe in currentStage.programStageDataElements">
+                    <td>
+                        {{prStDe.dataElement.name}}-{{prStDe.dataElement.type}}
+                    </td>
+                    <td>
+                        <div ng-switch="prStDe.dataElement.type">
+                            <div ng-switch-when="int">
+                                <input type="number"
+                                       class="form-control"
+                                       ng-model="currentEvent[prStDe.dataElement.id]" 
+                                       ng-required={{prStDe.compulsory}} 
+                                       name="foo"/>
+                            </div>
+                            <div ng-switch-when="string">                                        
+                                <input type="text"
+                                       class="form-control"
+                                       ng-model="currentEvent[prStDe.dataElement.id]" 
+                                       ng-required={{prStDe.compulsory}} 
+                                       typeahead="option for option in prStDe.dataElement.optionSet.options | filter:$viewValue | limitTo:20" 
+                                       typeahead-open-on-focus                                                        
+                                       name="foo"/>
+                            </div>
+                            <div ng-switch-when="bool">
+                                <select class="form-control"
+                                        ng-model="currentEvent[prStDe.dataElement.id]" 
+                                        ng-required={{prStDe.compulsory}} 
+                                        name="foo">
+                                    <option value="">{{'please_select'| translate}}</option>                        
+                                    <option value="0">{{'no'| translate}}</option>
+                                    <option value="1">{{'yes'| translate}}</option>
+                                </select>
+
+                            </div>
+                            <div ng-switch-when="date">
+                                <input type="text" 
+                                       placeholder="yyyy-mm-dd" 
+                                       ng-date 
+                                       class="form-control"
+                                       ng-model="currentEvent[prStDe.dataElement.id]" 
+                                       ng-required={{prStDe.compulsory}}  
+                                       name="foo"/>
+                            </div>
+                        </div>
+                    </td>
+                    <td>                        
+                        <span ng-if="prStDe.allowProvidedElsewhere">
+                            <input type="checkbox" ng-model="currentEvent.providedElsewhere[prStDe.dataElement.id]"/>
+                        </span>
+                    </td>
+                </tr>
+            </table>    
+            
+            <hr>
+
+        </div>
+    </div>
+
+</div>
\ No newline at end of file

=== added directory 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment'
=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2014-05-27 12:38:36 +0000
@@ -0,0 +1,90 @@
+trackerCapture.controller('EnrollmentController',
+        function($rootScope,
+                $scope,  
+                $filter,
+                storage,
+                ProgramFactory,
+                CurrentSelection,
+                EnrollmentService,
+                TranslationService) {
+
+    TranslationService.translate();
+    
+    //programs for enrollment
+    $scope.enrollments = [];
+    $scope.programs = []; 
+    $scope.showEnrollmentDiv = false;
+    
+    $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+    
+    //listen for the selected items
+    $scope.$on('selectedEntity', function(event, args) {
+        
+        var selections = CurrentSelection.get();
+        $scope.selectedEntity = selections.tei;    
+        
+        $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+        
+        angular.forEach(ProgramFactory.getAll(), function(program){
+            if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnit.id) &&
+               program.trackedEntity.id === $scope.selectedEntity.trackedEntity){
+                $scope.programs.push(program);
+            }
+        });
+        
+        if(selections.pr){       
+            angular.forEach($scope.programs, function(program){
+                if(selections.pr.id === program.id){
+                    $scope.selectedProgram = program;
+                    $scope.loadEvents();
+                }
+            });
+        }
+    }); 
+    
+    $scope.loadEvents = function() {
+        
+        if($scope.selectedProgram){
+            
+            $scope.selectedEnrollment = '';           
+            
+            EnrollmentService.get($scope.selectedEntity.trackedEntityInstance).then(function(data){
+                $scope.enrollments = data.enrollmentList;                
+                
+                angular.forEach($scope.enrollments, function(enrollment){
+                    if(enrollment.program === $scope.selectedProgram.id ){
+                        $scope.selectedEnrollment = enrollment;
+                    }
+                }); 
+            
+                $scope.programStages = [];        
+                angular.forEach($scope.selectedProgram.programStages, function(stage){
+                   $scope.programStages.push(storage.get(stage.id));               
+                });
+
+                if($scope.selectedEnrollment){
+                    $scope.selectedEnrollment.dateOfIncident = $filter('date')($scope.selectedEnrollment.dateOfIncident, 'yyyy-MM-dd');
+                }
+                
+                $rootScope.$broadcast('dataentry', {selectedEntity: $scope.selectedEntity,
+                                                    selectedOrgUnit: $scope.selectedOrgUnit,
+                                                    selectedProgramId: $scope.selectedProgram.id,
+                                                    selectedEnrollment: $scope.selectedEnrollment});
+            });            
+        }
+        
+        $rootScope.$broadcast('dataentry', {selectedEntity: $scope.selectedEntity,
+                                                    selectedOrgUnit: $scope.selectedOrgUnit,
+                                                    selectedProgramId: $scope.selectedProgram ? $scope.selectedProgram.id : null,
+                                                    selectedEnrollment: $scope.selectedEnrollment ? $scope.selectedEnrollment : null});
+        
+    };
+    
+    $scope.showEnrollment = function(){        
+        console.log('Enrollment', $scope.selectedEntity, ' ', $scope.selectedProgram);
+    };
+    
+    $scope.enroll = function(){        
+        console.log('Enrollment', $scope.selectedEntity, ' ', $scope.selectedProgram);
+    };
+});
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2014-05-27 12:38:36 +0000
@@ -0,0 +1,66 @@
+<div class="panel panel-default" ng-controller="EnrollmentController">
+    <div class="panel-heading">
+        {{enrollmentWidget.title| translate}}
+        <span class="pull-right">
+            <a href ng-click="removeWidget(enrollmentWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>            
+        </span>
+    </div>
+    <table class="table-borderless">
+        <tr>
+            <td>
+                {{'program'| translate}}
+            </td>
+            <td>
+                <select ng-model="selectedProgram"
+                        class="form-control"
+                        ng-options="program as program.name for program in programs | orderBy: 'name'" 
+                        ng-change="loadEvents()">
+                    <option value="">{{'please_select'| translate}}</option>
+                </select>
+            </td>
+            <td>
+                <button type="button" 
+                        class="btn btn-default"
+                        ng-show="selectedProgram && !selectedEnrollment" 
+                        ng-click="showEnrollment()">
+                    {{'enroll'| translate}}
+                </button>  
+            </td>                
+            <td>
+                <button type="button" 
+                        class="btn btn-default"
+                        ng-show="selectedProgram && selectedEnrollment" 
+                        ng-click="scheduling()">
+                    {{'scheduling'| translate}}
+                </button>                                
+            </td>
+        </tr>
+    </table>
+    <div ng-if="selectedProgram">
+        <div ng-if="programStages">
+            
+            <hr>
+            <table class="table-borderless table-striped">
+                <thead>
+                    <tr>
+                        <th>
+                            {{'program_stage'| translate}}
+                        </th>
+                        <th>
+                            {{'scheduled_date'| translate}}
+                        </th>
+                    </tr>                
+                </thead>
+                <tr ng-repeat="programStage in programStages">
+                    <td>
+                        {{programStage.name}}
+                    </td>
+                    <td>
+                        {{programStage.minDaysFromStart}}
+                        {{selectedEnrollment.dateOfIncident}}
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>    
+</div>
\ No newline at end of file

=== added directory 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes'
=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js	2014-05-27 12:38:36 +0000
@@ -0,0 +1,10 @@
+trackerCapture.controller('NotesController',
+        function($scope,                
+                storage,
+                TranslationService) {
+
+    TranslationService.translate();
+    
+    $scope.attributes = storage.get('ATTRIBUTES');
+    
+});
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html	2014-05-27 12:38:36 +0000
@@ -0,0 +1,11 @@
+<div class="panel panel-default" ng-controller="NotesController">
+    <div class="panel-heading">
+        {{notesWidget.title| translate}}
+        <span class="pull-right">
+            <a href ng-click="removeWidget(notesWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>            
+        </span>        
+    </div>
+    <div class="panel-body dashboard-element-container">
+        This is notes.
+    </div>
+</div>
\ No newline at end of file

=== added directory 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile'
=== added 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	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2014-05-27 12:38:36 +0000
@@ -0,0 +1,44 @@
+trackerCapture.controller('ProfileController',
+        function($scope,                
+                storage,
+                CurrentSelection,
+                TranslationService) {
+
+    TranslationService.translate();
+    
+    //attributes for profile    
+    $scope.attributes = {};    
+    $scope.editProfile = false;    
+    
+    angular.forEach(storage.get('ATTRIBUTES'), function(attribute){
+        $scope.attributes[attribute.id] = attribute;
+    }); 
+    
+    //listen for the selected entity
+    $scope.$on('selectedEntity', function(event, args) { 
+        var selections = CurrentSelection.get();
+        $scope.selectedEntity = selections.tei;        
+      
+        angular.forEach(storage.get('TRACKED_ENTITIES'), function(te){
+            if($scope.selectedEntity.trackedEntity === te.id){
+                $scope.trackedEntity = te;
+            }
+        }); 
+        
+        $scope.entityAttributes = angular.copy($scope.selectedEntity.attributes);
+    });
+    
+    $scope.showEdit = function(){
+      $scope.editProfile = !$scope.editProfile; 
+    };
+    
+    $scope.save = function(){
+        
+        $scope.editProfile = !$scope.editProfile;
+    };
+    
+    $scope.cancel = function(){
+        $scope.selectedEntity.attributes = $scope.entityAttributes;  
+        $scope.editProfile = !$scope.editProfile;
+    };
+});

=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html	2014-05-27 12:38:36 +0000
@@ -0,0 +1,66 @@
+
+<div class="panel panel-default" ng-controller="ProfileController">
+    <div class="panel-heading">
+        {{trackedEntity.name|| 'entity' | translate}} {{profileWidget.title| translate}}
+        <span class="nav-pills" ng-show="selectedEntity.attributes.length">
+            | <span><a href ng-click="showEdit()" title="{{'edit_profile'| translate}}">{{'edit'| translate}}</a></span>            
+        </span>
+        <span class="pull-right">
+            <a href ng-click="removeWidget(profileWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>            
+        </span>        
+    </div>
+    <table class="table-borderless table-striped">
+        <tr ng-repeat="attribute in selectedEntity.attributes">
+            <td>
+                {{attribute.displayName}}
+            </td>
+            <td>
+                <div ng-switch="attribute.type">
+                    <div ng-switch-when="date">
+                        <input type="text" class="form-control" ng-date ng-model="attribute.value"  value="attribute.value | date:'yyyy-MM-dd" ng-disabled="!editProfile"/>
+                    </div>
+                    <div ng-switch-when="trueOnly">
+                        <input type="checkbox" class="form-control" ng-model="attribute.value" ng-disabled="!editProfile"/>
+                    </div>
+                    <div ng-switch-when="bool">
+                        <select ng-model="attribute.value" class="form-control" ng-disabled="!editProfile">
+                            <option value="">{{'please_select'| translate}}</option>                        
+                            <option value="0">{{'no'| translate}}</option>
+                            <option value="1">{{'yes'| translate}}</option>
+                        </select>
+                    </div>
+                    <div ng-switch-when="combo">
+                        <input type="text"  
+                               class="form-control"
+                               ng-model="attribute.value"                                                 
+                               typeahead="option for option in attributes[attribute.attribute].optionSet.options | filter:$viewValue | limitTo:20" 
+                               typeahead-open-on-focus 
+                               ng-disabled="!editProfile"/>
+                    </div>
+                    <div ng-switch-when="number">
+                        <input type="number" class="form-control" ng-model="attribute.value" ng-disabled="!editProfile"/>
+                    </div>
+                    <div ng-switch-default>
+                        <input type="text"  class="form-control" ng-model="attribute.value" ng-disabled="!editProfile"/>                         
+                    </div>
+                </div>                                                                                                    
+            </td>
+        </tr>           
+    </table>
+
+    <div class="widget-content-container" ng-if="editProfile">
+
+        <button type="button" 
+                class="btn btn-default small-horizonal-spacing"
+                ng-click="save()">
+            {{'save'| translate}}
+        </button>        
+        <button type="button" 
+                class="btn btn-default small-horizonal-spacing" 
+                ng-click="cancel()">
+            {{'cancel'| translate}}
+        </button>        
+
+    </div>
+
+</div>
\ No newline at end of file

=== added directory 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/registration'
=== added 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	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-controller.js	2014-05-27 12:38:36 +0000
@@ -0,0 +1,105 @@
+trackerCapture.controller('RegistrationController', 
+        function($scope,
+                $location,
+                AttributesFactory,
+                TEIService,
+                EnrollmentService,
+                DialogService,
+                storage,
+                TranslationService) {
+    
+    //do translation of the registration page
+    TranslationService.translate();   
+    $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+    $scope.enrollment = {enrollmentDate: '', incidentDate: ''};    
+    
+    $scope.attributes = AttributesFactory.getWithoutProgram();
+    $scope.trackedEntities = {available: storage.get('TRACKED_ENTITIES')};
+    
+    $scope.trackedEntities.selected = $scope.trackedEntities.available[0];
+      
+    //watch for selection of org unit from tree
+    $scope.$watch('selectedProgram', function() {        
+        if( angular.isObject($scope.selectedProgram)){
+            $scope.trackedEntityList = [];
+            $scope.attributes = AttributesFactory.getByProgram($scope.selectedProgram);
+        }
+    });    
+    
+    $scope.registerEntity = function(showDashboard){
+        
+        //get selected entity
+        var selectedTrackedEntity = '';        
+        if($scope.selectedProgram){
+            selectedTrackedEntity = $scope.selectedProgram.trackedEntity.id;
+        }
+        else{
+            selectedTrackedEntity = $scope.trackedEntities.selected.id;
+        }
+        
+        //get tei attributes and their values
+        var registrationAttributes = [];    
+        angular.forEach($scope.attributes, function(attribute){
+            if(!angular.isUndefined(attribute.value)){
+                var att = {attribute: attribute.id, value: attribute.value};
+                registrationAttributes.push(att);
+            } 
+        });       
+        
+        //prepare tei model and do registration
+        $scope.tei = {trackedEntity: selectedTrackedEntity, orgUnit: $scope.selectedOrgUnit.id, attributes: registrationAttributes };   
+        var teiId = '';
+    
+        TEIService.register($scope.tei).then(function(tei){
+            
+            if(tei.status === 'SUCCESS'){
+                
+                teiId = tei.reference;
+                
+                //registration is successful and check for enrollment
+                if($scope.selectedProgram){    
+                    //enroll TEI
+                    var enrollment = {trackedEntityInstance: teiId,
+                                program: $scope.selectedProgram.id,
+                                status: 'ACTIVE',
+                                dateOfEnrollment: $scope.enrollment.enrollmentDate,
+                                dateOfIncident: $scope.enrollment.incidentDate
+                            };
+                    EnrollmentService.enroll(enrollment).then(function(data){
+                        if(data.status != 'SUCCESS'){
+                            //enrollment has failed
+                            var dialogOptions = {
+                                    headerText: 'enrollment_error',
+                                    bodyText: data.description
+                                };
+                            DialogService.showDialog({}, dialogOptions);
+                            return;
+                        }
+                    });
+                }
+            }
+            else{
+                //registration has failed
+                var dialogOptions = {
+                        headerText: 'registration_error',
+                        bodyText: tei.description
+                    };
+                DialogService.showDialog({}, dialogOptions);
+                return;
+            }
+            
+            if(showDashboard){
+                $location.path('/dashboard').search({selectedEntityId: teiId,
+                                                selectedProgramId: $scope.selectedProgram ? $scope.selectedProgram.id : null});
+            }
+            else{            
+                
+                angular.forEach($scope.attributes, function(attribute){
+                    attribute.value = ''; 
+                });
+                $scope.enrollment.enrollmentDate = '';
+                $scope.enrollment.incidentDate =  '';
+            }
+        });
+    };
+});
\ No newline at end of file

=== 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-05-27 12:38:36 +0000
@@ -0,0 +1,91 @@
+<div class="bordered-div col-md-12">    
+    <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>
+                        <div ng-switch="attribute.valueType">
+                            <div ng-switch-when="date">
+                                <input type="text" class="form-control" ng-date ng-model="attribute.value" />
+                            </div>
+                            <div ng-switch-when="trueOnly">
+                                <input type="checkbox" class="form-control" ng-model="attribute.value" />
+                            </div>
+                            <div ng-switch-when="bool">
+                                <select ng-model="attribute.value" class="form-control">
+                                    <option value="">{{'please_select'| translate}}</option>                        
+                                    <option value="0">{{'no'| translate}}</option>
+                                    <option value="1">{{'yes'| translate}}</option>
+                                </select>
+                            </div>
+                            <div ng-switch-when="combo">
+                                <input type="text" 
+                                       class="form-control"
+                                       ng-model="attribute.value"                                                 
+                                       typeahead="option for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
+                                       typeahead-open-on-focus 
+                                       />
+                            </div>
+                            <div ng-switch-when="number">
+                                <input type="number" class="form-control" ng-model="attribute.value"/>
+                            </div>
+                            <div ng-switch-default>
+                                <input type="text" class="form-control" ng-model="attribute.value" />                                        
+                            </div>
+                        </div>                                                                                                    
+                    </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" class="form-control" ng-date ng-model="enrollment.incidentDate" />
+                        </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-default" ng-click="registerEntity(true)">{{'save_and_continue'| translate}}</button>
+                <button type="button" class="btn btn-default 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

=== added directory 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship'
=== added 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	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js	2014-05-27 12:38:36 +0000
@@ -0,0 +1,8 @@
+trackerCapture.controller('RelationshipController',
+        function($scope,                
+                storage,
+                TranslationService) {
+
+    TranslationService.translate();    
+    $scope.attributes = storage.get('ATTRIBUTES');    
+});
\ 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/relationship.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.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/relationship.html	2014-05-27 12:38:36 +0000
@@ -0,0 +1,11 @@
+<div class="panel panel-default" ng-controller="RelationshipController">
+    <div class="panel-heading">
+        {{relationshipWidget.title| translate}}
+        <span class="pull-right">
+            <a href ng-click="removeWidget(relationshipWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>            
+        </span>        
+    </div>
+    <div class="panel-body dashboard-element-container">
+        This is relationships.
+    </div>
+</div>
\ No newline at end of file

=== added directory 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/search'
=== added directory 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected'
=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected-controller.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected-controller.js	2014-05-27 12:38:36 +0000
@@ -0,0 +1,26 @@
+trackerCapture.controller('SelectedInfoController',
+        function($scope,                
+                storage,
+                TranslationService) {
+
+    TranslationService.translate();
+    
+    //listen for the selected items
+    $scope.$on('selectedEntity', function(event, args) {
+        
+        $scope.selectedEntity = args.selectedEntity;
+        $scope.selectedProgramId = args.selectedProgramId;        
+        $scope.selectedOrgUnitId = args.selectedOrgUnitId;        
+        
+        if($scope.selectedProgramId){
+            $scope.selectedProgram = storage.get($scope.selectedProgramId);        
+        }
+        
+        $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+        $scope.selections = [];
+        
+        $scope.selections.push({title: 'registering_unit', value: $scope.selectedOrgUnit ? $scope.selectedOrgUnit.name : 'not_selected'});
+        $scope.selections.push({title: 'program', value: $scope.selectedProgram ? $scope.selectedProgram.name : 'not_selected'});               
+        
+    });     
+});
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/selected/selected.html	2014-05-27 12:38:36 +0000
@@ -0,0 +1,18 @@
+<div class="panel panel-default" ng-controller="SelectedInfoController">
+    <div class="panel-heading">
+        {{selectedWidget.title| translate}}
+        <span class="pull-right">
+            <a href ng-click="removeWidget(selectedWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>            
+        </span>        
+    </div>    
+    <div class="panel-body dashboard-element-container">
+        <div class="row" ng-repeat="selection in selections">
+            <div class="col-sm-6">
+                {{selection.title| translate}}
+            </div>
+            <div class="col-sm-6">
+                <input type="text" class="form-control" value="{{selection.value| translate}}" ng-disabled="true"/>                
+            </div>
+        </div>        
+    </div>
+</div>

=== 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-05-26 08:08:05 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-05-27 12:38:36 +0000
@@ -80,6 +80,7 @@
     "add_new": "Add New",
     "register_new": "Register new",
     "registration": "Registration",
+    "registration_date": "Registration date",
     "register": "Register",
     "registration_error": "Error in registration",
     "category": "Category",

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html	2014-05-26 08:08:05 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html	2014-05-27 12:38:36 +0000
@@ -62,7 +62,13 @@
         <script type="text/javascript" src="scripts/services.js"></script>
         <script type="text/javascript" src="scripts/filters.js"></script>
         <script type="text/javascript" src="scripts/directives.js"></script>
-        <script type="text/javascript" src="scripts/controllers.js"></script> 
+        <script type="text/javascript" src="scripts/controllers.js"></script>
+        <script type="text/javascript" src="components/enrollment/enrollment-controller.js"></script>
+        <script type="text/javascript" src="components/dataentry/dataentry-controller.js"></script>
+        <script type="text/javascript" src="components/selected/selected-controller.js"></script>
+        <script type="text/javascript" src="components/relationship/relationship-controller.js"></script>
+        <script type="text/javascript" src="components/profile/profile-controller.js"></script>
+        <script type="text/javascript" src="components/notes/notes-controller.js"></script>
           
         <!-- Menu scripts -->
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.translate.js"></script>
@@ -73,7 +79,7 @@
         <link type="text/css" rel="stylesheet" media="screen,print" href="../dhis-web-commons/css/widgets.css"/>
         <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/menu.css">
         
-        <link type="text/css" rel="stylesheet" href="styles/style.css">           
+        <link type="text/css" rel="stylesheet" href="styles/style.css">
        
     </head>
     <body>

=== 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-05-26 08:08:05 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-05-27 12:38:36 +0000
@@ -12,6 +12,7 @@
                 Paginator,
                 TranslationService, 
                 storage,
+                ProgramFactory,
                 AttributesFactory,
                 EntityQueryFactory,
                 TEIService) {   
@@ -79,17 +80,16 @@
 
             $scope.programs = [];
             
-            var programs = storage.get('TRACKER_PROGRAMS');
+            var programs = ProgramFactory.getAll();
             
             if( programs && programs != 'undefined' ){
-                for(var i=0; i<programs.length; i++){
-                    var program = storage.get(programs[i].id);   
+                angular.forEach(programs, function(program){
                     if(angular.isObject(program)){
                         if(program.organisationUnits.hasOwnProperty(orgUnit.id)){
                             $scope.programs.push(program);
                         }
-                    }                    
-                }
+                    }
+                });                
                 
                 if( !angular.isUndefined($scope.programs)){                    
                     if($scope.programs.length === 1){
@@ -102,7 +102,7 @@
         }        
     };
     
-    $scope.getProgramAttributes = function(program){ 
+    $scope.getProgramAttributes = function(program, doSearch){ 
         $scope.trackedEntityList = null; 
         $scope.selectedProgram = program;
         
@@ -112,8 +112,10 @@
         else{
             $scope.attributes = AttributesFactory.getWithoutProgram();
         }
-
-        $scope.search($scope.searchMode);
+        
+        if(doSearch){
+            $scope.search($scope.searchMode);
+        }       
     };
     
     $scope.search = function(mode){ 
@@ -146,7 +148,7 @@
             $scope.showTrackedEntityDiv = true;                  
             attributeUrl = EntityQueryFactory.getQueryForAttributes($scope.attributes);
             
-            if(!attributeUrl.hasValue){
+            if(!attributeUrl.hasValue && !$scope.selectedProgram){
                 $scope.emptySearchAttribute = true;
                 $scope.showSearchDiv = true;
                 return;
@@ -174,12 +176,14 @@
        
         //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.ouMode.name === 'SELECTED'){
-                column.show = false;    
+            if(column.id === 'orgUnitName' && $scope.ouMode.name !== 'SELECTED'){
+                column.show = true;    
             }
+            
             if(column.displayInListNoProgram){
                 column.show = true;
             }           
@@ -283,111 +287,8 @@
     };    
 })
 
-.controller('RegistrationController', 
-        function($scope,
-                $location,
-                AttributesFactory,
-                TEIService,
-                EnrollmentService,
-                DialogService,
-                storage,
-                TranslationService) {
-    
-    //do translation of the registration page
-    TranslationService.translate();   
-    $scope.selectedOrgUnit = storage.get('SELECTED_OU');
-    $scope.enrollment = {enrollmentDate: '', incidentDate: ''};    
-    
-    $scope.attributes = AttributesFactory.getWithoutProgram();
-    $scope.trackedEntities = {available: storage.get('TRACKED_ENTITIES')};
-    
-    $scope.trackedEntities.selected = $scope.trackedEntities.available[0];
-      
-    //watch for selection of org unit from tree
-    $scope.$watch('selectedProgram', function() {        
-        if( angular.isObject($scope.selectedProgram)){
-            $scope.trackedEntityList = [];
-            $scope.attributes = AttributesFactory.getByProgram($scope.selectedProgram);
-        }
-    });    
-    
-    $scope.registerEntity = function(showDashboard){
-        
-        //get selected entity
-        var selectedTrackedEntity = '';        
-        if($scope.selectedProgram){
-            selectedTrackedEntity = $scope.selectedProgram.trackedEntity.id;
-        }
-        else{
-            selectedTrackedEntity = $scope.trackedEntities.selected.id;
-        }
-        
-        //get tei attributes and their values
-        var registrationAttributes = [];    
-        angular.forEach($scope.attributes, function(attribute){
-            if(!angular.isUndefined(attribute.value)){
-                var att = {attribute: attribute.id, value: attribute.value};
-                registrationAttributes.push(att);
-            } 
-        });       
-        
-        //prepare tei model and do registration
-        $scope.tei = {trackedEntity: selectedTrackedEntity, orgUnit: $scope.selectedOrgUnit.id, attributes: registrationAttributes };   
-        var teiId = '';
-    
-        TEIService.register($scope.tei).then(function(tei){
-            
-            if(tei.status === 'SUCCESS'){
-                
-                teiId = tei.reference;
-                
-                //registration is successful and check for enrollment
-                if($scope.selectedProgram){    
-                    //enroll TEI
-                    var enrollment = {trackedEntityInstance: teiId,
-                                program: $scope.selectedProgram.id,
-                                status: 'ACTIVE',
-                                dateOfEnrollment: $scope.enrollment.enrollmentDate,
-                                dateOfIncident: $scope.enrollment.incidentDate
-                            };
-                    EnrollmentService.enroll(enrollment).then(function(data){
-                        if(data.status != 'SUCCESS'){
-                            //enrollment has failed
-                            var dialogOptions = {
-                                    headerText: 'enrollment_error',
-                                    bodyText: data.description
-                                };
-                            DialogService.showDialog({}, dialogOptions);
-                            return;
-                        }
-                    });
-                }
-            }
-            else{
-                //registration has failed
-                var dialogOptions = {
-                        headerText: 'registration_error',
-                        bodyText: tei.description
-                    };
-                DialogService.showDialog({}, dialogOptions);
-                return;
-            }
-            
-            if(showDashboard){
-                $location.path('/dashboard').search({selectedEntityId: teiId,
-                                                selectedProgramId: $scope.selectedProgram ? $scope.selectedProgram.id : null});
-            }
-            else{            
-                
-                angular.forEach($scope.attributes, function(attribute){
-                    attribute.value = ''; 
-                });
-                $scope.enrollment.enrollmentDate = '';
-                $scope.enrollment.incidentDate =  '';
-            }
-        });
-    };
-})
+//Controller for registration section
+
 
 //Controller for dashboard
 .controller('DashboardController',
@@ -406,12 +307,12 @@
     
     //dashboard items   
     $rootScope.dashboardWidgets = {bigger: [], smaller: []};       
-    $rootScope.enrollmentWidget = {title: 'enrollment', view: "views/enrollment.html", show: true};
-    $rootScope.dataentryWidget = {title: 'dataentry', view: "views/dataentry.html", show: true};
-    $rootScope.selectedWidget = {title: 'current_selections', view: "views/selected.html", show: false};
-    $rootScope.profileWidget = {title: 'profile', view: "views/profile.html", show: true};
-    $rootScope.relationshipWidget = {title: 'relationship', view: "views/relationship.html", show: true};
-    $rootScope.notesWidget = {title: 'notes', view: "views/notes.html", show: true};    
+    $rootScope.enrollmentWidget = {title: 'enrollment', view: "components/enrollment/enrollment.html", show: true};
+    $rootScope.dataentryWidget = {title: 'dataentry', view: "components/dataentry/dataentry.html", show: true};
+    $rootScope.selectedWidget = {title: 'current_selections', view: "components/selected/selected.html", show: false};
+    $rootScope.profileWidget = {title: 'profile', view: "components/profile/profile.html", show: true};
+    $rootScope.relationshipWidget = {title: 'relationship', view: "components/relationship/relationship.html", show: true};
+    $rootScope.notesWidget = {title: 'notes', view: "components/notes/notes.html", show: true};    
    
     $rootScope.dashboardWidgets.bigger.push($rootScope.enrollmentWidget);
     $rootScope.dashboardWidgets.bigger.push($rootScope.dataentryWidget);
@@ -473,285 +374,13 @@
 })
 
 //Controller for the profile section
-.controller('ProfileController',
-        function($scope,                
-                storage,
-                CurrentSelection,
-                TranslationService) {
 
-    TranslationService.translate();
-    
-    //attributes for profile    
-    $scope.attributes = {};    
-    $scope.editProfile = false;    
-    
-    angular.forEach(storage.get('ATTRIBUTES'), function(attribute){
-        $scope.attributes[attribute.id] = attribute;
-    }); 
-    
-    //listen for the selected entity
-    $scope.$on('selectedEntity', function(event, args) { 
-        var selections = CurrentSelection.get();
-        $scope.selectedEntity = selections.tei;        
-      
-        angular.forEach(storage.get('TRACKED_ENTITIES'), function(te){
-            if($scope.selectedEntity.trackedEntity === te.id){
-                $scope.trackedEntity = te;
-            }
-        }); 
-        
-        $scope.entityAttributes = angular.copy($scope.selectedEntity.attributes);
-    });
-    
-    $scope.showEdit = function(){
-      $scope.editProfile = !$scope.editProfile; 
-    };
-    
-    $scope.save = function(){
-        
-        $scope.editProfile = !$scope.editProfile;
-    };
-    
-    $scope.cancel = function(){
-        $scope.selectedEntity.attributes = $scope.entityAttributes;  
-        $scope.editProfile = !$scope.editProfile;
-    };
-})
 
 //Controller for the enrollment section
-.controller('EnrollmentController',
-        function($rootScope,
-                $scope,  
-                $filter,
-                storage,
-                CurrentSelection,
-                EnrollmentService,
-                TranslationService) {
-
-    TranslationService.translate();
-    
-    //programs for enrollment
-    $scope.enrollments = [];
-    $scope.programs = []; 
-    $scope.showEnrollmentDiv = false;
-    
-    $scope.selectedOrgUnit = storage.get('SELECTED_OU');
-    
-    //listen for the selected items
-    $scope.$on('selectedEntity', function(event, args) {
-        
-        var selections = CurrentSelection.get();
-        $scope.selectedEntity = selections.tei;    
-        
-        $scope.selectedOrgUnit = storage.get('SELECTED_OU');
-        
-        angular.forEach(storage.get('TRACKER_PROGRAMS'), function(program){
-            program = storage.get(program.id);
-            if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnit.id) &&
-               program.trackedEntity.id === $scope.selectedEntity.trackedEntity){
-                $scope.programs.push(program);
-            }
-        });
-        
-        if(selections.pr){       
-            angular.forEach($scope.programs, function(program){
-                if(selections.pr.id === program.id){
-                    $scope.selectedProgram = program;
-                    $scope.loadEvents();
-                }
-            });
-        }
-    }); 
-    
-    $scope.loadEvents = function() {
-        
-        if($scope.selectedProgram){
-            
-            $scope.selectedEnrollment = '';           
-            
-            EnrollmentService.get($scope.selectedEntity.trackedEntityInstance).then(function(data){
-                $scope.enrollments = data.enrollmentList;                
-                
-                angular.forEach($scope.enrollments, function(enrollment){
-                    if(enrollment.program === $scope.selectedProgram.id ){
-                        $scope.selectedEnrollment = enrollment;
-                    }
-                }); 
-            
-                $scope.programStages = [];        
-                angular.forEach($scope.selectedProgram.programStages, function(stage){
-                   $scope.programStages.push(storage.get(stage.id));               
-                });
-
-                if($scope.selectedEnrollment){
-                    $scope.selectedEnrollment.dateOfIncident = $filter('date')($scope.selectedEnrollment.dateOfIncident, 'yyyy-MM-dd');
-                }
-                
-                $rootScope.$broadcast('dataentry', {selectedEntity: $scope.selectedEntity,
-                                                    selectedOrgUnit: $scope.selectedOrgUnit,
-                                                    selectedProgramId: $scope.selectedProgram.id,
-                                                    selectedEnrollment: $scope.selectedEnrollment});
-            });            
-        }
-        
-        $rootScope.$broadcast('dataentry', {selectedEntity: $scope.selectedEntity,
-                                                    selectedOrgUnit: $scope.selectedOrgUnit,
-                                                    selectedProgramId: $scope.selectedProgram ? $scope.selectedProgram.id : null,
-                                                    selectedEnrollment: $scope.selectedEnrollment ? $scope.selectedEnrollment : null});
-        
-    };
-    
-    $scope.showEnrollment = function(){        
-        console.log('Enrollment', $scope.selectedEntity, ' ', $scope.selectedProgram);
-    };
-    
-    $scope.enroll = function(){        
-        console.log('Enrollment', $scope.selectedEntity, ' ', $scope.selectedProgram);
-    };
-})
+
 
 //Controller for the data entry section
-.controller('DataEntryController',
-        function($scope, 
-                $filter,
-                orderByFilter,
-                storage,
-                DHIS2EventFactory,
-                OrgUnitService,
-                TranslationService) {
-
-    TranslationService.translate();
-     
-    //listen for the selected items
-    $scope.$on('dataentry', function(event, args) {  
-        
-        var today = moment();
-        today = Date.parse(today);
-        today = $filter('date')(today, 'yyyy-MM-dd');
-
-        $scope.currentEvent = null;
-        $scope.allowEventCreation = false;
-        $scope.repeatableStages = [];        
-        $scope.dhis2Events = [];       
-    
-        $scope.selectedEntity = args.selectedEntity;
-        $scope.selectedOrgUnit = args.selectedOrgUnit;
-        $scope.selectedProgramId = args.selectedProgramId;        
-        $scope.selectedEnrollment = args.selectedEnrollment;        
-        
-        if($scope.selectedOrgUnit && 
-                $scope.selectedProgramId && 
-                $scope.selectedEntity && 
-                $scope.selectedEnrollment){
-            
-            DHIS2EventFactory.getByEntity($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgramId).then(function(data){
-                $scope.dhis2Events = data;
-                
-                if(angular.isUndefined($scope.dhis2Events)){
-                    
-                    $scope.dhis2Events = [];
-                    
-                    console.log('need to create new ones:  ', $scope.selectedEnrollment);
-                    
-                    if($scope.selectedEnrollment.status === 'ACTIVE'){
-                        //create events for the selected enrollment
-                        var program = storage.get($scope.selectedProgramId);
-                        var programStages = [];
-                        
-                        angular.forEach(program.programStages, function(ps){  
-                            ps = storage.get(ps.id);
-                            programStages.push(ps);
-                            
-                            var eventDate = moment(moment().add('d', ps.minDaysFromStart), 'YYYY-MM-DD')._d;
-                            eventDate = Date.parse(eventDate);
-                            eventDate = $filter('date')(eventDate, 'yyyy-MM-dd');
-                            var dhis2Event = {programStage: ps.id, 
-                                              orgUnit: $scope.selectedOrgUnitId, 
-                                              eventDate: eventDate,
-                                              name: ps.name,
-                                              status: 'ACTIVE'};
-                            
-                            $scope.dhis2Events.push(dhis2Event);    
-                            
-                        });
-                    }
-                }
-                
-                angular.forEach($scope.dhis2Events, function(dhis2Event){
-                    
-                    var ps = storage.get(dhis2Event.programStage);
-                    //check if a stage is repeatable
-                    if(ps.repeatable){
-                        $scope.allowEventCreation = true;
-                        if($scope.repeatableStages.indexOf(ps) === -1){
-                            $scope.repeatableStages.push(ps);
-                        }
-                    }
-                            
-                    dhis2Event.name = ps.name;
-                    dhis2Event.eventDate = moment(dhis2Event.eventDate, 'YYYY-MM-DD')._d;
-                    dhis2Event.eventDate = Date.parse(dhis2Event.eventDate);
-                    dhis2Event.eventDate = $filter('date')(dhis2Event.eventDate, 'yyyy-MM-dd');
-                    
-                    if(dhis2Event.status === 'COMPLETED'){
-                        dhis2Event.statusColor = 'stage-completed';
-                    }
-                    else{
-                        dhis2Event.statusColor = 'stage-on-time';
-
-                        if(moment(today).isAfter(dhis2Event.eventDate)){
-                            dhis2Event.statusColor = 'stage-overdue';
-                        }                        
-                    } 
-                    
-                    if(dhis2Event.orgUnit){
-                        OrgUnitService.open().then(function(){
-                            OrgUnitService.get(dhis2Event.orgUnit).then(function(ou){
-                                if(ou){
-                                    dhis2Event.orgUnitName = ou.n;
-                                }                                                       
-                            });                            
-                        }); 
-                    }                                                             
-                });
-
-                $scope.dhis2Events = orderByFilter($scope.dhis2Events, '-eventDate');
-                $scope.dhis2Events.reverse();              
-            });          
-        }
-    });
-    
-    $scope.createNewEvent = function(){
-        console.log('need to create new event:  ', $scope.repeatableStages);        
-    };
-    
-    $scope.showDataEntry = function(event){
-        
-        if(event){
-            
-            $scope.currentEvent = event;
-            $scope.currentEvent.providedElsewhere = [];
-            $scope.currentEvent.dataValues = [];
-            $scope.currentStage = storage.get($scope.currentEvent.programStage); 
-            
-            angular.forEach($scope.currentStage.programStageDataElements, function(prStDe){                
-                $scope.currentStage.programStageDataElements[prStDe.dataElement.id] = prStDe.dataElement;
-                if(prStDe.allowProvidedElsewhere){
-                    $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] = '';   
-                }                
-            });
-            
-            angular.forEach($scope.currentEvent.dataValues, function(dataValue){
-                var val = dataValue.value;
-                var de = $scope.currentStage.programStageDataElements[dataValue.dataElement];
-                if( de && de.type === 'int' && val){
-                    val = parseInt(val);
-                    dataValue.value = val;
-                }                   
-            });     
-        }     
-    };    
-})
+
 
 //Controller for the dashboard widgets
 .controller('DashboardWidgetsController', 
@@ -767,54 +396,13 @@
 })
 
 //Controller for the relationship section
-.controller('RelationshipController',
-        function($scope,                
-                storage,
-                TranslationService) {
 
-    TranslationService.translate();    
-    $scope.attributes = storage.get('ATTRIBUTES');    
-})
 
 //Controller for the notes section
-.controller('NotesController',
-        function($scope,                
-                storage,
-                TranslationService) {
 
-    TranslationService.translate();
-    
-    $scope.attributes = storage.get('ATTRIBUTES');
-    
-})
 
 //Controller for the selected section
-.controller('SelectedInfoController',
-        function($scope,                
-                storage,
-                TranslationService) {
 
-    TranslationService.translate();
-    
-    //listen for the selected items
-    $scope.$on('selectedEntity', function(event, args) {
-        
-        $scope.selectedEntity = args.selectedEntity;
-        $scope.selectedProgramId = args.selectedProgramId;        
-        $scope.selectedOrgUnitId = args.selectedOrgUnitId;        
-        
-        if($scope.selectedProgramId){
-            $scope.selectedProgram = storage.get($scope.selectedProgramId);        
-        }
-        
-        $scope.selectedOrgUnit = storage.get('SELECTED_OU');
-        $scope.selections = [];
-        
-        $scope.selections.push({title: 'registering_unit', value: $scope.selectedOrgUnit ? $scope.selectedOrgUnit.name : 'not_selected'});
-        $scope.selections.push({title: 'program', value: $scope.selectedProgram ? $scope.selectedProgram.name : 'not_selected'});               
-        
-    });     
-})
 
 //Controller for the header section
 .controller('HeaderController',

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js	2014-05-22 13:19:01 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js	2014-05-27 12:38:36 +0000
@@ -159,7 +159,7 @@
   return {
     require: ['typeahead', 'ngModel'],
     link: function (scope, element, attr, ctrls) {        
-      element.bind('focus', function () {
+      element.bind('focus', function () {          
         ctrls[0].getMatchesAsync(ctrls[1].$viewValue);
         //scope.$apply();
       });

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2014-05-20 13:24:54 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2014-05-27 12:38:36 +0000
@@ -22,7 +22,7 @@
 })
 
 /* Factory to fetch programs */
-.factory('ProgramFactory', function($http) {
+.factory('ProgramFactory', function($http, storage) {
     
     var programUid, programPromise;
     var programs, programsPromise;
@@ -57,6 +57,13 @@
                 return programs;
             });            
             return promise;
+        },
+        getAll: function(){
+            var programs = [];
+            angular.forEach(storage.get('TRACKER_PROGRAMS'), function(p){
+                programs.push(storage.get(p.id));
+            });
+            return programs;
         }
     };
 })
@@ -558,7 +565,7 @@
             
 })
 
-.service('EntityService', function(OrgUnitService){
+.service('EntityService', function(OrgUnitService, $filter){
     
     return {
         formatter: function(grid){
@@ -582,6 +589,11 @@
                     var isEmpty = true;
 
                     entity.id = row[0];
+                    var rDate = row[1];
+                    rDate = moment(rDate, 'YYYY-MM-DD')._d;
+                    rDate = Date.parse(rDate);
+                    rDate = $filter('date')(rDate, 'yyyy-MM-dd');                           
+                    entity.created = rDate;
                     entity.orgUnit = row[3];                              
                     entity.type = row[4];  
 

=== 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-05-26 09:14:21 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2014-05-27 12:38:36 +0000
@@ -60,9 +60,7 @@
         promise = promise.then(getUserProfile);
         promise = promise.then(getAttributes);
         promise = promise.then(getTrackedEntities);
-        promise = promise.then(getMetaPrograms);
-        promise = promise.then(getPrograms);
-        promise = promise.then(getProgramStages);
+        promise = promise.then(getProgramsMetaData);
         promise.done(function() {
             selection.responseReceived();
         });
@@ -142,9 +140,6 @@
 $(window).resize(function() {
     $("#selectDropDown").width($("#selectDropDownParent").width());
     $("#searchDropDown").width($("#searchDropDownParent").width());
-
-    console.log('select parent width is-r:  ', $("#selectDropDownParent").width());
-    console.log('select width is-r:  ', $("#selectDropDown").width());
 });
 
 function ajax_login()
@@ -185,107 +180,52 @@
     return def.promise();
 }
 
-function getMetaPrograms()
+function getProgramsMetaData()
 {
     var def = $.Deferred();
 
     $.ajax({
-        url: '../api/programs',
+        url: '../api/programs.json',
         type: 'GET',
-        data: 'type=1&paging=false'
+        data: 'paging=false&filter=type:eq:1&include=id,name,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,realionshipText,trackedEntity[id,name,description],userRoles[id,name],organisationUnits[id,name],programStages[id,name,description,minDaysFromStart,repeatable,programStageDataElements[displayInReports,allowProvidedElsewhere,allowDateInFuture,compulsory,dataElement[id,name,type]]],programTrackedEntityAttributes[displayInList,mandatory,attribute[id,name,description,valueType,displayInListNoProgram,inherit,optionSet[id,name,options]]]'
     }).done(function(response) {
-        localStorage[PROGRAMS_METADATA] = JSON.stringify(response.programs);
-        def.resolve(response.programs);
-    });
-
-    return def.promise();
-}
-
-function getPrograms(programs)
-{
-    if (!programs) {
-        return;
-    }
-
-    var def = $.Deferred();
-    var promise = def.promise();
-
-    _.each(_.values(programs), function(program) {
-        promise = promise.then(getProgram(program.href));
-    });
-
-    promise = promise.then(function() {
-        return $.Deferred().resolve(programs);
-    });
-
-    def.resolve(programs);
-
-    return promise;
-}
-
-function getProgram(url)
-{
-
-    return function() {
-        return $.ajax({
-            url: url,
-            type: 'GET'
-        }).done(function(program) {
-
+        var programs = [];
+        _.each(_.values(response.programs), function(p) {
+            var programForListing = {id: p.id, name: p.name};
+            programs.push(programForListing);           
+            
+            var programForStorage = _.clone(p); 
+            
+            //save program stages
+            programForStorage.programStages = [];
+            _.each(_.values(p.programStages), function(ps){
+                localStorage[ps.id] = JSON.stringify(ps);
+                programForStorage.programStages.push({id: ps.id, name: ps.name});
+            });
+            
             var ou = {};
-            _.each(_.values(program.organisationUnits), function(o) {
+            _.each(_.values(programForStorage.organisationUnits), function(o) {
                 ou[o.id] = o.name;
             });
 
-            program.organisationUnits = ou;
+            programForStorage.organisationUnits = ou;
 
             var ur = {};
-            _.each(_.values(program.userRoles), function(u) {
+            _.each(_.values(programForStorage.userRoles), function(u) {
                 ur[u.id] = u.name;
             });
 
-            program.userRoles = ur;
-
-            localStorage[program.id] = JSON.stringify(program);
-        });
-    };
-}
-
-function getProgramStages(programs)
-{
-    if (!programs) {
-        return;
-    }
-
-    var def = $.Deferred();
-    var promise = def.promise();
-
-    _.each(_.values(programs), function(program) {
-        program = JSON.parse(localStorage[program.id]);
-        _.each(_.values(program.programStages), function(programStage) {
-            promise = promise.then(getProgramStage(programStage.href));
-        });
-    });
-
-    promise = promise.then(function() {
-        return def.resolve();
-    });
-
-    def.resolve();
-
-    return promise;
-}
-
-function getProgramStage(url)
-{
-    return function() {
-        return $.ajax({
-            url: url,
-            type: 'GET'
-        }).done(function(programStage) {
-            localStorage[programStage.id] = JSON.stringify(programStage);
-        });
-    };
+            programForStorage.userRoles = ur;            
+            
+            localStorage[programForStorage.id] = JSON.stringify(programForStorage);
+            
+        });
+        
+        localStorage[PROGRAMS_METADATA] = JSON.stringify(programs);
+        def.resolve(response.programs);
+    });
+
+    return def.promise();
 }
 
 function getAttributes()
@@ -293,9 +233,9 @@
     var def = $.Deferred();
 
     $.ajax({
-        url: '../api/trackedEntityAttributes',
+        url: '../api/trackedEntityAttributes.json',
         type: 'GET',
-        data: 'viewClass=detailed&paging=false'
+        data: 'paging=false&include=id,name,description,valueType,inherit,displayOnVisitSchedule,displayInListNoProgram,unique,optionSet[id,name,options]'
     }).done(function(response) {
         localStorage['ATTRIBUTES'] = JSON.stringify(response.trackedEntityAttributes);
         def.resolve();
@@ -313,9 +253,6 @@
         type: 'GET',
         data: 'viewClass=detailed&paging=false'
     }).done(function(response) {
-        /*_.each(_.values(response.trackedEntities), function(te){
-         localStorage[te.id] = JSON.stringify(te);;
-         });  */
         localStorage['TRACKED_ENTITIES'] = JSON.stringify(response.trackedEntities);
         def.resolve();
     });

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-05-26 09:14:21 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-05-27 12:38:36 +0000
@@ -412,6 +412,7 @@
 
 .table-borderless {
     width: 100%;
+    table-layout: fixed;
 }
 
 .table-borderless>thead>tr>th, 
@@ -584,8 +585,8 @@
 }
 
 .search-container{
-    margin-top: 20px;
-    margin-bottom: 20px;
+    margin: 5px;
+    padding: 5px;    
 }
 
 .registration-container{
@@ -847,6 +848,26 @@
     transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
 }
 
+.form-control-select2 {
+    display: block;
+    width: 100%;
+    height: 30px;
+    padding: 6px 6px;
+    font-size: 14px;
+    line-height: 1.0;
+    color: #555;
+    margin-bottom: 5px;
+    margin-top: 5px;
+    vertical-align: middle;
+    background-color: #fff;
+    background-image: none;
+    border: 1px solid #ccc;
+    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
+    box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
+    -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+    transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
+}
+
 .underline{
     text-decoration: underline;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/dataentry.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/dataentry.html	2014-05-21 10:05:20 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/dataentry.html	2014-05-27 12:38:36 +0000
@@ -28,7 +28,7 @@
         </table>
         <hr>
         <div ng-show="currentEvent">
-            <table class="table table-striped table-hover">
+            <table class="table-borderless table-striped">
                 <thead>
                     <tr>
                         <th>
@@ -45,7 +45,7 @@
                     
                 <tr ng-repeat="prStDe in currentStage.programStageDataElements">
                     <td>
-                        {{prStDe.dataElement.name}}
+                        {{prStDe.dataElement.name}}-{{prStDe.dataElement.type}}
                     </td>
                     <td>
                         <div ng-switch="prStDe.dataElement.type">

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/enrollment.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/enrollment.html	2014-05-20 15:56:10 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/enrollment.html	2014-05-27 12:38:36 +0000
@@ -5,7 +5,7 @@
             <a href ng-click="removeWidget(enrollmentWidget)" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>            
         </span>
     </div>
-    <table class="table">
+    <table class="table-borderless">
         <tr>
             <td>
                 {{'program'| translate}}
@@ -21,7 +21,7 @@
             <td>
                 <button type="button" 
                         class="btn btn-default"
-                        ng-if="selectedProgram && !selectedEnrollment" 
+                        ng-show="selectedProgram && !selectedEnrollment" 
                         ng-click="showEnrollment()">
                     {{'enroll'| translate}}
                 </button>  
@@ -29,7 +29,7 @@
             <td>
                 <button type="button" 
                         class="btn btn-default"
-                        ng-if="selectedProgram && selectedEnrollment" 
+                        ng-show="selectedProgram && selectedEnrollment" 
                         ng-click="scheduling()">
                     {{'scheduling'| translate}}
                 </button>                                
@@ -38,7 +38,9 @@
     </table>
     <div ng-if="selectedProgram">
         <div ng-if="programStages">
-            <table class="table">
+            
+            <hr>
+            <table class="table-borderless table-striped">
                 <thead>
                     <tr>
                         <th>

=== 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-05-26 08:08:05 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html	2014-05-27 12:38:36 +0000
@@ -46,18 +46,31 @@
             </button>
         </div>        
     </div>
+    <div class="row" ng-if="emptySearchAttribute">
+        <div class="col-md-6">
+            <div class="alert alert-danger">{{'search_input_required'| translate}}</div>         
+        </div>
+    </div>
 
     <div class="row vertical-spacing">
-        <div id="selectDropDownParent" class="input-group col-md-6">            
+        <div id="selectDropDownParent" class="input-group col-md-6">
+            
+            <!--<input type="text"
+                   class="form-control"
+                   ng-model="program"
+                   typeahead="program.name for program in programs | filter:$viewValue | limitTo:20" 
+                   typeahead-open-on-focus>-->
+            
+            
             <button type="button" class="select-drop-down-button form-control" >{{selectedProgram ? selectedProgram.name : 'please_select_a_program'| translate}}</button>
             <div class="input-group-btn">
                 <button class="btn btn-default trim" type="button" title="{{'list_programs'| translate}}" data-toggle="dropdown"><i class="fa fa-caret-down"></i></button>
                 <ul id="selectDropDown" class="dropdown-menu pull-right">
                     <li>
-                        <a href ng-click="getProgramAttributes(null)">{{'please_select_a_program'| translate}}</a>
+                        <a href ng-click="getProgramAttributes(null, true)">{{'please_select_a_program'| translate}}</a>
                     </li>
                     <li ng-repeat="program in programs | orderBy: 'name'">
-                        <a href ng-click="getProgramAttributes(program)">{{program.name}}</a>
+                        <a href ng-click="getProgramAttributes(program, true)">{{program.name}}</a>
                     </li>
                 </ul>
             </div>                
@@ -78,25 +91,17 @@
         </div>
     </div>
 
-    <!-- search begins -->
-    <!--<div class="row" ng-show="showSearchDiv">
-        <div class="col-md-6">
-            <div ng-include="'views/search.html'"></div>             
-        </div>
-    </div>-->
-    <!-- search ends -->
-
     <!--registration begins -->
     <div class="row" ng-if="showRegistrationDiv">
         <div class="col-md-6">
-            <div ng-include="'views/registration.html'" ng-controller="RegistrationController"></div>             
+            <div ng-include="'components/registration/registration.html'" ng-controller="RegistrationController"></div>             
         </div>
     </div>
     <!-- registration ends -->
 
     <!-- entity grid begins -->
     <div ng-if="showTrackedEntityDiv">
-        <div ng-include="'views/trackedEntityList.html'"></div>  
+        <div ng-include="'views/tei.html'"></div>  
     </div>
     <!-- entity grid ends -->
 </div>           

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/registration.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/registration.html	2014-05-26 08:08:05 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/registration.html	2014-05-27 12:38:36 +0000
@@ -4,7 +4,7 @@
             
             <div ng-if='!selectedProgram'>
                 <h3>{{'category' | translate}}</h3>
-                <table class="dhis2-list-table-striped dhis2-table-hover">
+                 <table class="table-borderless table-striped">
                     <tr>
                         <td>
                             {{'entity_type' | translate}}
@@ -19,7 +19,7 @@
             </div>
             
             <h3>{{'profile' | translate}}</h3>
-            <table class="dhis2-list-table-striped dhis2-table-hover">
+            <table class="table-borderless table-striped">
                 <tr ng-repeat="attribute in attributes">
                     <td>
                         {{attribute.name}}

=== 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-05-26 09:14:21 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html	2014-05-27 12:38:36 +0000
@@ -1,66 +1,82 @@
-<table data-stop-propagation="true" class="table-borderless table-striped">
-    <tr>
-        <td>{{'org_unit_mode'| translate}}</td>
-        <td>
-            <input type="radio" ng-model="ouMode.name" value="SELECTED">{{'use_selected'| translate}}<br/>
-            <input type="radio" ng-model="ouMode.name" value="CHILDREN">{{'use_immediate_children'| translate}}<br/>
-            <input type="radio" ng-model="ouMode.name" value="DESCENDANTS">{{'use_all_children'| translate}}
-        </td>
-    </tr>
-    <tr ng-repeat="attribute in attributes">
-        <td>
-            {{attribute.name}} - {{attribute.valueType}}
-        </td>
-        <td>
-            <div ng-switch="attribute.valueType">
-                <div ng-switch-when="date">
-                    <input type="text" class="form-control" ng-date ng-model="attribute.value" />
-                </div>
-                <div ng-switch-when="trueOnly">
-                    <input type="checkbox" class="form-control" ng-model="attribute.value" />
-                </div>
-                <div ng-switch-when="bool">
-                    <select multiple ui-select2 ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
-                        <option value="0">{{'no'| translate}}</option>
-                        <option value="1">{{'yes'| translate}}</option>
-                    </select>
-                </div>
-                <div ng-switch-when="combo">
-                    <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="number">
-                    <input type="number" class="form-control" ng-model="attribute.value"/>
-                </div>
-                <div ng-switch-default>
-                    <input type="text" class="form-control" ng-model="attribute.value" />                                        
-                </div>
-            </div>                                                                                                    
-        </td>
-    </tr>         
-</table>
-
-<button type="button" 
-        class="btn btn-default"
-        ng-click="search(searchMode.attributeBased)">
-    {{'search'| translate}}
-</button>
-<button type="button" 
-        class="btn btn-default small-horizonal-spacing" 
-        ng-click="search(searchMode.listAll)">
-    {{'list_all'| translate}}
-</button>
-<button type="button" 
-        class="btn btn-default small-horizonal-spacing" 
-        ng-click="closeSearch()">
-    {{'cancel'| translate}}
-</button>        
-
-<div class="row" ng-if="emptySearchAttribute">
-    <div class="col-md-12">
-        <div class="alert alert-danger">{{'search_input_required'| translate}}</div>         
-    </div>
+<div class="search-container">
+    <table data-stop-propagation="true" class="table-borderless table-striped">
+        <tr>
+            <td>{{'org_unit_mode'| translate}}</td>
+            <td>
+                <input type="radio" ng-model="ouMode.name" value="SELECTED">{{'use_selected'| translate}}<br/>
+                <input type="radio" ng-model="ouMode.name" value="CHILDREN">{{'use_immediate_children'| translate}}<br/>
+                <input type="radio" ng-model="ouMode.name" value="DESCENDANTS">{{'use_all_children'| translate}}
+            </td>
+        </tr>
+        <tr>
+            <td>{{'registration_date'| translate}}</td>
+            <td>
+                <input type="text" class="form-control-select2" ng-date ng-model="attribute.value" />
+            </td>
+        </tr>
+        <tr>
+            <td>{{'program'| translate}}</td>
+            <td>
+                <select class="form-control-select2"
+                        ng-model="selectedProgram" 
+                        ng-change="getProgramAttributes(selectedProgram, false)"
+                        ng-options="program as program.name for program in programs | orderBy: 'name'">
+                    <option value="">{{'please_select'| translate}}</option>
+                </select>
+            </td>
+        </tr>
+        <tr ng-repeat="attribute in attributes">
+            <td>
+                {{attribute.name}} - {{attribute.valueType}}
+            </td>
+            <td>
+                <div ng-switch="attribute.valueType">
+                    <div ng-switch-when="date">
+                        <input type="text" class="form-control-select2" ng-date ng-model="attribute.value" />
+                    </div>
+                    <div ng-switch-when="trueOnly">
+                        <input type="checkbox" class="form-control-select2" ng-model="attribute.value" />
+                    </div>
+                    <div ng-switch-when="bool">
+                        <select multiple ui-select2 ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
+                            <option value="0">{{'no'| translate}}</option>
+                            <option value="1">{{'yes'| translate}}</option>
+                        </select>
+                    </div>
+                    <div ng-switch-when="combo">
+                        <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="number">
+                        <input type="number" class="form-control-select2" ng-model="attribute.value"/>
+                    </div>
+                    <div ng-switch-default>
+                        <input type="text" class="form-control-select2" ng-model="attribute.value" />                                        
+                    </div>
+                </div>                                                                                                    
+            </td>
+        </tr>         
+    </table>
+    
+    <button type="button"
+            class="btn btn-default"
+            ng-click="search(searchMode.attributeBased)">
+        {{'search'| translate}}
+    </button>
+    <button type="button" 
+            class="btn btn-default small-horizonal-spacing" 
+            ng-click="search(searchMode.listAll)">
+        {{'list_all'| translate}}
+    </button>
+    <button type="button" 
+            class="btn btn-default small-horizonal-spacing" 
+            ng-click="closeSearch()">
+        {{'cancel'| translate}}
+    </button>
+
 </div>
 
 
+
+

=== added 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	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/tei.html	2014-05-27 12:38:36 +0000
@@ -0,0 +1,51 @@
+<div id="listDiv" ng-switch="trackedEntityList">                    
+    <div ng-switch-when=""></div>
+    <div ng-switch-default>        
+        <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>
+
+                <!-- show/hide grid colum begins-->
+                <div class="row" style="margin-right: 0;">
+                    <button class="btn btn-default pull-right" ng-click="showHideColumns()">
+                        {{'show_hide_columns'| translate}}
+                    </button>
+                </div>
+                <!-- show/hide grid colum ends-->
+
+                <!-- 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| paginate:rowsPerPage" 
+                                ng-click="showDashboard(trackedEntity)">
+                                <td ng-show="gridColumn.show"                                            
+                                    ng-repeat="gridColumn in gridColumns">                                                
+                                    {{trackedEntity[gridColumn.id]}}                                                
+                                </td>
+                            </tr>
+                        </tbody>        
+                    </table>
+                </div>
+                <paginator></paginator>
+                <!-- entity ends -->                            
+            </div>
+        </div>                        
+    </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/views/trackedEntityList.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/trackedEntityList.html	2014-05-22 13:19:01 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/trackedEntityList.html	1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
-<div id="listDiv" ng-switch="trackedEntityList">                    
-    <div ng-switch-when=""></div>
-    <div ng-switch-default>        
-        <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>
-
-                <!-- show/hide grid colum begins-->
-                <div class="row" style="margin-right: 0;">
-                    <button class="btn btn-default pull-right" ng-click="showHideColumns()">
-                        {{'show_hide_columns'| translate}}
-                    </button>
-                </div>
-                <!-- show/hide grid colum ends-->
-
-                <!-- 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 | paginate:rowsPerPage" 
-                                ng-click="showDashboard(trackedEntity)">
-                                <td ng-show="gridColumn.show"                                            
-                                    ng-repeat="gridColumn in gridColumns">                                                
-                                    {{trackedEntity[gridColumn.id]}}                                                
-                                </td>
-                            </tr>
-                        </tbody>        
-                    </table>
-                </div>
-                <paginator></paginator>
-                <!-- entity ends -->                            
-            </div>
-        </div>                        
-    </div>
-</div> 
\ No newline at end of file