← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14655: tracker-capture enrollment and scheduling, WIP

 

------------------------------------------------------------
revno: 14655
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Fri 2014-04-04 13:55:55 +0200
message:
  tracker-capture enrollment and scheduling, WIP
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/scripts/app.js
  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/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/profile.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/selected.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/selection.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/widgets.html


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-04-03 12:27:23 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-04-04 11:55:55 +0000
@@ -45,5 +45,9 @@
     "value": "Value",
     "show_hide_widgets": "Show/Hide widgets",
     "select_widgets_to_show": "Select widgets to show",
-    "close": "Close"
-}
+    "close": "Close",
+    "program_stage": "Program stage",
+    "scheduled_date": "Scheduled date",
+    "scheduling": "Scheduling",
+    "enroll": "Enroll"
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/app.js	2014-03-19 17:01:46 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/app.js	2014-04-04 11:55:55 +0000
@@ -13,7 +13,7 @@
 		  'angularLocalStorage', 
 		  'pascalprecht.translate'])
               
-.value('DHIS2URL', '../')
+.value('DHIS2URL', '..')
 
 .config(function($httpProvider, $routeProvider, $translateProvider) {    
             

=== 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-04-03 12:27:23 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-04-04 11:55:55 +0000
@@ -40,39 +40,10 @@
             
             //apply translation - by now user's profile is fetched from server.
             TranslationService.translate();
-            $scope.attributes = storage.get('ATTRIBUTES');
-            
-            var programs = storage.get('TRACKER_PROGRAMS');            
-            if( programs ){                
-                $scope.loadPrograms($scope.selectedOrgUnit);     
-            }
+            $scope.attributes = storage.get('ATTRIBUTES');            
         }
     });
     
-    //load programs associated with the selected org unit.
-    $scope.loadPrograms = function(orgUnit) {      
-                                
-        $scope.selectedOrgUnit = orgUnit;
-        $scope.selectedProgram = null;
-        $scope.trackedEntityList = [];
-        
-        if (angular.isObject($scope.selectedOrgUnit)) {   
-
-            $scope.programs = [];
-            
-            var programs = storage.get('TRACKER_PROGRAMS');
-            
-            if( programs && programs != 'undefined'){
-                for(var i=0; i<programs.length; i++){
-                    var program = storage.get(programs[i].id);   
-                    if(program.organisationUnits.hasOwnProperty(orgUnit.id)){
-                        $scope.programs.push(program);
-                    }
-                }               
-            }
-        }        
-    };   
-    
     //get events for the selected program (and org unit)
     $scope.loadTrackedEntities = function(){
         
@@ -91,20 +62,10 @@
             }
         });
             
-        if( angular.isObject($scope.selectedProgram)){  
-            
-            //Load entities for the selected program and orgunit
-            TrackedEntityInstanceService.getByOrgUnitAndProgram($scope.selectedOrgUnit.id, $scope.selectedProgram.id).then(function(data){
-                $scope.trackedEntityList = data;                
-            });            
-        }
-        else{
-            
-            //Load entities for the selected orgunit
-            TrackedEntityInstanceService.getByOrgUnit($scope.selectedOrgUnit.id).then(function(data){
-                $scope.trackedEntityList = data;                
-            });
-        }
+        //Load entities for the selected orgunit
+        TrackedEntityInstanceService.getByOrgUnit($scope.selectedOrgUnit.id).then(function(data){
+            $scope.trackedEntityList = data;                
+        });
     };
     
     $scope.clearEntities = function(){
@@ -117,7 +78,6 @@
     
     $scope.showSearch = function(){
         $scope.showSearchDiv = !$scope.showSearchDiv;
-        $scope.searchField.isOpen = true;
     };
     
     $scope.closeSearch = function(){
@@ -153,7 +113,7 @@
     $scope.showDashboard = function(currentEntity){       
         SelectedEntity.setSelectedEntity(currentEntity);
         storage.set('SELECTED_OU', $scope.selectedOrgUnit);        
-        $location.path('/dashboard').search({selectedEntityId: currentEntity.id, selectedProgramId: $scope.selectedProgram ? $scope.selectedProgram.id : null});                                    
+        $location.path('/dashboard').search({selectedEntityId: currentEntity.id});                                    
     };   
     
     $scope.search = function(){       
@@ -172,29 +132,29 @@
                 $location,
                 $modal,
                 storage,
-                TrackedEntityInstanceService,                
+                TrackedEntityInstanceService,      
+                SelectedEntity,
                 TranslationService) {
 
     //do translation of the dashboard page
     TranslationService.translate();    
     
     //dashboard items   
-    $rootScope.dashboardWidgets = {bigger: [], smaller: []};   
+    $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.dataentryWidget = {title: 'dataentry', view: "views/dataentry.html", show: true};
-    //$rootScope.selectedWidget = {title: 'current_selections', view: "views/selected.html", show: true};
-    $rootScope.enrollmentWidget = {title: 'enrollment', view: "views/enrollment.html", show: true};
     $rootScope.notesWidget = {title: 'notes', view: "views/notes.html", show: true};    
    
-    $rootScope.dashboardWidgets.bigger.push($rootScope.profileWidget);
+    $rootScope.dashboardWidgets.bigger.push($rootScope.enrollmentWidget);
     $rootScope.dashboardWidgets.bigger.push($rootScope.dataentryWidget);
-    //$rootScope.dashboardWidgets.smaller.push($rootScope.selectedWidget);
-    $rootScope.dashboardWidgets.smaller.push($rootScope.enrollmentWidget);
+    $rootScope.dashboardWidgets.smaller.push($rootScope.selectedWidget);
+    $rootScope.dashboardWidgets.smaller.push($rootScope.profileWidget);
     $rootScope.dashboardWidgets.smaller.push($rootScope.notesWidget);
     
     //selections
-    $scope.selectedEntityId = ($location.search()).selectedEntityId;
-    $scope.selectedProgramId = ($location.search()).selectedProgramId;    
+    $scope.selectedEntityId = ($location.search()).selectedEntityId;       
     $scope.selectedOrgUnit = storage.get('SELECTED_OU');     
         
     if( $scope.selectedEntityId ){
@@ -202,11 +162,10 @@
         //Fetch the selected entity
         TrackedEntityInstanceService.get($scope.selectedEntityId).then(function(data){
             $scope.selectedEntity = data;    
-            
-            //broadcast selections for dashboard controllers
-            $rootScope.$broadcast('selectedItems', {selectedEntity: $scope.selectedEntity, 
-                                                    selectedProgramId: $scope.selectedProgramId, 
-                                                    selectedOrgUnitId: $scope.selectedOrgUnit.id});            
+            SelectedEntity.setSelectedEntity($scope.selectedEntity);
+            //broadcast selected entity for dashboard controllers
+            $rootScope.$broadcast('selectedEntity', {});    
+
         });       
     }   
     
@@ -232,12 +191,14 @@
         modalInstance.result.then(function () {
         });
     };   
+
 })
 
 //Controller for the profile section
 .controller('ProfileController',
         function($scope,                
                 storage,
+                SelectedEntity,
                 TranslationService) {
 
     TranslationService.translate();
@@ -248,94 +209,79 @@
         $scope.attributes[attribute.id] = attribute;
     }); 
     
-    //listen for the selected items
-    $scope.$on('selectedItems', function(event, args) {        
-        $scope.selectedEntity = args.selectedEntity;        
-        $scope.trackedEntity = storage.get($scope.selectedEntity.trackedEntity);
+    //listen for the selected entity
+    $scope.$on('selectedEntity', function(event, args) {        
+        
+        $scope.selectedEntity = SelectedEntity.getSelectedEntity();        
+
+        $scope.trackedEntity = storage.get($scope.selectedEntity.trackedEntity);       
     });
 })
 
 //Controller for the enrollment section
 .controller('EnrollmentController',
         function($rootScope,
-                $scope,                
+                $scope,  
+                $filter,
                 storage,
+                SelectedEntity,
                 EnrollmentService,
                 TranslationService) {
 
     TranslationService.translate();
     
+    //selected org unit
+    $scope.selectedOrgUnit = storage.get('SELECTED_OU');  
+    
     //programs for enrollment
     $scope.enrollments = [];
-    $scope.programs = [];
-    var programs = storage.get('TRACKER_PROGRAMS'); 
+    $scope.programs = []; 
     
     //listen for the selected items
-    $scope.$on('selectedItems', function(event, args) {
-        
-        $scope.selectedEntity = args.selectedEntity;
-        $scope.selectedProgramId = args.selectedProgramId;        
-        $scope.selectedOrgUnitId = args.selectedOrgUnitId;        
-                   
-        for(var i=0; i<programs.length; i++){                
-            var program = storage.get(programs[i].id);
-            if($scope.selectedProgramId == program.id){                
-                $scope.selectedProgram = program;
-            }
-
-            if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnitId) && 
-                    program.trackedEntity.id == $scope.selectedEntity.trackedEntity){
+    $scope.$on('selectedEntity', function(event, args) {     
+        
+        $scope.selectedEntity = SelectedEntity.getSelectedEntity();      
+        
+        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);
             }
-        } 
+        });        
+    }); 
+    
+    $scope.loadEvents = function() {
         
-        EnrollmentService.get($scope.selectedEntity.trackedEntityInstance).then(function(data){
-            $scope.enrollments = data.enrollmentList;
-            
-            if($scope.enrollments && $scope.enrollments.length == 1){
-                
-                $scope.selectedProgramId = $scope.enrollments[0].program;
-                
-                angular.forEach($scope.programs, function(program){
-                    if(program.id == $scope.selectedProgramId ){
-                        $scope.selectedProgram = program;
+        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');
+                }
                 
-                $scope.loadEvents($scope.selectedProgramId);
-            }
-        });
-    }); 
-    
-    $scope.loadEvents = function(prId) {
-
-        var isEnrolled = false;
-        var selectedEnrollment = ''
-        angular.forEach($scope.enrollments, function(enrollment){
-            if(enrollment.program == prId ){                
-                isEnrolled = true;
-                selectedEnrollment = enrollment;
-            }
-        });
-        
-        //if( isEnrolled && selectedEnrollment ){
-           
-            //broadcast current selections for data entry
-            $rootScope.$broadcast('dataentry', {selectedEntity: $scope.selectedEntity, 
-                                                selectedProgramId: prId,
-                                                selectedOrgUnitId: $scope.selectedOrgUnitId,
-                                                selectedEnrollment: selectedEnrollment});
-        //}     
-        
+                $rootScope.$broadcast('dataentry', {selectedEntity: $scope.selectedEntity,
+                                                    selectedProgramId: $scope.selectedProgram.id,
+                                                    selectedEnrollment: $scope.selectedEnrollment});
+            });            
+        }        
     };
-    
-    /*$scope.removeWidget = function(){        
-        angular.forEach($rootScope.dashboardWidgets.bigger, function(widget){
-            if(widget.title == 'enrollment'){
-                widget.show = false;
-            }
-        });
-    };*/
 })
 
 //Controller for the data entry section
@@ -352,21 +298,23 @@
     
     $scope.attributes = storage.get('ATTRIBUTES');
     
+    //selected org unit
+    $scope.selectedOrgUnit = storage.get('SELECTED_OU'); 
+    
     //listen for the selected items
     $scope.$on('dataentry', function(event, args) {  
-        
+
         $scope.currentEvent = null;
         
-        $scope.dhis2Events = '';       
+        $scope.dhis2Events = [];       
     
         $scope.selectedEntity = args.selectedEntity;
         $scope.selectedProgramId = args.selectedProgramId;        
-        $scope.selectedOrgUnitId = args.selectedOrgUnitId;  
         $scope.selectedEnrollment = args.selectedEnrollment;
         
-        if($scope.selectedOrgUnitId && $scope.selectedProgramId && $scope.selectedEntity ){
+        if($scope.selectedOrgUnit && $scope.selectedProgramId && $scope.selectedEntity ){
             
-            DHIS2EventFactory.getByEntity($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnitId, $scope.selectedProgramId).then(function(data){
+            DHIS2EventFactory.getByEntity($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgramId).then(function(data){
                 $scope.dhis2Events = data;
                 
                 if(angular.isUndefined($scope.dhis2Events)){
@@ -408,21 +356,10 @@
                 angular.forEach($scope.dhis2Events, function(dhis2Event){
                         
                     dhis2Event.name = storage.get(dhis2Event.programStage).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');
-
-
-
-                    OrgUnitService.open().then(function(){
-                        OrgUnitService.get(dhis2Event.orgUnit).then(function(ou){
-                            if(ou){
-                                dhis2Event.orgUnitName = ou.n;
-                            }                                                       
-                        });                            
-                    }); 
-
+                    
                     if(dhis2Event.status == 'COMPLETED'){
                         dhis2Event.statusColor = 'stage-completed';
                     }
@@ -434,7 +371,17 @@
                         else{
                             dhis2Event.statusColor = 'stage-on-time';
                         }
-                    }                        
+                    } 
+                    
+                    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');
@@ -505,7 +452,7 @@
     TranslationService.translate();
     
     //listen for the selected items
-    $scope.$on('selectedItems', function(event, args) {
+    $scope.$on('selectedEntity', function(event, args) {
         
         $scope.selectedEntity = args.selectedEntity;
         $scope.selectedProgramId = args.selectedProgramId;        
@@ -516,9 +463,10 @@
         }
         
         $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+        $scope.selections = [];
         
-        $scope.selected.selections.push({title: 'registering_unit', value: $scope.selectedOrgUnit ? $scope.selectedOrgUnit.name : 'not_selected'});
-        $scope.selected.selections.push({title: 'program', value: $scope.selectedProgram ? $scope.selectedProgram.name : 'not_selected'});               
+        $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'});               
         
     });     
 })

=== 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-04-03 12:27:23 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-04-04 11:55:55 +0000
@@ -674,3 +674,14 @@
         box-shadow: 0 5px 15px rgba(0,0,0,0.5)
     }
 }
+
+.form-control {
+    height: 30px;
+    font-size: 12px;
+    color: #555;
+}
+
+input[type=number] {
+    border: 1px solid #aaa;
+    padding: 4px 1px;
+}
\ No newline at end of file

=== 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-04-03 12:27:23 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/dataentry.html	2014-04-04 11:55:55 +0000
@@ -2,80 +2,80 @@
     <div class="panel-heading">
         {{dataentryWidget.title| translate}} 
         <span class="nav-pills" ng-show="selectedEnrollment">
-           | <span><a href ng-click="createNewEvent()">{{'create_new_event'| translate}}</a></span>            
+            | <span><a href ng-click="createNewEvent()">{{'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 class="panel-body">        
-        <div ng-show="dhis2Events">            
-            <table class="table-borderless">
-                <tbody>
-                    <tr>
-                        <td class="inline-block" ng-repeat="dhis2Event in dhis2Events">
-                            <span class="block orgunit-container">{{dhis2Event.orgUnitName}}</span>
-                            <span class="arrow-container">→</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>                                                
-                        </td>                        
-                    </tr>
-                </tbody>                
-            </table>
-            <hr>
-            <div ng-show="currentEvent">
-                <div class="form-group">
-                    <div class="row" ng-repeat="prStDe in currentStage.programStageDataElements">
-                        <div class="col-sm-6">
-                            {{prStDe.dataElement.name}}-{{prStDe.dataElement.type}}
-                        </div>
-                        <div class="col-sm-6">
-                            <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>
-                        </div>
-                    </div>
-                </div>
-            </div>
+
+    <div ng-show="dhis2Events">            
+        <table class="table-borderless">
+            <tbody>
+                <tr>
+                    <td class="inline-block" ng-repeat="dhis2Event in dhis2Events">
+                        <span class="block orgunit-container">{{dhis2Event.orgUnitName}}</span>
+                        <span class="arrow-container">→</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>                                                
+                    </td>                        
+                </tr>
+            </tbody>                
+        </table>
+        <hr>
+        <div ng-show="currentEvent">
+            <table class="table table-striped table-hover">
+                <tr ng-repeat="prStDe in currentStage.programStageDataElements">
+                    <td>
+                        {{prStDe.dataElement.name}}
+                    </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>
+                </tr>
+            </table>                
         </div>
     </div>
+
 </div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/enrollment.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/enrollment.html	2014-04-03 12:27:23 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/enrollment.html	2014-04-04 11:55:55 +0000
@@ -5,19 +5,59 @@
             <a href ng-click="removeWidget(enrollmentWidget)" 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>
-            <div> 
+    <table class="table">
+        <tr>
+            <td>
                 {{'program'| translate}}
-                <span class="right">
-                    <select ng-model="selectedProgram"
-                            class="form-control"
-                            ng-options="program as program.name for program in programs | orderBy: 'name'" 
-                            ng-change="loadEvents(selectedProgram.id)">
-                        <option value="">{{'please_select'| translate}}</option>
-                    </select>
-                </span>
-            </div>
-        </div> 
-    </div>
+            </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-if="selectedProgram && !selectedEnrollment" 
+                        ng-click="enroll()">
+                    {{'enroll'| translate}}
+                </button>  
+            </td>                
+            <td>
+                <button type="button" 
+                        class="btn btn-default"
+                        ng-if="selectedProgram && selectedEnrollment" 
+                        ng-click="scheduling()">
+                    {{'scheduling'| translate}}
+                </button>                                
+            </td>
+        </tr>
+    </table>
+    <div ng-if="selectedProgram">
+        <div ng-if="programStages">
+            <table class="table">
+                <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}}
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>    
 </div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/profile.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/profile.html	2014-04-03 12:27:23 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/profile.html	2014-04-04 11:55:55 +0000
@@ -1,49 +1,46 @@
 <div class="panel panel-default" ng-controller="ProfileController">
     <div class="panel-heading">
-        {{trackedEntity.name || 'entity' | translate}} {{profileWidget.title| translate}}
+        {{trackedEntity.name|| 'entity' | translate}} {{profileWidget.title| translate}}
         <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>
-    <div class="panel-body dashboard-element-container">
-        <div class="form-group">
-            <div class="row" ng-repeat="attribute in selectedEntity.attributes">
-                <div class="col-sm-6">
-                    {{attribute.displayName}}
-                </div>                
-                <div class="col-sm-6">
-                    <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"/>
-                        </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">
+    <table class="table table-striped table-hover">
+        <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"/>
+                    </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 attributes[attribute.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>                                                                                                    
-                </div>
-
-            </div>
-        </div>
-    </div>
+                        </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 
+                               />
+                    </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>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/selected.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/selected.html	2014-04-03 12:27:23 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/selected.html	2014-04-04 11:55:55 +0000
@@ -6,7 +6,7 @@
         </span>        
     </div>    
     <div class="panel-body dashboard-element-container">
-        <div class="row" ng-repeat="selection in selected.selections">
+        <div class="row" ng-repeat="selection in selections">
             <div class="col-sm-6">
                 {{selection.title| translate}}
             </div>

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/selection.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/selection.html	2014-03-26 09:44:22 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/selection.html	2014-04-04 11:55:55 +0000
@@ -27,27 +27,20 @@
             <tr>
                 <td>{{'registering_unit'| translate}}</td>
                 <td><input type="text" class="fixed-text-width" selected-org-unit ng-model="selectedOrgUnit.name" value="{{selectedOrgUnit.name|| 'please_select'| translate}}" disabled=""></td>                           
-            </tr>
-            <tr>
-                <td>{{'program'| translate}}<em title="{{'required'| translate}}" class="required">*</em></td>
-                <td>
-                    <select class="fixed-select-width"
-                            id="programId" 
-                            name="programId" 
-                            ng-model="selectedProgram" 
-                            ng-options="program as program.name for program in programs | orderBy: 'name'" 
-                            ng-change="clearEntities()"
-                            ng-disabled="!selectedOrgUnit">
-                        <option value="">{{'view_all'| translate}}</option>
-                    </select>      
-                </td>
                 <td style='padding-left: 5px;'>
                     <button class="button"
                             ng-show="selectedOrgUnit" 
                             ng-click="loadTrackedEntities()">
                         {{'list_all_entities'| translate}}
                     </button>  
-                </td>                
+                </td>
+                <td style='padding-left: 5px;'>
+                    <button class="button"
+                            ng-show="selectedOrgUnit" 
+                            ng-click="showSearch()">
+                        {{'search'| translate}}
+                    </button>  
+                </td>
                 <td style='padding-left: 5px;'>
                     <button class="button"
                             ng-disabled="!selectedOrgUnit" 
@@ -55,20 +48,17 @@
                         {{'add_new'| translate}}
                     </button>                                
                 </td>
-            </tr>                       
-        </table>                    
-    </div>                
-    <!-- selection ends -->   
-
-    <!-- search begins -->
-    <div style="width: 50%;">
-        <accordion>
-            <accordion>
-                <accordion-group is-open="{{searchField.isOpen}}">
-                    <accordion-heading>
-                        {{searchField.title| translate}}
-                    </accordion-heading>
-                    <div>
+            </tr>
+            <tr ng-show="showSearchDiv">
+                <td colspan="5">
+                    <!-- search begins -->
+                    <div class="panel panel-default">
+                        <div class="panel-heading">
+                            {{'search_attributes'| translate}}
+                            <span class="pull-right">
+                                <a href ng-click="closeSearch()" title="{{'remove'| translate}}"><span class='black'><i class="fa fa-times-circle"></i></span></a>            
+                            </span>        
+                        </div>
                         <div class="form-group">
                             <div class="row" ng-repeat="attribute in attributes">
                                 <div class="col-sm-6">
@@ -84,9 +74,9 @@
                                         </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>
+                                                <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">
@@ -107,16 +97,16 @@
                                 </div>
                             </div>
                         </div>
-
                         <div class="vertial-spacing">
                             <button ng-click="search()">{{'search'| translate}}</button>
                         </div>
                     </div>                        
-                </accordion-group>
-            </accordion>                
-        </accordion>                	
-    </div>
-    <!-- search ends -->
+                    <!-- search ends -->
+                </td>
+            </tr>
+        </table>                    
+    </div>                
+    <!-- selection ends -->
 
     <!-- entity grid begins -->
     <div id="listDiv" ng-switch="trackedEntityList">                    
@@ -188,12 +178,10 @@
                         <tbody id="list">
                             <tr ng-repeat="trackedEntity in trackedEntityList.rows| paginate:rowsPerPage | orderBy:sortHeader:reverse | gridFilter:filterText:currentFilter" 
                                 ng-click="showDashboard(trackedEntity)">
-
                                 <td class="max-column-width"                                              
                                     ng-repeat="gridColumn in gridColumns">                                                
                                     {{trackedEntity[gridColumn.id]}}                                                
                                 </td>
-
                             </tr>
                         </tbody>        
                     </table>
@@ -202,7 +190,6 @@
                 </div>
             </div>                        
         </div>
-
     </div> 
     <!-- entity grid ends -->
 </div>           

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/widgets.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/widgets.html	2014-04-03 12:27:23 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/widgets.html	2014-04-04 11:55:55 +0000
@@ -6,7 +6,7 @@
     <table class="listTable dhis2-table-striped-border">
         <tr ng-repeat="biggerWidget in dashboardWidgets.bigger">
             <td>
-                {{biggerWidget.title}}
+                {{biggerWidget.title | translate}}
             </td>
             <td>
                 <input type="checkbox" ng-model="biggerWidget.show">
@@ -14,7 +14,7 @@
         </tr>
         <tr ng-repeat="smallerWidget in dashboardWidgets.smaller">
             <td>
-                {{smallerWidget.title}}
+                {{smallerWidget.title | translate}}
             </td>
             <td>
                 <input type="checkbox" ng-model="smallerWidget.show">