← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16916: tracker capture - fix for saving and rendering providedElsewhere

 

------------------------------------------------------------
revno: 16916
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-10-01 17:19:59 +0200
message:
  tracker capture - fix for saving and rendering providedElsewhere
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
  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/event-details.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/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/tei-report-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json


--
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/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2014-10-01 11:13:12 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2014-10-01 15:19:59 +0000
@@ -293,8 +293,8 @@
                 $scope.currentStage.programStageDataElements[prStDe.dataElement.id] = prStDe.dataElement;
                 if(prStDe.allowProvidedElsewhere){
                     $scope.allowProvidedElsewhereExists = true;
-                    $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] = '';   
-                }                
+                    $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] = false;
+                }
             });
 
             angular.forEach($scope.currentEvent.dataValues, function(dataValue){
@@ -306,6 +306,10 @@
                         dataValue.value = val;
                     }
                     $scope.currentEvent[dataValue.dataElement] = val;
+                    
+                    if(dataValue.providedElsewhere){
+                        $scope.currentEvent.providedElsewhere[dataValue.dataElement] = dataValue.providedElsewhere;
+                    }
                 }                    
             });
 
@@ -346,7 +350,7 @@
                                             {
                                                 dataElement: prStDe.dataElement.id, 
                                                 value: value, 
-                                                providedElseWhere: $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] ? $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] : false
+                                                providedElsewhere: $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] ? true : false
                                             }
                                         ]
                          };
@@ -359,6 +363,7 @@
     
     $scope.saveDatavalueLocation = function(prStDe){
         
+        console.log('I am called:  ',$scope.currentEvent.providedElsewhere[prStDe.dataElement.id] );
         $scope.updateSuccess = false;
         
         if(!angular.isUndefined($scope.currentEvent.providedElsewhere[prStDe.dataElement.id])){
@@ -375,7 +380,7 @@
                                         {
                                             dataElement: prStDe.dataElement.id, 
                                             value: value, 
-                                            providedElseWhere: $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] ? $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] : false
+                                            providedElsewhere: $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] ? true : false
                                         }
                                     ]
                      };

=== 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	2014-10-01 09:56:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2014-10-01 15:19:59 +0000
@@ -83,12 +83,11 @@
                     </div>
                 </ng-form>                            
             </td>
-            <td class="col-md-2" ng-if="allowProvidedElsewhereExists">                    
+            <td class="col-md-2" ng-if="allowProvidedElsewhereExists">                
                 <div class="align-center" ng-show="prStDe.allowProvidedElsewhere">
                     <input type="checkbox" 
                            ng-model="currentEvent.providedElsewhere[prStDe.dataElement.id]"
-                           ng-change="saveDatavalueLocation(prStDe)"/>
-                </div>
+                           ng-change="saveDatavalueLocation(prStDe)"/>                </div>
             </td>
         </tr>
     </table>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/event-details.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/event-details.html	2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/event-details.html	2014-10-01 15:19:59 +0000
@@ -6,13 +6,13 @@
         <span class="bold">
             {{entityName}}
         </span>
-        <table class="table-borderless table-striped">
+        <table class="table table-bordered table-compact">
             <tr class="col-md-12" ng-repeat="gridColumn in gridColumns">
                 <td class="col-md-6">
                     {{gridColumn.name}}
                 </td>
                 <td class="col-md-6">
-                    <input type="text" ng-model="selectedTei[gridColumn.id]" ng-disabled='true'/>                       
+                    {{selectedTei[gridColumn.id]}}                      
                 </td>                
             </tr>
         </table>
@@ -20,9 +20,9 @@
     <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 ng-if="reportMode === 'TEI'">{{currentEvent.programName}}    |    </span>{{currentEvent.name}}    |    {{currentEvent.eventOrgUnitName}}  |  {{currentEvent.eventDate}}
         </span>
-        <table class="table-borderless table-striped">
+        <table class="table table-bordered table-compact">
             <thead>
                 <tr class="col-md-12">
                     <th class="col-md-5">
@@ -41,11 +41,11 @@
                     {{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}
                 </td>
                 <td class="col-md-5">
-                    <input type="text" ng-model="currentEvent[prStDe.dataElement.id]" ng-disabled='true'/>                       
+                    {{currentEvent[prStDe.dataElement.id].value}}
                 </td>
                 <td class="col-md-2" ng-if="allowProvidedElsewhereExists">                    
                     <div class="align-center" ng-show="prStDe.allowProvidedElsewhere">
-                        <input type="checkbox" ng-model="currentEvent.providedElsewhere[prStDe.dataElement.id]" ng-disabled='true'/>
+                        <span ng-if="currentEvent[prStDe.dataElement.id].providedElsewhere"><i class="fa fa-check"></i></span>
                     </div>
                 </td>
             </tr>

=== 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-08-27 15:40:36 +0000
+++ 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
@@ -15,7 +15,7 @@
                             {{attribute.displayName}}
                         </td>
                         <td>
-                            {{attribute.value}}<!--<input type="text" class="form-control" ng-model="attribute.value" ng-disabled='true'/>                       -->
+                            {{attribute.value}}
                         </td>                
                     </tr>
                 </table>
@@ -30,7 +30,7 @@
                 <span class="bold">{{selectedProgram.dateOfIncidentDescription}}:</span>    {{enrollment.dateOfIncident}}            
             </div>
             <div class="col-sm-4">
-                <span class="bold">{{'status'| translate}}:</span>  {{enrollment.status}}           
+                <span class="bold">{{'status'| translate}}:</span>  {{enrollment.status}}
             </div>
             <div class='row vertical-spacing'></div>
             <div ng-if="enrollment.notes">
@@ -48,16 +48,15 @@
             </div>
 
             <h2 class='col-sm-12'>{{'visits'| translate}}</h2>
-            <div class='vertical-spacing' ng-repeat="dhis2Event in report.enrollments[enrollment.enrollment]| orderBy:'sortingDate':reverse">
-                <!--<h3 class='col-sm-12'>{{'visits'| translate}}</h3>-->
+            <div class='vertical-spacing' ng-repeat="dhis2Event in selectedReport.enrollments[enrollment.enrollment]| orderBy:'sortingDate':reverse">
                 <div class="col-sm-2">
                     <span class="bold">{{'name'| translate}}:</span>    {{dhis2Event.name}}                
                 </div>
                 <div class="col-sm-2">
-                    <span class="bold">{{'org_unit'| translate}}:</span> {{dhis2Event.orgUnitName}}                
+                    <span class="bold">{{'org_unit'| translate}}:</span> {{dhis2Event.eventOrgUnitName}}                
                 </div>
                 <div class="col-sm-2">
-                    <span class="bold">{{'due_date'| translate}}:</span>    {{dhis2Event.dueDate}}
+                    <span class="bold">{{dhis2Event.eventDate ? 'event_date' : 'due_date'| translate}}:</span>    {{dhis2Event.dueDate}}
                 </div>
                 <div class="col-sm-2">
                     <span class="bold">{{'visit'| translate}} {{'_date'| translate}}:</span>    {{dhis2Event.eventDate ? dhis2Event.eventDate : 'no_visit_made'| translate}}
@@ -87,13 +86,13 @@
                                 {{dhis2Event[prStDe.dataElement.id].value}}          
                             </td>
                             <td ng-if="allowProvidedElsewhereExists[dhis2Event.programStage]">
-                                {{dhis2Event[prStDe.dataElement.id].providedElsewhere ? 'provided_elsewhere' : ''| translate}}
+                                <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 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.dataValues">{{'no_data'| translate}}</div>
+                <div class="alert alert-warning visit-details col-sm-6" 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/program-summary-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js	2014-09-18 14:53:56 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js	2014-10-01 15:19:59 +0000
@@ -185,15 +185,9 @@
             }                
         });
         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;
-            }                    
+            if(dataValue.dataElement){
+                $scope.currentEvent[dataValue.dataElement] = dataValue;
+            }            
         });
     });
     

=== 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	2014-08-29 14:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary.html	2014-10-01 15:19:59 +0000
@@ -62,8 +62,7 @@
                                          ng-class="{'{{ev.statusColor}}': true}"
                                          ng-if='!ev.dataValues'>
                                         {{ev.name}}<br/>
-                                        {{ev.eventDate}}<br>
-                                        {{'no_data'| translate}}
+                                        {{ev.eventDate}}
                                     </span>
                                     <span class="stage-container" 
                                          title="{{'details'| translate}}"
@@ -71,8 +70,7 @@
                                          ng-if='ev.dataValues'
                                          ng-click="showEventDetails(ev, tei)">
                                         {{ev.name}}<br/>
-                                        {{ev.eventDate}}<br>  
-                                        <!--{{'data_exists'| translate}}-->
+                                        {{ev.eventDate}}
                                     </span>                                    
                                     <i class="fa fa-arrow-right" ng-show="$index < dhis2Events[tei.id].length - 1"></i>
                                 </span>                                             

=== 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	2014-09-18 14:53:56 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	2014-10-01 15:19:59 +0000
@@ -113,7 +113,7 @@
         });
         
         //get program stage for the selected program
-        //they are needed assign data element names for event data values
+        //they are needed to assign data element names for event data values
         $scope.programStages = [];  
         $scope.allowProvidedElsewhereExists = [];
         angular.forEach($scope.selectedProgram.programStages, function(st){
@@ -134,6 +134,7 @@
         angular.forEach(Object.keys($scope.selectedReport.enrollments), function(enr){        
             //format report data values
             angular.forEach($scope.selectedReport.enrollments[enr], function(ev){
+
                 angular.forEach(ev.notes, function(note){
                     note.storedDate = DateUtils.formatToHrsMins(note.storedDate);
                 }); 

=== 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-10-01 11:13:12 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-10-01 15:19:59 +0000
@@ -174,6 +174,7 @@
     "list_programs": "List programs",
     "program_stage": "Program stage",
     "due_date": "Due date",
+    "event_date": "Event date",
     "enable_rescheduling": "Enable rescheduling",
     "disable_rescheduling": "Disable rescheduling",
     "show_hide_scheduling": "Show/hide scheduling form",