← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16529: tracker capture - WIP for visit scheduling and lost to followup

 

------------------------------------------------------------
revno: 16529
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-08-26 18:39:26 +0200
message:
  tracker capture - WIP for visit scheduling and lost to followup
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.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/report-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js	2014-08-25 13:40:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report-controller.js	2014-08-26 16:39:26 +0000
@@ -7,7 +7,9 @@
                 TEIGridService,
                 TranslationService,
                 AttributesFactory,
-                DHIS2EventFactory) {
+                ProgramFactory,
+                DHIS2EventFactory,
+                storage) {
 
     TranslationService.translate();
     
@@ -17,6 +19,57 @@
     $scope.selectedOuMode = $scope.ouModes[0];
     $scope.report = {};
     
+    //watch for selection of org unit from tree
+    $scope.$watch('selectedOrgUnit', function() {        
+        if( angular.isObject($scope.selectedOrgUnit)){            
+            storage.set('SELECTED_OU', $scope.selectedOrgUnit);            
+            $scope.loadPrograms($scope.selectedOrgUnit);
+        }
+    });
+    
+    //load programs associated with the selected org unit.
+    $scope.loadPrograms = function(orgUnit) {                
+        
+        $scope.selectedOrgUnit = orgUnit;
+        
+        if (angular.isObject($scope.selectedOrgUnit)) {   
+
+            ProgramFactory.getAll().then(function(programs){
+                $scope.programs = [];
+                angular.forEach(programs, function(program){                            
+                    if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnit.id)){                                
+                        $scope.programs.push(program);
+                    }
+                });
+
+                if($scope.programs.length === 0){
+                    $scope.selectedProgram = null;
+                }
+                else{
+                    if($scope.selectedProgram){
+                        angular.forEach($scope.programs, function(program){                            
+                            if(program.id === $scope.selectedProgram.id){                                
+                                $scope.selectedProgram = program;
+                            }
+                        });
+                    }
+                    else{                        
+                        if($scope.programs.length === 1){
+                            $scope.selectedProgram = $scope.programs[0];
+                        }                        
+                    }
+                } 
+            });
+        }        
+    };
+    
+    //watch for selection of org unit from tree
+    $scope.$watch('selectedProgram', function() {        
+        if( angular.isObject($scope.selectedProgram)){            
+            $scope.dataReady = false;
+        }
+    });
+    
     $scope.generateReport = function(){
         
         $scope.dataReady = false;
@@ -71,6 +124,7 @@
                         ev = EventUtils.setEventOrgUnitName(ev);
                     }
                 });
+                
             });
         });
     };

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html	2014-08-25 13:40:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/report.html	2014-08-26 16:39:26 +0000
@@ -1,11 +1,50 @@
-<div class="bordered-div"  ng-controller="ReportController">
+<script src="../dhis-web-commons/ouwt/ouwt.js"></script>
+<script src="scripts/tracker-capture.js"></script>
+
+<div id="leftBar">
+   
+    <div class='col-sm-12'>
+        <h2>
+            {{'menu' | translate}}
+        </h2>
+    </div>
+    <ul class="nav nav-pills nav-stacked" ng-controller="LeftBarMenuController">
+        <li><a href class='menuTitle' ng-click="showHome()">{{'registration_and_data_entry' | translate}}</a></li>
+        <li><a href class='menuTitle' ng-click="showSummaryReport()">{{'program_summary_report' | translate}}</a></li>
+        <li><a href class='menuTitle' ng-click="showVisitSchedule()">{{'visit_schedule' | translate}}</a></li>
+        <li><a href class='menuTitle' ng-click="showLostToFollowup()">{{'lost_to_followup' | translate}}</a></li>
+    </ul>
+    <div id="orgUnitTree" style="margin-top:20px">
+        <ul>
+        </ul>
+    </div>
+    <img id="ouwt_loader" src="../images/ajax-loader-bar.gif"/>
+    <!--- selected org unit begins -->
+    <input type="text" selected-org-unit ng-model="selectedOrgUnit.name" ng-hide=true>
+    <!--- selected org unit ends  -->
+</div>
+
+<div id="mainPage" class="bordered-div">
     <form name="outerForm" novalidate>               
         <div class="row">
-            <div class="col-md-6">
-                <table class="table-borderless">
-                    <tr>
-                        <td>{{'org_unit'| translate}}</td>
-                        <td>                    
+            <div class="col-sm-12 col-md-8">
+                <table class="table table-borderless table-striped">
+                    <tr>
+                        <td class='col-sm-6 col-md-4 vertical-center'>
+                            {{'program' | translate}}
+                        </td>
+                        <td class='col-sm-6 col-md-4'>
+                            <select ng-model="selectedProgram"
+                                    class="form-control"
+                                    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>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='col-sm-6 col-md-4 vertical-center'>{{'org_unit'| translate}}</td>
+                        <td class='col-sm-6 col-md-4'>                 
                             <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/>
@@ -30,9 +69,8 @@
                     </tr>
                 </table>                
             </div>
-            <div class="col-md-6 trim">                  
-                <button type="button" class="btn btn-primary" ng-click="generateReport()" ng-disabled="!selectedProgram">{{'go'| translate}}</button>
-                <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="showReport()">{{'close'| translate}}</button>
+            <div class="col-md-6 trim">
+                <button type="button" class="btn btn-primary" ng-click="generateReport()" ng-disabled="!selectedProgram">{{'go'| translate}}</button>               
             </div>
         </div>
     </form>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-08-18 10:01:22 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-08-26 16:39:26 +0000
@@ -112,8 +112,13 @@
     "dataentry": "Data Entry",
     "custom_form": "Custom form",
     "default_form": "Default form",
+    "menu": "Menu",
     "report": "Report",
     "_report": "report", 
+    "registration_and_data_entry": "Registration and Data Entry",
+    "program_summary_report": "Program Summary Report",
+    "visit_schedule": "Visit Schedule",
+    "lost_to_followup": "Lost to Follow-up",
     "registered_data": "Registered data",
     "no_data": "No data",
     "data_exists": "Data exists",

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html	2014-08-18 10:01:22 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html	2014-08-26 16:39:26 +0000
@@ -51,7 +51,8 @@
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script>
-        <!--<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>-->                 
+        <!--<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>-->
+        <!--<script type="text/javascript" src="../dhis-web-commons/ouwt/ouwt.js"></script>-->
 
         <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angularLocalStorage.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angular-translate.min.js"></script>
@@ -63,7 +64,8 @@
         <script type="text/javascript" src="scripts/services.js"></script>
         <script type="text/javascript" src="scripts/filters.js"></script>
         <script type="text/javascript" src="scripts/directives.js"></script>
-        <script type="text/javascript" src="scripts/controllers.js"></script>
+        <script type="text/javascript" src="scripts/controllers.js"></script>        
+        <script type="text/javascript" src="scripts/tracker-capture.js"></script>
         <script type="text/javascript" src="components/dashboard/dashboard-controller.js"></script>
         <script type="text/javascript" src="components/dashboard/dashboard-widgets-controller.js"></script>
         <script type="text/javascript" src="components/registration/registration-controller.js"></script>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js	2014-06-19 15:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/app.js	2014-08-26 16:39:26 +0000
@@ -3,17 +3,17 @@
 /* App Module */
 
 var trackerCapture = angular.module('trackerCapture',
-		 ['ui.bootstrap', 
-		  'ngRoute', 
-		  'ngCookies',  
-		  'trackerCaptureServices',
-		  'trackerCaptureFilters',
-                  'trackerCaptureDirectives', 
-                  'trackerCaptureControllers',
-		  'angularLocalStorage',
-                  'ui.select2',
-                  'd2Menu',
-		  'pascalprecht.translate'])
+        ['ui.bootstrap', 
+         'ngRoute', 
+         'ngCookies',  
+         'trackerCaptureServices',
+         'trackerCaptureFilters',
+         'trackerCaptureDirectives', 
+         'trackerCaptureControllers',
+         'angularLocalStorage',
+         'ui.select2',
+         'd2Menu',
+         'pascalprecht.translate'])
               
 .value('DHIS2URL', '..')
 
@@ -28,6 +28,9 @@
     }).when('/dashboard',{
         templateUrl:'components/dashboard/dashboard.html',
         controller: 'DashboardController'
+    }).when('/report',{
+        templateUrl:'components/report/report.html',
+        controller: 'ReportController'
     }).otherwise({
         redirectTo : '/'
     });  

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-08-13 08:49:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-08-26 16:39:26 +0000
@@ -346,7 +346,7 @@
         }, function () {
         });
     };
-    
+
     $scope.showDashboard = function(currentEntity){   
         $location.path('/dashboard').search({tei: currentEntity.id,                                            
                                             program: $scope.selectedProgram ? $scope.selectedProgram.id: null});                                    
@@ -383,6 +383,23 @@
 })
 
 //Controller for the header section
+.controller('LeftBarMenuController',
+        function($scope,
+                $location,
+                TranslationService) {
+
+    TranslationService.translate();
+    
+    $scope.showHome = function(){
+        $location.path('/').search();                                    
+    };
+    
+    $scope.showSummaryReport = function(){   
+        $location.path('/report').search();                                    
+    };   
+})
+
+//Controller for the header section
 .controller('HeaderController',
         function($scope,                
                 DHIS2URL,

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-08-18 10:01:22 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-08-26 16:39:26 +0000
@@ -20,7 +20,11 @@
 }
 
 div#orgUnitTree {
-    height: 75%;
+    height: 50%;
+}
+
+.menuTitle {
+    font-size: 1em;
 }
 
 .top-bar {

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html	2014-08-13 08:49:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html	2014-08-26 16:39:26 +0000
@@ -2,12 +2,25 @@
 <script src="scripts/tracker-capture.js"></script>
 
 <div id="leftBar">
+   
+    <div class='col-sm-12'>
+        <h2>
+            {{'menu' | translate}}
+        </h2>
+    </div>
+    <ul class="nav nav-pills nav-stacked" ng-controller="LeftBarMenuController">
+        <li><a href class='menuTitle' ng-click="showHome()">{{'registration_and_data_entry' | translate}}</a></li>
+        <li><a href class='menuTitle' ng-click="showSummaryReport()">{{'program_summary_report' | translate}}</a></li>
+        <li><a href class='menuTitle' ng-click="showVisitSchedule()">{{'visit_schedule' | translate}}</a></li>
+        <li><a href class='menuTitle' ng-click="showLostToFollowup()">{{'lost_to_followup' | translate}}</a></li>
+    </ul>
     <div id="orgUnitTree" style="margin-top:20px">
         <ul>
         </ul>
     </div>
     <img id="ouwt_loader" src="../images/ajax-loader-bar.gif"/>
 </div>
+
 <div class="page" id="mainPage" ng-show="selectedOrgUnit">
 
     <!-- top bar begins -->
@@ -193,12 +206,6 @@
                     ng-click="showRegistration()">                    
                 {{'register'| translate}}
             </button>
-            <button type="button" 
-                    class="btn btn-primary" 
-                    ng-disabled="showRegistrationDiv"
-                    ng-click="showReport()">                    
-                {{'report'| translate}} 
-            </button>
         </div>
     </div>
     <!--- search, registration and reporting menu ends -->

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html	2014-07-10 13:17:04 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/tei.html	2014-08-26 16:39:26 +0000
@@ -13,7 +13,7 @@
         
         <!-- entity begins -->
         <div class="vertical-spacing">
-            <table class="table table-striped dhis2-table-hover">               
+            <table class="table table-striped dhis2-table-hover table-bordered">               
                 <thead>                        
                     <tr>
                         <th ng-show="gridColumn.show" ng-repeat="gridColumn in gridColumns">
@@ -33,8 +33,9 @@
                 </tbody>        
             </table>
         </div>
-        <!-- entity ends -->  
-        <serverside-paginator></serverside-paginator> 
-                  
+        <!-- entity ends -->      
+        <span ng-if='pager.pageCount > 1'>
+            <serverside-paginator></serverside-paginator> 
+        </span>                  
     </div>
 </div> 
\ No newline at end of file