← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18944: show selected ou in report form

 

------------------------------------------------------------
revno: 18944
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-04-20 09:30:05 +0200
message:
  show selected ou in report form
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.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/report/program-statistics-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js	2015-03-30 10:40:41 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js	2015-04-20 07:30:05 +0000
@@ -18,8 +18,13 @@
     //Paging
     $scope.pager = {pageSize: 50, page: 1, toolBarDisplay: 5};
     
+    function resetParams(){
+        $scope.reportStarted = false;
+        $scope.dataReady = false;
+    }
     //watch for selection of org unit from tree
     $scope.$watch('selectedOrgUnit', function() {      
+        resetParams();
         $scope.selectedProgram = null;
         if( angular.isObject($scope.selectedOrgUnit)){        
             $scope.loadPrograms($scope.selectedOrgUnit);
@@ -40,8 +45,7 @@
     //watch for selection of program
     $scope.$watch('selectedProgram', function() {   
         if( angular.isObject($scope.selectedProgram)){            
-            $scope.reportStarted = false;
-            $scope.dataReady = false;
+            resetParams();
         }
     });
     

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js	2015-04-15 09:04:32 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js	2015-04-20 07:30:05 +0000
@@ -34,6 +34,10 @@
     //watch for selection of org unit from tree
     $scope.$watch('selectedOrgUnit', function() {      
         $scope.selectedProgram = null;
+        $scope.reportStarted = false;
+        $scope.dataReady = false;  
+        $scope.programStages = null;
+        $scope.stagesById = [];
         if( angular.isObject($scope.selectedOrgUnit)){            
             $scope.loadPrograms($scope.selectedOrgUnit);
         }
@@ -50,8 +54,7 @@
         }        
     };
     
-    $scope.getSelectedProgram = function(program){        
-        $scope.selectedProgram = program;
+    $scope.$watch('selectedProgram', function() {        
         $scope.programStages = null;
         $scope.stagesById = [];
         if( angular.isObject($scope.selectedProgram)){            
@@ -65,7 +68,7 @@
                 });
             });
         }
-    };
+    });
     
     $scope.generateReport = function(program, report, ouMode){
         

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html	2015-04-15 09:04:32 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html	2015-04-20 07:30:05 +0000
@@ -2,28 +2,33 @@
     <div class="col-sm-8 col-md-6">
         <table class="table table-borderless table-striped">
             <tr>
+                <td>{{'org_unit'| translate}}</td>
+                <td>
+                    <input type="text" class="form-control" value="{{selectedOrgUnit.name|| 'please_select'| translate}}" ng-disabled="true">                                                                                        
+                </td>
+            </tr>            
+            <tr>
+                <td class='col-sm-4 col-md-3 vertical-center'>{{'org_unit'| translate}}</td>
+                <td class='col-sm-4 col-md-3'>                 
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="selected" value="SELECTED"> {{'SELECTED'| translate}}</label><br/>
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="children" value="CHILDREN"> {{'CHILDREN'| translate}}</label><br/>
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="descendants" value="DESCENDANTS"> {{'DESCENDANTS'| translate}}</label><br/>
+                    <label><input type="radio" ng-model="selectedOuMode.name" name="accessible" value="ACCESSIBLE"> {{'ACCESSIBLE'| translate}}</label>
+                </td>
+            </tr>
+            <tr>
                 <td class='col-sm-4 col-md-3 vertical-center'>
                     {{'program'| translate}}
                 </td>
                 <td class='col-sm-4 col-md-3'>
                     <select ng-model="selectedProgram"
                             class="form-control"
-                            ng-options="program as program.name for program in programs | orderBy: 'name'" 
-                            ng-change="getSelectedProgram(selectedProgram)"
+                            ng-options="program as program.name for program in programs | orderBy: 'name'"
                             ng-disabled="programs.length < 1">
-                        <option value="">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists'| translate}}</option>
+                        <option value="">{{programs.length > 0 ? 'please_select' : 'no_program_exists'| translate}}</option>
                     </select>
                 </td>
             </tr>
-            <tr>
-                <td class='col-sm-4 col-md-3 vertical-center'>{{'org_unit'| translate}}</td>
-                <td class='col-sm-4 col-md-3'>                 
-                    <label><input type="radio" ng-model="selectedOuMode.name" name="selected" value="SELECTED"> {{'SELECTED'| translate}}</label><br/>
-                    <label><input type="radio" ng-model="selectedOuMode.name" name="children" value="CHILDREN"> {{'CHILDREN'| translate}}</label><br/>
-                    <label><input type="radio" ng-model="selectedOuMode.name" name="descendants" value="DESCENDANTS"> {{'DESCENDANTS'| translate}}</label><br/>
-                    <label><input type="radio" ng-model="selectedOuMode.name" name="accessible" value="ACCESSIBLE"> {{'ACCESSIBLE'| translate}}</label>
-                </td>
-            </tr>
         </table>
     </div>
 </div>