← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21923: tracker-capture: bug fix in enrollment widget

 

------------------------------------------------------------
revno: 21923
committer: Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-02-10 08:35:16 +0100
message:
  tracker-capture: bug fix in enrollment widget
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2016-02-04 10:43:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2016-02-10 07:35:16 +0000
@@ -335,7 +335,8 @@
         }
     });
     
-    $scope.applySelectedProgram = function(){
+    $scope.applySelectedProgram = function(pr){
+        $scope.selectedProgram = pr;
         getDashboardLayout();
     };
     
@@ -351,8 +352,18 @@
         
         $scope.trackedEntity = selections.te;
         $scope.optionSets = selections.optionSets;
-        
-        CurrentSelection.set({tei: $scope.selectedTei, te: $scope.trackedEntity, prs: $scope.programs, pr: $scope.selectedProgram, prNames: $scope.programNames, prStNames: $scope.programStageNames, enrollments: selections.enrollments, selectedEnrollment: selections.selectedEnrollment, optionSets: $scope.optionSets});        
+        $scope.selectedEnrollment = null;
+        
+        if($scope.selectedProgram){            
+            for(var i=0; i<selections.enrollments.length; i++){
+                if(selections.enrollments[i].program === $scope.selectedProgram.id){
+                    $scope.selectedEnrollment = selections.enrollments[i];
+                    break;
+                }
+            }
+        }
+        
+        CurrentSelection.set({tei: $scope.selectedTei, te: $scope.trackedEntity, prs: $scope.programs, pr: $scope.selectedProgram, prNames: $scope.programNames, prStNames: $scope.programStageNames, enrollments: selections.enrollments, selectedEnrollment: $scope.selectedEnrollment, optionSets: $scope.optionSets});        
         $timeout(function() { 
             $rootScope.$broadcast('selectedItems', {programExists: $scope.programs.length > 0});            
         }, 500);

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html	2016-02-04 10:43:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html	2016-02-10 07:35:16 +0000
@@ -51,7 +51,7 @@
                         class="form-control-program"
                         ng-options="program as program.name for program in programs | orderBy: 'name'" 
                         ng-disabled="programs.length < 1"
-                        ng-change="applySelectedProgram()">
+                        ng-change="applySelectedProgram(selectedProgram)">
                     <option value="">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists' | translate}}</option>
                 </select>
 		</div>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2016-02-04 10:43:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2016-02-10 07:35:16 +0000
@@ -26,13 +26,13 @@
                             {{'selected_program'| translate}}                           
                         </span>
                         <span class="nav-pills" ng-show="selectedProgram && currentEnrollment && currentEnrollment !== selectedEnrollment">
-                            | <a href ng-click="loadEnrollmentDetails(currentEnrollment)" title="{{'current'| translate}}"><span ng-class="{true: 'widget-link-active', false: 'widget-link'} [showEnrollmentDiv]">{{'current'| translate}}</span></a>
+                            | <a href ng-click="loadEnrollmentDetails(currentEnrollment)" title="{{'current'| translate}}"><span ng-class="{true: 'widget-link-active bold', false: 'widget-link'} [showEnrollmentDiv]">{{'current'| translate}}</span></a>
                         </span>
                         <span class="nav-pills" ng-show="selectedProgram && !currentEnrollment && !selectedTei.inactive">
                             <span ng-show="selectedProgram && currentEnrollment && currentEnrollment !== selectedEnrollment">|</span> <a href ng-click="showNewEnrollment()" title="{{'add_new'| translate}}"><span ng-class="{true: 'widget-link-active', false: 'widget-link'} [showEnrollmentDiv]">{{'add_new'| translate}}</span></a>
                         </span>
                         <span class="nav-pills" ng-show="hasEnrollmentHistory">
-                            | <a href ng-click="showEnrollmentHistory()" title="{{'history'| translate}}"><span ng-class="{true: 'widget-link-active', false: 'widget - link'} [showEnrollmentHistoryDiv]">{{'history'| translate}}</span></a>
+                            | <a href ng-click="showEnrollmentHistory()" title="{{'history'| translate}}"><span ng-class="{true: 'widget-link-active bold', false: 'widget - link'} [showEnrollmentHistoryDiv]">{{'history'| translate}}</span></a>
                         </span>
                     </div>
                     <div class="vertical-spacing">
@@ -103,7 +103,7 @@
                         <!-- various alerts end -->
 
                         <!-- operations on historical enrollment begins -->
-                        <div ng-if="showEnrollmentHistoryDiv && !selectedEnrollment">
+                        <div ng-if="showEnrollmentHistoryDiv && !selectedEnrollment && historicalEnrollments.length > 0">
                             <table class="table table-striped dhis2-table-hover table-bordered">
                                 <tr>
                                     <th>