← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18503: tracker-capture: show events of program from another orgunit if current ou has the program assign...

 

------------------------------------------------------------
revno: 18503
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-03-06 10:37:05 +0100
message:
  tracker-capture: show events of program from another orgunit if current ou has the program assigned; removed unnecessary label *visit date*  from TEI report use instead either event or due date
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
  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/report/program-details.html
  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/components/report/upcoming-events-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/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-03-04 11:34:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-03-06 09:37:05 +0000
@@ -119,7 +119,6 @@
         });        
     };    
     
-    
     var setWidgetsSize = function(){        
         
         $scope.widgetSize = {smaller: "col-sm-6 col-md-4", bigger: "col-sm-6 col-md-8"};
@@ -173,14 +172,14 @@
                                 });
                                 if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnit.id) &&
                                    program.trackedEntity.id === $scope.selectedTei.trackedEntity){
-                                    $scope.programs.push(program);                                    
-                                }
-
-                                if($scope.selectedProgramId && program.id === $scope.selectedProgramId || selectedEnrollment && selectedEnrollment.program === program.id){
-                                    $scope.selectedProgram = program;
-                                }
+                                    $scope.programs.push(program);
+                                    
+                                    if($scope.selectedProgramId && program.id === $scope.selectedProgramId || selectedEnrollment && selectedEnrollment.program === program.id){
+                                        $scope.selectedProgram = program;
+                                    }
+                                }                                
                             });
-                            
+
                             //prepare selected items for broadcast
                             CurrentSelection.set({tei: $scope.selectedTei, te: $scope.trackedEntity, prs: $scope.programs, pr: $scope.selectedProgram, prNames: $scope.programNames, prStNames: $scope.programStageNames, enrollments: enrollments, selectedEnrollment: selectedEnrollment, optionSets: $scope.optionSets});                            
                             getDashboardLayout();                    

=== 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	2015-03-04 11:34:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-03-06 09:37:05 +0000
@@ -294,50 +294,51 @@
         //input is valid        
         var value = $scope.currentEvent[prStDe.dataElement.id];
         
-        if(!angular.isUndefined(value)){
-            if(prStDe.dataElement.type === 'date'){                    
-                value = DateUtils.formatFromUserToApi(value);
-            }
-            if(prStDe.dataElement.type === 'string'){                    
-                if(prStDe.dataElement.optionSet && $scope.optionSets[prStDe.dataElement.optionSet.id] &&  $scope.optionSets[prStDe.dataElement.optionSet.id].options ) {
-                    value = OptionSetService.getCode($scope.optionSets[prStDe.dataElement.optionSet.id].options, value);
-                }                    
-            }
-
-            if($scope.currentEventOriginal[prStDe.dataElement.id] !== value){
-
-                $scope.updateSuccess = false;
-        
-                $scope.currentElement = {id: prStDe.dataElement.id, saved: false};
-        
-                var ev = {  event: $scope.currentEvent.event,
-                            orgUnit: $scope.currentEvent.orgUnit,
-                            program: $scope.currentEvent.program,
-                            programStage: $scope.currentEvent.programStage,
-                            status: $scope.currentEvent.status,
-                            trackedEntityInstance: $scope.currentEvent.trackedEntityInstance,
-                            dataValues: [
-                                            {
-                                                dataElement: prStDe.dataElement.id, 
-                                                value: value, 
-                                                providedElsewhere: $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] ? true : false
-                                            }
-                                        ]
-                         };
-                DHIS2EventFactory.updateForSingleValue(ev).then(function(response){
-                    var index = -1;
-                    for(var i=0; i<$scope.eventsByStage[$scope.currentEvent.programStage].length && index === -1; i++){
-                        if($scope.eventsByStage[$scope.currentEvent.programStage][i].event === $scope.currentEvent.event){
-                            index = i;
-                        }
-                    }
-                    if(index !== -1){
-                        $scope.eventsByStage[$scope.currentEvent.programStage].splice(index,1,$scope.currentEvent);
-                    }
-                    $scope.currentElement.saved = true;
-                    $scope.currentEventOriginal = angular.copy($scope.currentEvent);
-                });
-            }
+        if($scope.currentEventOriginal[prStDe.dataElement.id] !== value){
+            
+            if(value){
+                if(prStDe.dataElement.type === 'date'){                    
+                    value = DateUtils.formatFromUserToApi(value);
+                }
+                if(prStDe.dataElement.type === 'string'){                    
+                    if(prStDe.dataElement.optionSet && $scope.optionSets[prStDe.dataElement.optionSet.id] &&  $scope.optionSets[prStDe.dataElement.optionSet.id].options ) {
+                        value = OptionSetService.getCode($scope.optionSets[prStDe.dataElement.optionSet.id].options, value);
+                    }                    
+                }
+            }
+
+            $scope.updateSuccess = false;
+
+            $scope.currentElement = {id: prStDe.dataElement.id, saved: false};
+
+            var ev = {  event: $scope.currentEvent.event,
+                        orgUnit: $scope.currentEvent.orgUnit,
+                        program: $scope.currentEvent.program,
+                        programStage: $scope.currentEvent.programStage,
+                        status: $scope.currentEvent.status,
+                        trackedEntityInstance: $scope.currentEvent.trackedEntityInstance,
+                        dataValues: [
+                                        {
+                                            dataElement: prStDe.dataElement.id, 
+                                            value: value, 
+                                            providedElsewhere: $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] ? true : false
+                                        }
+                                    ]
+                     };
+            DHIS2EventFactory.updateForSingleValue(ev).then(function(response){
+                var index = -1;
+                for(var i=0; i<$scope.eventsByStage[$scope.currentEvent.programStage].length && index === -1; i++){
+                    if($scope.eventsByStage[$scope.currentEvent.programStage][i].event === $scope.currentEvent.event){
+                        index = i;
+                    }
+                }
+                if(index !== -1){
+                    $scope.eventsByStage[$scope.currentEvent.programStage].splice(index,1,$scope.currentEvent);
+                }
+                $scope.currentElement.saved = true;
+                $scope.currentEventOriginal = angular.copy($scope.currentEvent);
+            });
+            
         }
     };
     

=== 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-02-18 13:00:15 +0000
+++ 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
@@ -60,19 +60,16 @@
 
             <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-2">
+                <div class="col-sm-3">
                     <span class="bold">{{'name'| translate}}:</span>    {{dhis2Event.name}}                
                 </div>
-                <div class="col-sm-2">
+                <div class="col-sm-3">
                     <span class="bold">{{'org_unit'| translate}}:</span> {{dhis2Event.orgUnitName}}                
                 </div>
-                <div class="col-sm-2">
-                    <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}}
-                </div>
-                <div class="col-sm-2">
+                <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>

=== 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-02-18 13:00:15 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary.html	2015-03-06 09:37:05 +0000
@@ -55,25 +55,25 @@
                             </td>
                             <td>
                                 <span class='bold inline-block' ng-if='!dhis2Events[tei.id]'>{{'no_visit_made'| translate}}</span>
-                                <span class="inline-block" ng-repeat="ev in dhis2Events[tei.id] | orderBy: 'eventDate'">                                    
+                                <div class="inline-block" ng-repeat="ev in dhis2Events[tei.id] | orderBy: 'eventDate'">                                    
                                     <span class="block align-center">{{ev.orgUnitName}}</span>                   
-                                    <span class="empty-event-container" 
+                                    <div class="empty-event-container" 
                                          title="{{'no_data'| translate}}"
                                          ng-class="{'{{ev.statusColor}}': true}"
                                          ng-if='!ev.dataValues'>
                                         {{ev.name}}<br/>
                                         {{ev.eventDate}}
-                                    </span>
-                                    <span class="event-container" 
+                                    </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}}
-                                    </span>                                    
+                                    </div>                                    
                                     <i class="fa fa-arrow-right" ng-show="$index < dhis2Events[tei.id].length - 1"></i>
-                                </span>                                             
+                                </div>                                             
                             </td>
                         </tr>
                     </table>

=== 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-02-18 13:00:15 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	2015-03-06 09:37:05 +0000
@@ -50,13 +50,13 @@
         
         DHIS2EventFactory.getEventsByProgram($scope.selectedTei.trackedEntityInstance, $scope.selectedOrgUnit.id, programId).then(function(eventList){
             angular.forEach(eventList, function(ev){
-                if(ev.program){       
+                if(ev.program && $scope.report[ev.program] && ev.orgUnit){       
                     ev.visited = true;
                     ev.dueDate = DateUtils.formatFromApiToUser(ev.dueDate);  
                     ev.sortingDate = ev.dueDate;
                     ev.name = $scope.programStageNames[ev.programStage].name;
-                    ev.programName = $scope.programNames[ev.program].name;
-                    if(angular.isUndefined($scope.report[ev.program].enrollments)){
+                    ev.programName = $scope.programNames[ev.program].name;                    
+                    if(!$scope.report[ev.program].enrollments){
                         $scope.report[ev.program] = {enrollments: {}};
                     }
                     ev.statusColor = EventUtils.getEventStatusColor(ev); 
@@ -76,13 +76,12 @@
                         else{
                             $scope.report[ev.program].enrollments[ev.enrollment]= [ev];
                         }
+                    }                    
+                    if(!$scope.dataExists){
+                        $scope.dataExists = true;
                     }
                 }                
             });
-
-            if(eventList){
-                $scope.dataExists = true;
-            }
             $scope.dataFetched = true;
         });
     };

=== 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	2015-02-18 13:00:15 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js	2015-03-06 09:37:05 +0000
@@ -109,12 +109,11 @@
                 upcomingEvent.dueDate = DateUtils.formatFromApiToUser(row.dueDate);
                 upcomingEvent.event = row.event;
                 upcomingEvent.eventName = $scope.programStages[row.programStage].name;
-                upcomingEvent.orgUnitName = row.orgUnitName;
+                upcomingEvent.eventOrgUnitName = row.eventOrgUnitName;
                 upcomingEvent.followup = row.followup;
                 upcomingEvent.program = row.program;
                 upcomingEvent.programStage = row.programStage;
-                upcomingEvent.trackedEntityInstance = row.trackedEntityInstance;
-                upcomingEvent.orgUnitName = row.registrationOrgUnit;
+                upcomingEvent.trackedEntityInstance = row.trackedEntityInstance;                
                 upcomingEvent.created = DateUtils.formatFromApiToUser(row.registrationDate);;
                 $scope.upcomingEvents.push(upcomingEvent);
 
@@ -145,7 +144,7 @@
             AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){            
                 $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode);
                 
-                $scope.gridColumns.push({name: $translate('event_orgunit_name'), id: 'orgUnitName', type: 'string', displayInListNoProgram: false, showFilter: false, show: true});
+                $scope.gridColumns.push({name: $translate('event_orgunit_name'), id: 'eventOrgUnitName', type: 'string', displayInListNoProgram: false, showFilter: false, show: true});
                 $scope.filterTypes['orgUnitName'] = 'string';
                 $scope.gridColumns.push({name: $translate('event_name'), id: 'eventName', type: 'string', displayInListNoProgram: false, showFilter: false, show: true});
                 $scope.filterTypes['eventName'] = 'string';