← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18989: tracker-capture: rearranged TEI *journal* report so that data is first grouped based on program s...

 

------------------------------------------------------------
revno: 18989
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-04-23 11:00:46 +0200
message:
  tracker-capture: rearranged TEI *journal* report so that data is first grouped based on program stage and then sorted by event date
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js


--
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/dataentry/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-04-17 13:14:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-04-23 09:00:46 +0000
@@ -153,7 +153,7 @@
                                 <ng-form name="dataEntryInnerForm">
                                     <div ng-switch="prStDes[de.dataElement.id].dataElement.type">
                                         <div ng-switch-when="int">
-                                            <input type="number"
+                                            <input type="text"
                                                    ng-class='getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false)'
                                                    ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]" 
                                                    ng-required={{prStDes[de.dataElement.id].compulsory}}

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html	2015-03-06 09:37:05 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html	2015-04-23 09:00:46 +0000
@@ -59,65 +59,68 @@
             </div>
 
             <h2 class='col-sm-12'>{{'visits'| translate}}</h2>
-            <div class='vertical-spacing' ng-repeat="dhis2Event in selectedReport.enrollments[enrollment.enrollment]| orderBy:'sortingDate':reverse">
-                <div class="col-sm-3">
-                    <span class="bold">{{'name'| translate}}:</span>    {{dhis2Event.name}}                
-                </div>
-                <div class="col-sm-3">
-                    <span class="bold">{{'org_unit'| translate}}:</span> {{dhis2Event.orgUnitName}}                
-                </div>
-                <div class="col-sm-3">
-                    <span class="bold">{{dhis2Event.eventDate ? 'event_date' : 'due_date'| translate}}:</span>    {{dhis2Event.eventDate ? dhis2Event.eventDate : dhis2Event.dueDate}}
-                </div>
-                <div class="col-sm-3">
-                    <span class="bold">{{'status'| translate}}:</span>  {{dhis2Event.status}}
-                </div>
-                <div class='row vertical-spacing'></div>
-                <div class='col-sm-6'>
-                    <table class="table table-bordered table-compact"  ng-if="dhis2Event.visited && dhis2Event.dataValues">
-                        <tr class="col-sm-12">
-                            <th class="col-md-5">
-                                {{'data_element'| translate}}
-                            </th>
-                            <th class="col-sm-5">
-                                {{'value'| translate}}
-                            </th>
-                            <th class="col-sm-2" ng-if="allowProvidedElsewhereExists[dhis2Event.programStage]">
-                                {{'provided_elsewhere'| translate}}
-                            </th>
-                        </tr>
-                        <tr class="col-sm-12" ng-repeat="prStDe in programStages[dhis2Event.programStage].programStageDataElements">
-                            <td>
-                                {{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}
-                            </td>
-                            <td>
-                                {{dhis2Event[prStDe.dataElement.id].value}}          
-                            </td>
-                            <td ng-if="allowProvidedElsewhereExists[dhis2Event.programStage]">
-                                <span ng-if="dhis2Event[prStDe.dataElement.id].providedElsewhere"><i class="fa fa-check"></i></span>
-                            </td>
-                        </tr>
-                    </table>
-                </div>
-                <div class="alert alert-warning visit-details" ng-if="!dhis2Event.visited">{{'visit_not_made'| translate}}</div>
-                <div class="alert alert-warning visit-details" ng-if="dhis2Event.visited && !dhis2Event.dataValues">{{'no_data'| translate}}</div>
-                <div class='row vertical-spacing'></div>
-                <div ng-if="dhis2Event.notes">
-                    <h4 class='col-sm-12'>{{'notes'| translate}}</h4>
-                    <table class="table-borderless table-striped">
-                        <tr class="col-sm-12" ng-repeat="note in dhis2Event.notes">
-                            <td class="col-sm-12">
-                                <p>
-                                    {{note.value}}<br>
-                                    ({{note.storedBy}}, {{note.storedDate}})
-                                </p>                                  
-                            </td>                    
-                        </tr>
-                    </table>
-                </div>
-                <hr class="visit-details" ng-show="$index < report.enrollments[enrollment.enrollment].length - 1">
+            
+            <div ng-repeat="programStage in programStages | orderBy:'sortOrder':reverse">
+                <div class='vertical-spacing' ng-repeat="dhis2Event in selectedReport.enrollments[enrollment.enrollment]| orderBy:'sortingDate':reverse | filter:{programStage: programStage.id}">
+                    <div class="col-sm-3">
+                        <span class="bold">{{'name'| translate}}:</span>    {{dhis2Event.name}}                
+                    </div>
+                    <div class="col-sm-3">
+                        <span class="bold">{{'org_unit'| translate}}:</span> {{dhis2Event.orgUnitName}}                
+                    </div>
+                    <div class="col-sm-3">
+                        <span class="bold">{{dhis2Event.eventDate ? 'event_date' : 'due_date'| translate}}:</span>    {{dhis2Event.eventDate ? dhis2Event.eventDate : dhis2Event.dueDate}}
+                    </div>
+                    <div class="col-sm-3">
+                        <span class="bold">{{'status'| translate}}:</span>  {{dhis2Event.status}}
+                    </div>
+                    <div class='row vertical-spacing'></div>
+                    <div class='col-sm-6'>
+                        <table class="table table-bordered table-compact"  ng-if="dhis2Event.visited && dhis2Event.dataValues">
+                            <tr class="col-sm-12">
+                                <th class="col-md-5">
+                                    {{'data_element'| translate}}
+                                </th>
+                                <th class="col-sm-5">
+                                    {{'value'| translate}}
+                                </th>
+                                <th class="col-sm-2" ng-if="allowProvidedElsewhereExists[dhis2Event.programStage]">
+                                    {{'provided_elsewhere'| translate}}
+                                </th>
+                            </tr>
+                            <tr class="col-sm-12" ng-repeat="prStDe in stagesById[dhis2Event.programStage].programStageDataElements">
+                                <td>
+                                    {{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}
+                                </td>
+                                <td>
+                                    {{dhis2Event[prStDe.dataElement.id].value}}          
+                                </td>
+                                <td ng-if="allowProvidedElsewhereExists[dhis2Event.programStage]">
+                                    <span ng-if="dhis2Event[prStDe.dataElement.id].providedElsewhere"><i class="fa fa-check"></i></span>
+                                </td>
+                            </tr>
+                        </table>
+                    </div>
+                    <div class="alert alert-warning visit-details" ng-if="!dhis2Event.visited">{{'visit_not_made'| translate}}</div>
+                    <div class="alert alert-warning visit-details" ng-if="dhis2Event.visited && !dhis2Event.dataValues">{{'no_data'| translate}}</div>
+                    <div class='row vertical-spacing'></div>
+                    <div ng-if="dhis2Event.notes">
+                        <h4 class='col-sm-12'>{{'notes'| translate}}</h4>
+                        <table class="table-borderless table-striped">
+                            <tr class="col-sm-12" ng-repeat="note in dhis2Event.notes">
+                                <td class="col-sm-12">
+                                    <p>
+                                        {{note.value}}<br>
+                                        ({{note.storedBy}}, {{note.storedDate}})
+                                    </p>                                  
+                                </td>                    
+                            </tr>
+                        </table>
+                    </div>
+                    <hr class="visit-details" ng-show="$index < report.enrollments[enrollment.enrollment].length - 1">
+                </div>
             </div>
-
+            
         </div>
     </div>
 </div>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	2015-04-22 07:22:39 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	2015-04-23 09:00:46 +0000
@@ -50,7 +50,7 @@
             $scope.report[pr.id] = {};
         });
         
-        var eventList = CurrentSelection.getSelectedTeiEvents();        
+        var eventList = angular.copy( CurrentSelection.getSelectedTeiEvents() );        
         if($scope.selectedProgram && $scope.selectedProgram.id){
             eventList = $filter('filter')(eventList, {program: $scope.selectedProgram.id});
         }
@@ -113,18 +113,21 @@
         
         //get program stage for the selected program
         //they are needed to assign data element names for event data values
-        $scope.programStages = [];  
+        $scope.stagesById = [];  
         $scope.allowProvidedElsewhereExists = [];
-        angular.forEach($scope.selectedProgram.programStages, function(st){
-            ProgramStageFactory.get(st.id).then(function(stage){
-                $scope.programStages[stage.id] = stage;
+        
+        ProgramStageFactory.getByProgram($scope.selectedProgram).then(function(stages){
+            $scope.programStages = stages;
+            angular.forEach(stages, function(stage){
                 var providedElsewhereExists = false;
                 for(var i=0; i<stage.programStageDataElements.length && !providedElsewhereExists; i++){                
                     if(stage.programStageDataElements[i].allowProvidedElsewhere){
                         providedElsewhereExists = true;
-                        $scope.allowProvidedElsewhereExists[st.id] = true;
+                        $scope.allowProvidedElsewhereExists[stage.id] = true;
                     }                
                 }
+
+                $scope.stagesById[stage.id] = stage;
             });
         });