← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17883: minor

 

------------------------------------------------------------
revno: 17883
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-01-05 12:39:25 +0100
message:
  minor
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties


--
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/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-01-05 10:20:46 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-01-05 11:39:25 +0000
@@ -40,7 +40,7 @@
     $scope.showEventColors = false;
     
     //listen for the selected items
-    $scope.$on('dashboardWidgets', function() {  
+    $scope.$on('dashboardWidgets', function() {        
         $scope.showDataEntryDiv = false;
         $scope.showEventCreationDiv = false;
         $scope.showDummyEventDiv = false;        
@@ -71,20 +71,17 @@
                     $scope.selectedProgramWithStage[stage.id] = stage;
                 });
                 
-                $scope.getEvents();
-                
+                $scope.getEvents();                
             });
         }
     });
     
-    $scope.getEvents = function(){        
-        $scope.dhis2Events = '';
-        DHIS2EventFactory.getEventsByProgram($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgram.id).then(function(data){
-            $scope.dhis2Events = data;
-            if(angular.isObject($scope.dhis2Events)){
-                angular.forEach($scope.dhis2Events, function(dhis2Event){                    
+    $scope.getEvents = function(){
+        $scope.dhis2Events = [];
+        DHIS2EventFactory.getEventsByProgram($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgram.id).then(function(events){
+            if(angular.isObject(events)){
+                angular.forEach(events, function(dhis2Event){                    
                     if(dhis2Event.enrollment === $scope.selectedEnrollment.enrollment){
-                        
                         if(dhis2Event.notes){
                             dhis2Event.notes = orderByFilter(dhis2Event.notes, '-storedDate');            
                             angular.forEach(dhis2Event.notes, function(note){
@@ -111,13 +108,14 @@
                                 $scope.currentEvent = dhis2Event;                                
                                 $scope.showDataEntry($scope.currentEvent, true);
                             }
-                        } 
+                        }
+                        
+                        $scope.dhis2Events.push(dhis2Event);
                     }
                 });
-                
-                $scope.dhis2Events = orderByFilter($scope.dhis2Events, '-sortingDate');
             }
             
+            $scope.dhis2Events = orderByFilter($scope.dhis2Events, '-sortingDate');            
             $scope.dummyEvents = $scope.checkForEventCreation($scope.dhis2Events, $scope.selectedProgram);
         });          
     };

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-01-05 10:34:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-01-05 11:39:25 +0000
@@ -61,6 +61,7 @@
                 
                     if(enrollment.status === 'ACTIVE'){
                         selectedEnrollment = enrollment;
+                        $scope.currentEnrollment = enrollment;
                     }
                     if(enrollment.status === 'CANCELLED'){//check for cancelled ones
                         $scope.cancelledEnrollments.push(enrollment);
@@ -78,16 +79,19 @@
                 $scope.loadEnrollmentDetails(selectedEnrollment);
             }
             else{
-                $scope.selectedEnrollment = null;                
+                $scope.selectedEnrollment = null;
+                $scope.broadCastSelections('dashboardWidgets');
             }
         }
+        else{
+            $scope.broadCastSelections('dashboardWidgets');
+        }
         
-        $scope.broadCastSelections('dashboardWidgets');
     });
     
-    $scope.loadEnrollmentDetails = function(enrollment) {        
+    $scope.loadEnrollmentDetails = function(enrollment) {
         
-        //$scope.showEnrollmentHistoryDiv = false;
+        $scope.showEnrollmentHistoryDiv = false;
         $scope.selectedEnrollment = enrollment;
         
         if(!$scope.selectedEnrollment){//prepare for possible enrollment
@@ -114,16 +118,13 @@
         if($scope.showEnrollmentDiv){
             $scope.hideEnrollmentDiv();
         }
-        
-        if($scope.showEnrollmentHistoryDiv){
-            $scope.showEnrollmentHistoryDiv = !$scope.showEnrollmentHistoryDiv;
-        }
-        
+       
         $scope.showEnrollmentDiv = !$scope.showEnrollmentDiv;
         
         if($scope.showEnrollmentDiv){
-            $scope.selectedEnrollment = null;
-            $scope.broadCastSelections('dashboardWidgets');            
+            
+            $scope.showEnrollmentHistoryDiv = false;
+            $scope.selectedEnrollment = null;                        
             $scope.selectedProgram.hasCustomForm = false;
             $scope.registrationForm = '';
             TEFormService.getByProgram($scope.selectedProgram.id).then(function(teForm){
@@ -133,14 +134,21 @@
                 }                
                 $scope.selectedProgram.displayCustomForm = $scope.selectedProgram.hasCustomForm ? true:false;
             });
+            
+            $scope.broadCastSelections('dashboardWidgets');
         }
     };
        
     $scope.showEnrollmentHistory = function(){
-        if($scope.showEnrollmentDiv){
-            $scope.showEnrollmentDiv = !$scope.showEnrollmentDiv;
-        }        
+        
         $scope.showEnrollmentHistoryDiv = !$scope.showEnrollmentHistoryDiv;
+        
+        if($scope.showEnrollmentHistoryDiv){
+            $scope.selectedEnrollment = null;
+            $scope.showEnrollmentDiv = false;
+            
+            $scope.broadCastSelections('dashboardWidgets');
+        }
     };
     
     $scope.enroll = function(){    

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2015-01-05 10:20:46 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2015-01-05 11:39:25 +0000
@@ -1,12 +1,16 @@
 <div class="panel panel-info" ng-controller="EnrollmentController">
-    <div class="panel-heading handle bold">                                            
+    <div class="panel-heading handle bold">
+        
         <span ng-class="{'light-blue': true}">{{enrollmentWidget.title| translate}}</span>
-        <span class="nav-pills" ng-show="selectedProgram && (!selectedEnrollment || selectedEnrollment.status === 'COMPLETED')">
+        <span class="nav-pills" ng-show="selectedProgram && currentEnrollment && currentEnrollment !== selectedEnrollment">
+            | <a href ng-click="loadEnrollmentDetails(currentEnrollment)" title="{{'current'| translate}}"><span ng-class="{'light-blue': !showEnrollmentDiv}">{{'current'| translate}}</span></a>
+        </span>
+        <span class="nav-pills" ng-show="selectedProgram && !currentEnrollment">
             | <a href ng-click="showNewEnrollment()" title="{{'new'| translate}}"><span ng-class="{'light-blue': !showEnrollmentDiv}">{{'new'| translate}}</span></a>
         </span>
         <span class="nav-pills" ng-show="terminatedEnrollments.length > 0 || completedEnrollments.length > 0">
             | <a href ng-click="showEnrollmentHistory()" title="{{'history'| translate}}"><span ng-class="{'light-blue': !showEnrollmentHistoryDiv}">{{'history'| translate}}</span></a>
-        </span>        
+        </span>       
 
         <span class="pull-right">
             <a class="small-horizonal-spacing" href ng-click="expandCollapse(enrollmentWidget)">
@@ -19,6 +23,7 @@
     <div ng-show="enrollmentWidget.expand" class="panel-body dashboard-widget-container">
         <!-- operations on selected enrollment begins -->
         <div ng-if="selectedEnrollment">
+            
             <table class="table-borderless table-striped">
                 <tr class="col-md-12">
                     <td class="col-md-6">
@@ -38,7 +43,6 @@
                 </tr>                
             </table>
 
-
             <div class="vertical-spacing horizonal-spacing">
 
                 <button type="button" 
@@ -72,6 +76,7 @@
                 </button>
 
             </div>
+            
         </div>
         <!-- operations on selected enrollment ends -->
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-01-05 10:20:46 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-01-05 11:39:25 +0000
@@ -221,6 +221,7 @@
 found=Found
 move_to_selected=Move to selected
 move_all_to_selected=Move all to selected
+current=Current
 new=New
 add_new=Add new
 register_new=Register new