← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19740: tracker-capture: display enrolling orgunit name in enrollment widget

 

------------------------------------------------------------
revno: 19740
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-08-07 12:37:31 +0200
message:
  tracker-capture: display enrolling orgunit name in enrollment widget
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/enrollment-dates-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  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/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-07-13 07:37:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-08-07 10:37:31 +0000
@@ -8,6 +8,7 @@
                 DateUtils,
                 SessionStorageService,
                 CurrentSelection,
+                OrgUnitService,
                 EnrollmentService,
                 ModalService) {
     
@@ -78,7 +79,19 @@
         $scope.showEnrollmentHistoryDiv = false;
         $scope.selectedEnrollment = enrollment;
         
-        if($scope.selectedEnrollment.enrollment){
+        if($scope.selectedEnrollment.enrollment && $scope.selectedEnrollment.orgUnit){
+            if($scope.selectedEnrollment.orgUnit !== $scope.selectedOrgUnit.id) {
+                OrgUnitService.open().then(function(){
+                    OrgUnitService.get($scope.selectedEnrollment.orgUnit).then(function(ou){
+                        if(ou){
+                            $scope.selectedEnrollment.orgUnitName = $scope.selectedOrgUnit.name;
+                        }                                                       
+                    });           
+                });
+            }
+            else{
+                $scope.selectedEnrollment.orgUnitName = $scope.selectedOrgUnit.name;
+            }
             $scope.broadCastSelections('dashboardWidgets');
         }
     };
@@ -96,7 +109,7 @@
             $scope.showEnrollmentHistoryDiv = false;
             
             //load new enrollment details
-            $scope.selectedEnrollment = {};            
+            $scope.selectedEnrollment = {orgUnitName: $scope.selectedOrgUnit.name};            
             $scope.loadEnrollmentDetails($scope.selectedEnrollment);
             
             $timeout(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-03-25 16:43:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2015-08-07 10:37:31 +0000
@@ -28,6 +28,14 @@
             <table class="table-borderless table-striped">
                 <tr class="col-md-12">
                     <td class="col-md-6">
+                        {{'enrolling_orgunit' | translate}}
+                    </td>
+                    <td class="col-md-6">
+                        <input type="text" class="form-control" value={{selectedEnrollment.orgUnitName}} ng-disabled="true"/>
+                    </td>
+                </tr>
+                <tr class="col-md-12">
+                    <td class="col-md-6">
                         {{selectedProgram.dateOfEnrollmentDescription}}
                     </td>
                     <td class="col-md-6">

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/enrollment-dates-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/enrollment-dates-form.html	2015-03-26 12:26:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/enrollment-dates-form.html	2015-08-07 10:37:31 +0000
@@ -1,6 +1,14 @@
 <table class="dhis2-list-table-striped dhis2-table-hover">
     <tr>
         <td>
+            {{'enrolling_orgunit' | translate}}
+        </td>
+        <td>
+            <input type="text" class="form-control" value={{selectedEnrollment.orgUnitName}} ng-disabled="true"/>
+        </td>
+    </tr>
+    <tr>
+        <td>
             {{selectedProgram.dateOfEnrollmentDescription}}
         </td>
         <td>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-08-06 14:08:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-08-07 10:37:31 +0000
@@ -63,7 +63,7 @@
     }
     
     $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
-    $scope.selectedEnrollment = {dateOfEnrollment: $scope.today, dateOfIncident: $scope.today};   
+    $scope.selectedEnrollment = {dateOfEnrollment: $scope.today, dateOfIncident: $scope.today, orgUnitName: $scope.selectedOrgUnit.name};   
             
     $scope.trackedEntities = {available: []};
     TEService.getAll().then(function(entities){

=== 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-07-13 07:37:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-08-07 10:37:31 +0000
@@ -122,6 +122,7 @@
 back=Back
 profile=Profile
 enrollment=Enrollment
+enrolling_orgunit=Enrolling orgunit
 delete_enrollment=Delete enrollment
 terminate_enrollment=Terminate enrollment
 complete_enrollment=Complete enrollment