← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18173: minor

 

------------------------------------------------------------
revno: 18173
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-02-04 15:39:40 +0100
message:
  minor
modified:
  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
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.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/report/program-details.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html	2014-10-01 15:19:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html	2015-02-04 14:39:40 +0000
@@ -15,7 +15,18 @@
                             {{attribute.displayName}}
                         </td>
                         <td>
-                            {{attribute.value}}
+                            <span ng-switch="attribute.type">
+                                <span ng-switch-when="bool">
+                                    <span ng-if="attribute.value === 'true'">{{'yes' | translate}}</span>
+                                    <span ng-if="attribute.value === 'false'">{{ 'no' | translate}}</span>
+                                </span>
+                                <span ng-switch-when="trueOnly">
+                                    <span ng-if="attribute.value">
+                                        <i class="fa fa-check"></i>
+                                    </span>
+                                </span>
+                                <span ng-switch-default>{{attribute.value}}</span>
+                            </span>
                         </td>                
                     </tr>
                 </table>
@@ -91,8 +102,8 @@
                         </tr>
                     </table>
                 </div>
-                <div class="alert alert-warning visit-details col-sm-6" ng-if="!dhis2Event.visited">{{'visit_not_made'| translate}}</div>
-                <div class="alert alert-warning visit-details col-sm-6" ng-if="dhis2Event.visited && !dhis2Event.dataValues">{{'no_data'| translate}}</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>

=== 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-01-05 10:20:46 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	2015-02-04 14:39:40 +0000
@@ -14,6 +14,7 @@
     $scope.programs = [];  
     $scope.programNames = [];  
     $scope.programStageNames = [];
+    $scope.enrollmentsByProgram = [];
     ProgramFactory.getAll().then(function(programs){     
         $scope.programs = programs;
         angular.forEach($scope.programs, function(pr){
@@ -27,17 +28,20 @@
         
     $scope.$on('dashboardWidgets', function(event, args) {
         $scope.showProgramReportDetailsDiv = false;
-        var selections = CurrentSelection.get();
+        var selections = CurrentSelection.get();        
         $scope.selectedOrgUnit = storage.get('SELECTED_OU');
         $scope.selectedTei = selections.tei;  
         $scope.selectedEntity = selections.te;
-        $scope.selectedProgram = selections.pr;        
-        $scope.selectedEnrollment = selections.selectedEnrollment;
+        $scope.selectedProgram = selections.pr;
         $scope.optionSets = selections.optionSets;
     
         if($scope.selectedTei && $scope.selectedOrgUnit){            
             $scope.getEvents();
-        }       
+        }
+        
+        angular.forEach(selections.enrollments, function(en){            
+            $scope.enrollmentsByProgram[en.program] = en;
+        });
     });
     
     $scope.getEvents = function(){
@@ -97,6 +101,9 @@
     
     $scope.showProgramReportDetails = function(pr){
         
+        var selections = CurrentSelection.get();
+        $scope.selectedTei = selections.tei;
+        
         $scope.showProgramReportDetailsDiv = !$scope.showProgramReportDetailsDiv;
         $scope.selectedProgram = pr;
         $scope.selectedReport = $scope.report[pr.id];
@@ -106,8 +113,8 @@
 
         //process tei attributes, this is to have consistent display so that the tei 
         //contains program attributes whether it has value or not
-        TEIService.processAttributes($scope.selectedTei, $scope.selectedProgram, null).then(function(tei){
-            $scope.tei = tei;  
+        TEIService.processAttributes($scope.selectedTei, $scope.selectedProgram, $scope.enrollmentsByProgram[pr.id]).then(function(tei){
+            $scope.tei = tei;
         });
         
         //get program stage for the selected program

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-02-04 12:53:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-02-04 14:39:40 +0000
@@ -742,12 +742,7 @@
             
             //first reset teiAttributes
             for(var j=0; j<teiAttributes.length; j++){
-                teiAttributes[j].show = false;                
-                if(teiAttributes[j].value){                    
-                    if(teiAttributes[j].type === 'number' && !isNaN(parseInt(teiAttributes[j].value))){
-                        teiAttributes[j].value = parseInt(teiAttributes[j].value);                        
-                    }                    
-                }               
+                teiAttributes[j].show = false;
             }
 
             //identify which ones to show
@@ -760,6 +755,7 @@
                         teiAttributes[j].order = i;
                         teiAttributes[j].mandatory = requiredAttributes[i].mandatory ? requiredAttributes[i].mandatory : false;
                         teiAttributes[j].allowFutureDate = requiredAttributes[i].allowFutureDate ? requiredAttributes[i].allowFutureDate : false;
+                        teiAttributes[j].displayName = requiredAttributes[i].name;
                     }
                 }