← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16599: tracker capture - reports WIP

 

------------------------------------------------------------
revno: 16599
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-09-01 15:04:19 +0200
message:
  tracker capture - reports WIP
added:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/rescheduling.html
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.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/styles/style.css
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/report-types.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
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/rescheduling.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/rescheduling.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/rescheduling.html	2014-09-01 13:04:19 +0000
@@ -0,0 +1,75 @@
+<div class="modal-header">
+    <h2>{{'schedule_details'| translate}}</h2>
+</div>
+<div class="modal-body">
+    <div class='row' ng-if="reportMode === 'PROGRAM'">
+        <span class="bold">
+            {{entityName}}
+        </span>
+        <table class="table-borderless table-striped">
+            <tr class="col-md-12" ng-repeat="attribute in attributes">
+                <td class="col-md-6">
+                    {{attribute.name}}
+                </td>
+                <td class="col-md-6">
+                    <input type="text" ng-model="selectedTei[attribute.id]" ng-disabled='true'/>                       
+                </td>                
+            </tr>
+        </table>
+    </div>
+    <div class='row' ng-if='currentEvent'>      
+        <hr ng-if="reportMode === 'PROGRAM'">
+        <span class="bold">
+            <span ng-if="reportMode === 'TEI'">{{currentEvent.programName}}  |  </span>{{currentEvent.name}}  |  {{currentEvent.orgUnitName}}  |  {{currentEvent.eventDate}}
+        </span>
+        <table class="table-borderless table-striped">
+            <thead>
+                <tr class="col-md-12">
+                    <th class="col-md-5">
+                        {{'data_element'| translate}}
+                    </th>
+                    <th class="col-md-5">
+                        {{'value'| translate}}
+                    </th>
+                    <th class="col-md-2" ng-if="allowProvidedElsewhereExists">
+                        {{'provided_elsewhere'| translate}}
+                    </th>
+                </tr>
+            </thead>
+            <tr class="col-md-12" ng-repeat="prStDe in currentStage.programStageDataElements">
+                <td class="col-md-5">
+                    {{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}
+                </td>
+                <td class="col-md-5">
+                    <input type="text" class="form-control" ng-model="currentEvent[prStDe.dataElement.id]" ng-disabled='true'/>                       
+                </td>
+                <td class="col-md-2" ng-if="allowProvidedElsewhereExists">                    
+                    <div class="align-center" ng-show="prStDe.allowProvidedElsewhere">
+                        <input type="checkbox" class="form-control" ng-model="currentEvent.providedElsewhere[prStDe.dataElement.id]" ng-disabled='true'/>
+                    </div>
+                </td>
+            </tr>
+        </table>
+    </div>
+    <div class="row" ng-if='currentEvent.notes'>
+        <hr>
+        <table class="table-borderless table-striped">  
+            <tr>
+                <th>
+                    {{'notes' | translate}}
+                </th>
+            </tr>
+            <tr class="col-md-12" ng-repeat="note in currentEvent.notes">
+                <td class="col-md-12 over-flow-hidden" style="width:100%;">
+                    <p>{{note.value}}</p>
+                    <p><strong>{{'created_by' | translate}}: </strong>{{note.storedBy}}</p>
+                    <p><strong>{{'date' | translate}}: </strong>{{note.storedDate}}</p>                    
+                </td>                    
+            </tr>
+        </table>
+    </div>
+</div>
+<div class="modal-footer">
+    <button class="btn btn-primary" data-ng-click="close()">{{'save'| translate}}</button>
+    <button class="btn btn-default" data-ng-click="close()">{{'close'| translate}}</button>
+</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js	2014-08-29 14:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js	2014-09-01 13:04:19 +0000
@@ -69,7 +69,7 @@
         });
             
         AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){            
-            $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);   
+            $scope.attributes = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);   
         });  
         
         //fetch TEIs for the selected program and orgunit/mode
@@ -124,26 +124,23 @@
         });
     };
     
-    $scope.showEventDetails = function(dhis2Event, selectedTei){
+    $scope.showReschedule = function(dhis2Event, selectedTei){
         
         var modalInstance = $modal.open({
-            templateUrl: 'components/report/event-details.html',
-            controller: 'EventDetailsController',
+            templateUrl: 'components/report/rescheduling.html',
+            controller: 'ReschedulingController',
             resolve: {
                 dhis2Event: function () {
                     return dhis2Event;
                 },
-                gridColumns: function(){
-                    return $scope.gridColumns;
+                attributes: function(){
+                    return $scope.attributes;
                 },
                 selectedTei: function(){
                     return selectedTei;
                 },
                 entityName: function(){
                     return $scope.selectedProgram.trackedEntity.name;
-                },
-                reportMode: function(){
-                    return 'PROGRAM';
                 }
             }
         });
@@ -154,54 +151,64 @@
 })
 
 //Controller for event details
-.controller('EventDetailsController', 
+.controller('ReschedulingController', 
     function($scope, 
-            $modalInstance,
-            orderByFilter,
-            ProgramStageFactory,
+            $modalInstance,            
+            DHIS2EventFactory,
             dhis2Event,
             selectedTei,
-            gridColumns,
-            entityName,
-            reportMode){
+            attributes,
+            entityName){
     
     $scope.selectedTei = selectedTei;
-    $scope.gridColumns = gridColumns;
-    $scope.entityName = entityName;
-    $scope.reportMode = reportMode;
+    $scope.attributes = attributes;
+    $scope.entityName = entityName;    
     $scope.currentEvent = dhis2Event;
-    $scope.currentEvent.providedElsewhere = [];
-    
-    if(!angular.isUndefined( $scope.currentEvent.notes)){
-        $scope.currentEvent.notes = orderByFilter($scope.currentEvent.notes, '-storedDate');            
-        angular.forEach($scope.currentEvent.notes, function(note){
-            note.storedDate = moment(note.storedDate).format('YYYY-MM-DD @ hh:mm A');
-        });
-    }
-    
-    ProgramStageFactory.get($scope.currentEvent.programStage).then(function(stage){
-        $scope.currentStage = stage;
-
-        $scope.allowProvidedElsewhereExists = false;
-        angular.forEach($scope.currentStage.programStageDataElements, function(prStDe){
-            $scope.currentStage.programStageDataElements[prStDe.dataElement.id] = prStDe.dataElement;
-            if(prStDe.allowProvidedElsewhere){
-                $scope.allowProvidedElsewhereExists = true;
-                $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] = '';   
-            }                
-        });
-        angular.forEach($scope.currentEvent.dataValues, function(dataValue){
-            var val = dataValue.value;
-            if(val){
-                var de = $scope.currentStage.programStageDataElements[dataValue.dataElement];
-                if( de && de.type === 'int' && val){
-                    val = parseInt(val);
-                    dataValue.value = val;
-                }
-                $scope.currentEvent[dataValue.dataElement] = val;
-            }                    
-        });
-    });
+    
+    
+    $scope.save = function(){
+        
+        
+        if($scope.currentEvent.dueDate == ''){
+            $scope.invalidDate = true;
+            return false;
+        }
+        else{
+            var rawDate = $filter('date')($scope.currentEvent.dueDate, 'yyyy-MM-dd'); 
+            var convertedDate = moment($scope.currentEvent.dueDate, 'YYYY-MM-DD')._d;
+            convertedDate = $filter('date')(convertedDate, 'yyyy-MM-dd'); 
+
+            if(rawDate !== convertedDate){
+                $scope.invalidDate = true;
+                return false;
+            } 
+
+            var e = {event: $scope.currentEvent.event,
+                 enrollment: $scope.currentEvent.enrollment,
+                 dueDate: $scope.currentEvent.dueDate,
+                 status: $scope.currentEvent.status,
+                 program: $scope.currentEvent.program,
+                 programStage: $scope.currentEvent.programStage,
+                 orgUnit: $scope.currentEvent.orgUnit,
+                 trackedEntityInstance: $scope.currentEvent.trackedEntityInstance
+                };
+
+            DHIS2EventFactory.update(e).then(function(data){            
+                $scope.invalidDate = false;
+                $scope.dueDateSaved = true;
+                $scope.currentEvent.sortingDate = $scope.currentEvent.dueDate;                
+                var statusColor = EventUtils.getEventStatusColor($scope.currentEvent);  
+                var continueLoop = true;
+                for(var i=0; i< $scope.dhis2Events.length && continueLoop; i++){
+                    if($scope.dhis2Events[i].event === $scope.currentEvent.event ){
+                        $scope.dhis2Events[i].statusColor = statusColor;
+                        continueLoop = false;
+                    }
+                } 
+            });
+        }
+        
+    };
     
     $scope.close = function () {
         $modalInstance.close();

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html	2014-08-29 14:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html	2014-09-01 13:04:19 +0000
@@ -49,8 +49,8 @@
                         </thead>
                         <tr ng-repeat="tei in teiList">
                             <td>
-                                <span ng-repeat="gridColumn in gridColumns">
-                                    <span class="bold">{{gridColumn.name}}:</span> {{tei[gridColumn.id]}}<br>
+                                <span ng-repeat="attribute in attributes">
+                                    <span class="bold">{{attribute.name}}:</span> {{tei[attribute.id]}}<br>
                                 </span>
                             </td>
                             <td>
@@ -58,9 +58,9 @@
                                 <span class="inline-block" ng-repeat="ev in dhis2Events[tei.id] | orderBy: 'dueDate'">                                    
                                     <span class="block align-center">{{ev.orgUnitName}}</span>                   
                                     <span class="stage-container" 
-                                         title="{{'details'| translate}}"
+                                         title="{{'reschedule'| translate}}"
                                          ng-class="{'{{ev.statusColor}}': true}"
-                                         ng-click="showEventDetails(ev, tei)">
+                                         ng-click="showReschedule(ev, tei)">
                                         {{ev.name}}<br/>
                                         {{ev.dueDate}}<br>  
                                     </span>                                    

=== 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-29 14:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-09-01 13:04:19 +0000
@@ -119,6 +119,8 @@
     "program_summary_report": "Program Summary Report",
     "program_summary": "Program Summary",
     "program_summary_description": "Generate a summary report for a particular program, organisation unit and time frame. The report presents a list of tracked entity instances and the services they got from the selected program.",
+    "program_statistics": "Program Statistics",
+    "program_statistics_description": "Generate a statistics report for a particular program. The report provides for example an overview of dropouts or completions in a given time fram at a particular organisatoin unit.",
     "upcoming_events": "Upcoming Events",
     "upcoming_events_description": "Generate a report that lists tracked entity instances and their upcoming events that require attention. The events displayed are those that are scheduled in due time.",
     "overdue_events": "Overdue Events",
@@ -163,6 +165,7 @@
     "scheduling": "Scheduling",
     "reschedule": "Reschedule",
     "rescheduling": "Rescheduling",
+    "schedule_details": "Schedule details",
     "enroll": "Enroll",
     "new_enrollment": "New enrollment",
     "start_date": "Start date",

=== 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-29 12:39:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-09-01 13:04:19 +0000
@@ -765,8 +765,7 @@
     margin-top: 15px;
 }
 
-.report-type-container{
-    
+.report-type-container{    
     padding: 10px;
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/report-types.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/report-types.html	2014-08-29 12:39:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/report-types.html	2014-09-01 13:04:19 +0000
@@ -8,17 +8,21 @@
 </div>
 <div id="mainPage">
     <h1>{{'tracker_reports'| translate}}</h1>
-    <div class="row col-md-10">        
-        <div class="col-md-6 report-type-container" ng-click="programSummary()">
-            <h2><small><i class="fa fa-list-alt fa-3x black"></i></small><span class="horizonal-spacing">{{'program_summary'| translate}}</span></h2>
+    <div class="row col-sm-10">        
+        <div class="col-sm-6 report-type-container" ng-click="programSummary()">
+            <h2><small><i class="fa fa-list-alt fa-2x black"></i></small><span class="horizonal-spacing">{{'program_summary'| translate}}</span></h2>
             {{'program_summary_description'| translate}}
         </div>
-        <div class="col-md-6 report-type-container" ng-click="upcomingEvents()">
-            <h2><small><i class="fa fa-clock-o fa-3x black"></i></small><span class="horizonal-spacing">{{'upcoming_events'| translate}}</span></h2>
+        <div class="col-sm-6 report-type-container" ng-click="programStatistics()">
+            <h2><small><i class="fa fa-bar-chart fa-2x black"></i></small><span class="horizonal-spacing">{{'program_statistics'| translate}}</span></h2>
+            {{'program_statistics_description'| translate}}
+        </div>
+        <div class="col-sm-6 report-type-container" ng-click="upcomingEvents()">
+            <h2><small><i class="fa fa-clock-o fa-2x black"></i></small><span class="horizonal-spacing">{{'upcoming_events'| translate}}</span></h2>
             {{'upcoming_events_description'| translate}}
         </div>
-        <div class="col-md-6 report-type-container" ng-click="overdueEvents()">
-            <h2><small><i class="fa fa-bell-o fa-3x black"></i></small><span class="horizonal-spacing">{{'overdue_events'| translate}}</span></h2>
+        <div class="col-sm-6 report-type-container" ng-click="overdueEvents()">
+            <h2><small><i class="fa fa-bell-o fa-2x black"></i></small><span class="horizonal-spacing">{{'overdue_events'| translate}}</span></h2>
             {{'overdue_events_description'| translate}}
         </div>
     </div>