← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18902: tracker-capture: better display of program summary report. Display is now organized based on prog...

 

------------------------------------------------------------
revno: 18902
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-04-15 11:04:32 +0200
message:
  tracker-capture: better display of program summary report. Display is now organized based on programstages and display in reports property of program stage data elements
modified:
  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.html
  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/scripts/tracker-capture.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/search-ou-tree.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-summary-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-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-summary-controller.js	2015-04-15 09:04:32 +0000
@@ -9,6 +9,7 @@
                 TEIGridService,
                 AttributesFactory,
                 ProgramFactory,
+                ProgramStageFactory,
                 CurrentSelection,
                 OptionSetService,
                 DHIS2EventFactory) {    
@@ -49,13 +50,22 @@
         }        
     };
     
-    //watch for selection of program
-    $scope.$watch('selectedProgram', function() {   
+    $scope.getSelectedProgram = function(program){        
+        $scope.selectedProgram = program;
+        $scope.programStages = null;
+        $scope.stagesById = [];
         if( angular.isObject($scope.selectedProgram)){            
             $scope.reportStarted = false;
-            $scope.dataReady = false;
+            $scope.dataReady = false;            
+            ProgramStageFactory.getByProgram($scope.selectedProgram).then(function(stages){
+                $scope.programStages = stages;
+                $scope.stagesById = [];
+                angular.forEach(stages, function(stage){
+                    $scope.stagesById[stage.id] = stage;
+                });
+            });
         }
-    });
+    };
     
     $scope.generateReport = function(program, report, ouMode){
         
@@ -71,11 +81,6 @@
         
         $scope.reportStarted = true;
         $scope.dataReady = false;
-        
-        $scope.programStages = [];
-        angular.forEach($scope.selectedProgram.programStages, function(stage){
-            $scope.programStages[stage.id] = stage;
-        });
             
         AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){            
             var grid = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);   
@@ -103,11 +108,15 @@
                 $scope.dhis2Events = [];                
                 angular.forEach(eventList, function(ev){
                     if(ev.trackedEntityInstance){
-                        ev.name = $scope.programStages[ev.programStage].name;
+                        ev.name = $scope.stagesById[ev.programStage].name;
                         ev.programName = $scope.selectedProgram.name;
                         ev.statusColor = EventUtils.getEventStatusColor(ev); 
                         ev.eventDate = DateUtils.formatFromApiToUser(ev.eventDate);
                         
+                        angular.forEach(ev.dataValues, function(dv){
+                            ev[dv.dataElement] = dv.value;
+                        });
+                        
                         if($scope.dhis2Events[ev.trackedEntityInstance]){
                             if(teis.rows[ev.trackedEntityInstance]){
                                 $scope.teiList.push(teis.rows[ev.trackedEntityInstance]);

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary.html	2015-03-06 16:52:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary.html	2015-04-15 09:04:32 +0000
@@ -9,7 +9,7 @@
         <ul>
         </ul>
     </div>
-    <img id="ouwt_loader" src="../images/ajax-loader-bar.gif" alt="{{'loading_tree' | translate}}"/>
+    <img id="ouwt_loader" src="../images/ajax-loader-bar.gif" alt="{{'loading_tree'| translate}}"/>
     <!--- selected org unit begins -->
     <input type="text" selected-org-unit ng-model="selectedOrgUnit.name" ng-hide=true>
     <!--- selected org unit ends  -->
@@ -36,46 +36,68 @@
             <div ng-switch-default> 
 
                 <!-- report begins -->
-                <div class="vertical-spacing">                    
-                    <table class="table table-compact table-striped">
-                        <thead>
-                            <tr>
-                                <th>{{selectedProgram.trackedEntity.name}}</th>
-                                <th>{{selectedProgram.name}} {{'_records'| translate}}</th>
-                            </tr>
-                        </thead>
-                        <tr ng-repeat="tei in teiList">
-                            <td>
-                                <span ng-repeat="gridColumn in gridColumns" ng-if="gridColumn.displayInListNoProgram">
-                                    <span class="bold">{{gridColumn.name}}:</span> {{tei[gridColumn.id]}}<br>
-                                </span>
-                            </td>
-                            <td>
-                                <span class='bold inline-block' ng-if='!dhis2Events[tei.id]'>{{'no_visit_made'| translate}}</span>
-                                <div class="inline-block" ng-repeat="ev in dhis2Events[tei.id] | orderBy: 'eventDate'">                                    
-                                    <span class="block align-center">{{ev.orgUnitName}}</span>                   
-                                    <div class="empty-event-container" 
-                                         title="{{'no_data'| translate}}"
-                                         ng-class="{'{{ev.statusColor}}': true}"
-                                         ng-if='!ev.dataValues'>
-                                        {{ev.name}}<br/>
-                                        {{ev.eventDate}}
-                                    </div>
-                                    <div class="event-container" 
-                                         title="{{'details'| translate}}"
-                                         ng-class="{'{{ev.statusColor}}': true}"
-                                         ng-if='ev.dataValues'
-                                         ng-click="showEventDetails(ev, tei)">
-                                        {{ev.name}}<br/>
-                                        {{ev.eventDate}}
-                                    </div>                                    
-                                    <i class="fa fa-arrow-right" ng-show="$index < dhis2Events[tei.id].length - 1"></i>
-                                </div>                                             
-                            </td>
-                        </tr>
-                    </table>
+                <div class="vertical-spacing">
+                    <tabset>                        
+                        <tab ng-repeat="stage in programStages | orderBy: 'sortOrder'" heading="{{stage.name}}">
+                            <table class="table table-bordered vertical-spacing">
+                                <thead>                        
+                                    <tr>
+                                        <th class="active">
+                                            {{selectedProgram.trackedEntity.name}}
+                                        </th>
+                                        <th class="active">
+                                            {{'event_date' | translate}}
+                                        </th>
+                                        <th class="active">
+                                            {{'event_orgunit_name'| translate}}
+                                        </th>
+                                        <th class="active" ng-if="prStDe.displayInReports" ng-repeat="prStDe in stage.programStageDataElements">
+                                            {{prStDe.dataElement.name}}
+                                        </th>                                        
+                                    </tr>                        
+                                </thead>
+                                <tbody ng-repeat="tei in teiList" ng-if="dhis2Events[tei.id].length > 0">
+                                    <tr ng-repeat="ev in dhis2Events[tei.id] | filter: {programStage: stage.id} | orderBy: 'eventDate'">
+                                        <td rowspan="{{dhis2Events[tei.id].length}}" ng-if="$index === 0">
+                                            <span ng-repeat="gridColumn in gridColumns" ng-if="gridColumn.displayInListNoProgram">
+                                                <span class="bold">{{gridColumn.name}}:</span> {{tei[gridColumn.id]}}<br>
+                                            </span>
+                                        </td>
+                                        <td>
+                                            {{ev.eventDate}}
+                                        </td>
+                                        <td>
+                                            {{ev.orgUnitName}}
+                                        </td>
+                                        <td ng-if="prStDe.displayInReports" ng-repeat="prStDe in stage.programStageDataElements">
+                                            {{ev[prStDe.dataElement.id]}}
+                                        </td>                                                                       
+                                    </tr>
+                                </tbody>
+                                <tbody ng-repeat="tei in teiList" ng-if="!dhis2Events[tei.id]">
+                                    <tr>
+                                        <td>
+                                            <span ng-repeat="gridColumn in gridColumns" ng-if="gridColumn.displayInListNoProgram">
+                                                <span class="bold">{{gridColumn.name}}:</span> {{tei[gridColumn.id]}}<br>
+                                            </span>
+                                        </td>
+                                        <td>
+                                            {{'no_data' | translate}}
+                                        </td>
+                                        <td>
+                                            {{'no_data' | translate}}
+                                        </td>
+                                        <td ng-if="prStDe.displayInReports" ng-repeat="prStDe in stage.programStageDataElements">
+                                            {{'no_data' | translate}}
+                                        </td>                                                                       
+                                    </tr>
+                                </tbody>
+                            </table>
+                        </tab>
+                    </tabset>
                 </div>
                 <!-- report ends -->
+                
             </div>
         </div> 
     </div>

=== 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-03-06 16:34:32 +0000
+++ 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
@@ -9,6 +9,7 @@
                     <select ng-model="selectedProgram"
                             class="form-control"
                             ng-options="program as program.name for program in programs | orderBy: 'name'" 
+                            ng-change="getSelectedProgram(selectedProgram)"
                             ng-disabled="programs.length < 1">
                         <option value="">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists'| translate}}</option>
                     </select>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2015-03-30 15:34:54 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2015-04-15 09:04:32 +0000
@@ -168,7 +168,7 @@
     var def = $.Deferred();
 
     $.ajax({
-        url: '../api/me.json?fields=id,name,userCredentials[userRoles[id]]',
+        url: '../api/me.json?fields=id,name,userCredentials[userRoles[id,authorities]]',
         type: 'GET'
     }).done(function(response) {
         SessionStorageService.set('USER_ROLES', response);

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/search-ou-tree.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/search-ou-tree.html	2015-02-12 10:51:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/search-ou-tree.html	2015-04-15 09:04:32 +0000
@@ -10,11 +10,11 @@
                     <span class="org-unit-tree-button" ng-click="expandCollapse(orgUnit)" ng-show="(!orgUnit.show && orgUnit.children.length > 0) || (!orgUnit.show && orgUnit.hasChildren)"><i class="fa fa-plus-square-o"></i></span>
                     <span class="org-unit-tree-button" ng-click="setSelectedSearchingOrgUnit(orgUnit)" ng-class="{'selected-org-unit' : orgUnit.id === selectedSearchingOrgUnit.id}">{{orgUnit.name}}</span>
                     <ul class="tree" id="tree" ng-show="orgUnit.show">
-                        <li ng-repeat="orgUnit in orgUnit.children | orderBy:'name':reverse" ng-include="'orgUnitTree.html'"></li>
+                        <li ng-repeat="orgUnit in orgUnit.children | orderBy:'name'" ng-include="'orgUnitTree.html'"></li>
                     </ul>
                 </script>
                 <ul class="tree" id="tree">
-                    <li ng-repeat="orgUnit in orgUnits | orderBy:'name':reverse" ng-include="'orgUnitTree.html'"></li>
+                    <li ng-repeat="orgUnit in orgUnits | orderBy:'name'" ng-include="'orgUnitTree.html'"></li>
                 </ul>
             </div>                      
         </accordion-group>