← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18310: tracker-capture: some refactoring

 

------------------------------------------------------------
revno: 18310
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-02-18 14:00:15 +0100
message:
  tracker-capture: some refactoring
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/dataentry/dataentry.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.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/overdue-events-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-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/components/report/upcoming-events-controller.js
  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/styles/style.css


--
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-02-16 14:00:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-02-18 13:00:15 +0000
@@ -86,6 +86,8 @@
             angular.forEach(orderByFilter($filter('filter')($scope.dashboardWidgets, {parent: "smallerWidget"}), 'order'), function(w){
                 $scope.dashboardWidgetsOrder.smallerWidgets.push(w.title);
             });
+            
+            $scope.broadCastSelections();
         });        
     };
     
@@ -137,11 +139,9 @@
                                 }
                             });
                             
-                            getDashboardLayout();                            
-
-                            //broadcast selected items for dashboard controllers
-                            CurrentSelection.set({tei: $scope.selectedTei, te: $scope.trackedEntity, prs: $scope.programs, pr: $scope.selectedProgram, prNames: $scope.programNames, prStNames: $scope.programStageNames, enrollments: response.enrollments, selectedEnrollment: selectedEnrollment, optionSets: $scope.optionSets});
-                            $scope.broadCastSelections();                        
+                            //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: response.enrollments, selectedEnrollment: selectedEnrollment, optionSets: $scope.optionSets});                            
+                            getDashboardLayout();                    
                         });
                     });
                 });            
@@ -189,7 +189,6 @@
     
     $scope.applySelectedProgram = function(){
         getDashboardLayout();
-        $scope.broadCastSelections(); 
     };
     
     $scope.broadCastSelections = function(){
@@ -199,10 +198,10 @@
         $scope.trackedEntity = selections.te;
         $scope.optionSets = selections.optionSets;
         
-        CurrentSelection.set({tei: $scope.selectedTei, te: $scope.trackedEntity, prs: $scope.programs, pr: $scope.selectedProgram, prNames: $scope.programNames, prStNames: $scope.programStageNames, enrollments: selections.enrollments, selectedEnrollment: null, optionSets: $scope.optionSets});
+        CurrentSelection.set({tei: $scope.selectedTei, te: $scope.trackedEntity, prs: $scope.programs, pr: $scope.selectedProgram, prNames: $scope.programNames, prStNames: $scope.programStageNames, enrollments: selections.enrollments, selectedEnrollment: null, optionSets: $scope.optionSets});        
         $timeout(function() { 
             $rootScope.$broadcast('selectedItems', {programExists: $scope.programs.length > 0});            
-        }, 100); 
+        }, 100);
     };     
     
     $scope.back = function(){

=== 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-02-13 11:45:18 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-02-18 13:00:15 +0000
@@ -51,6 +51,7 @@
         $scope.allowEventCreation = false;
         $scope.repeatableStages = [];        
         $scope.dhis2Events = [];
+        $scope.programStages = [];
         
         var selections = CurrentSelection.get();          
         $scope.selectedOrgUnit = storage.get('SELECTED_OU');
@@ -62,7 +63,8 @@
         $scope.selectedProgramWithStage = [];        
         if($scope.selectedOrgUnit && $scope.selectedProgram && $scope.selectedEntity && $scope.selectedEnrollment){
 
-            ProgramStageFactory.getByProgram($scope.selectedProgram).then(function(stages){                
+            ProgramStageFactory.getByProgram($scope.selectedProgram).then(function(stages){
+                $scope.programStages = stages;
                 angular.forEach(stages, function(stage){
                     if(stage.openAfterEnrollment){
                         $scope.currentStage = stage;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2015-02-12 14:25:04 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2015-02-18 13:00:15 +0000
@@ -28,12 +28,13 @@
         </div>
 
         <div ng-if="dhis2Events && !showEventCreationDiv">            
-            <table class="table-borderless">
+            <table class="table-borderless table-with-fixed-layout">
                 <tbody>
                     <tr>
                         <td class="inline-block" ng-repeat="dhis2Event in dhis2Events | orderBy:'sortingDate':reverse">
                             <div class="stage-container" ng-class='getEventStyle(dhis2Event, false)' ng-click="showDataEntry(dhis2Event, false)">
                                 {{dhis2Event.name}}<br/>
+                                {{dhis2Event.orgUnitName}}<br/>
                                 {{dhis2Event.sortingDate}}         
                             </div>
                             <i class="fa fa-arrow-right" ng-if="$index < dhis2Events.length - 1"></i>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-02-11 11:52:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-02-18 13:00:15 +0000
@@ -79,11 +79,12 @@
             }
             else{
                 $scope.selectedEnrollment = null;
+                $scope.broadCastSelections('dashboardWidgets');
             }
         }
-        
-        $scope.broadCastSelections('dashboardWidgets');
-        
+        else{
+            $scope.broadCastSelections('dashboardWidgets');
+        }        
     });
     
     $scope.loadEnrollmentDetails = function(enrollment) {
@@ -103,10 +104,14 @@
                         $scope.selectedProgram.displayCustomForm = $scope.selectedProgram.hasCustomForm ? true:false;
                         $scope.trackedEntityForm = teForm;
                         $scope.customForm = CustomFormService.getForTrackedEntity($scope.trackedEntityForm, 'ENROLLMENT');
-                    }                    
+                    }
+                    $scope.broadCastSelections('dashboardWidgets');
                 });
             });                
         }
+        else{
+            $scope.broadCastSelections('dashboardWidgets');
+        }
     };
         
     $scope.showNewEnrollment = function(){       

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html	2015-01-20 16:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html	2015-02-18 13:00:15 +0000
@@ -14,7 +14,7 @@
         </span>        
     </div>
     <div ng-show="relationshipWidget.expand" class="panel-body dashboard-widget-container">
-        <div ng-show="selectedTei && !selectedTei.relationships" class="alert alert-warning">{{'no_relationship'| translate}}</div> 
+        <div ng-show="selectedTei && !selectedTei.relationships || selectedTei.relationships.length < 1" class="alert alert-warning">{{'no_relationship'| translate}}</div> 
         <div ng-show="!selectedTei" class="alert alert-danger">{{'relationship_not_possible'| translate}}</div> 
 
         <div ng-show="selectedTei" class="remove-default-padding">

=== 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-10-01 15:19:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/event-details.html	2015-02-18 13:00:15 +0000
@@ -20,7 +20,7 @@
     <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.eventOrgUnitName}}  |  {{currentEvent.eventDate}}
+            <span ng-if="reportMode === 'TEI'">{{currentEvent.programName}}    |    </span>{{currentEvent.name}}    |    {{currentEvent.orgUnitName}}  |  {{currentEvent.eventDate}}
         </span>
         <table class="table table-bordered table-compact">
             <thead>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js	2014-12-08 15:56:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js	2015-02-18 13:00:15 +0000
@@ -110,7 +110,7 @@
                     overdueEvent.dueDate = DateUtils.formatFromApiToUser(row.dueDate);
                     overdueEvent.event = row.event;
                     overdueEvent.eventName = $scope.programStages[row.programStage].name;
-                    overdueEvent.eventOrgUnitName = row.eventOrgUnitName;                    
+                    overdueEvent.orgUnitName = row.orgUnitName;                    
                     overdueEvent.followup = row.followup;
                     overdueEvent.program = row.program;
                     overdueEvent.programStage = row.programStage;
@@ -146,8 +146,8 @@
             AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){            
                 $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode);
 
-                $scope.gridColumns.push({name: $translate('event_orgunit_name'), id: 'eventOrgUnitName', type: 'string', displayInListNoProgram: false, showFilter: false, show: true});
-                $scope.filterTypes['eventOrgUnitName'] = 'string';
+                $scope.gridColumns.push({name: $translate('event_orgunit_name'), id: 'orgUnitName', 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';
                 $scope.gridColumns.push({name: $translate('due_date'), id: 'dueDate', type: 'date', displayInListNoProgram: false, showFilter: false, show: true});

=== 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-04 14:39:40 +0000
+++ 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
@@ -64,7 +64,7 @@
                     <span class="bold">{{'name'| translate}}:</span>    {{dhis2Event.name}}                
                 </div>
                 <div class="col-sm-2">
-                    <span class="bold">{{'org_unit'| translate}}:</span> {{dhis2Event.eventOrgUnitName}}                
+                    <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}}

=== 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-12-08 15:56:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js	2015-02-18 13:00:15 +0000
@@ -108,7 +108,6 @@
                             }  
                             $scope.dhis2Events[ev.trackedEntityInstance] = [ev];
                         }
-                        ev = EventUtils.setEventOrgUnitName(ev);
                     }
                 });
                 $scope.reportStarted = false;

=== 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-10-01 15:19:59 +0000
+++ 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
@@ -57,14 +57,14 @@
                                 <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'">                                    
                                     <span class="block align-center">{{ev.orgUnitName}}</span>                   
-                                    <span class="empty-stage-container" 
+                                    <span 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="stage-container" 
+                                    <span class="event-container" 
                                          title="{{'details'| translate}}"
                                          ng-class="{'{{ev.statusColor}}': true}"
                                          ng-if='ev.dataValues'

=== 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-11 11:52:21 +0000
+++ 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
@@ -6,28 +6,12 @@
                 DateUtils,
                 EventUtils,
                 TEIService,
-                ProgramFactory,
                 ProgramStageFactory,
                 EnrollmentService,
                 DHIS2EventFactory) {  
     $scope.showProgramReportDetailsDiv = false;
     $scope.enrollmentsByProgram = [];
-    
-    /*$scope.programs = [];  
-    $scope.programNames = [];  
-    $scope.programStageNames = [];
-    
-    ProgramFactory.getAll().then(function(programs){     
-        $scope.programs = programs;
-        angular.forEach($scope.programs, function(pr){
-            delete pr.organisationUnits;
-            $scope.programNames[pr.id] = {id: pr.id, name: pr.name};
-            angular.forEach(pr.programStages, function(stage){                
-                $scope.programStageNames[stage.id] = {id: stage.id, name: stage.name};
-            });
-        });
-    });*/
-        
+
     $scope.$on('dashboardWidgets', function(event, args) {
         $scope.showProgramReportDetailsDiv = false;
         var selections = CurrentSelection.get();        
@@ -93,7 +77,6 @@
                             $scope.report[ev.program].enrollments[ev.enrollment]= [ev];
                         }
                     }
-                    ev = EventUtils.setEventOrgUnitName(ev);
                 }                
             });
 

=== 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-12-08 15:56:07 +0000
+++ 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
@@ -109,7 +109,7 @@
                 upcomingEvent.dueDate = DateUtils.formatFromApiToUser(row.dueDate);
                 upcomingEvent.event = row.event;
                 upcomingEvent.eventName = $scope.programStages[row.programStage].name;
-                upcomingEvent.eventOrgUnitName = row.eventOrgUnitName;
+                upcomingEvent.orgUnitName = row.orgUnitName;
                 upcomingEvent.followup = row.followup;
                 upcomingEvent.program = row.program;
                 upcomingEvent.programStage = row.programStage;
@@ -145,8 +145,8 @@
             AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){            
                 $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode);
                 
-                $scope.gridColumns.push({name: $translate('event_orgunit_name'), id: 'eventOrgUnitName', type: 'string', displayInListNoProgram: false, showFilter: false, show: true});
-                $scope.filterTypes['eventOrgUnitName'] = 'string';
+                $scope.gridColumns.push({name: $translate('event_orgunit_name'), id: 'orgUnitName', 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';
                 $scope.gridColumns.push({name: $translate('due_date'), id: 'dueDate', type: 'date', displayInListNoProgram: false, showFilter: false, show: true});

=== 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-12 14:25:04 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-02-18 13:00:15 +0000
@@ -1346,29 +1346,6 @@
             dueDate = $filter('date')(dueDate, calendarSetting.keyDateFormat); 
             return dueDate;
         },
-        getEventOrgUnitName: function(orgUnitId){            
-            if(orgUnitId){
-                OrgUnitService.open().then(function(){
-                    OrgUnitService.get(orgUnitId).then(function(ou){
-                        if(ou){
-                            return ou.n;             
-                        }                                                       
-                    });                            
-                }); 
-            }
-        },
-        setEventOrgUnitName: function(dhis2Event){            
-            if(dhis2Event.orgUnit){
-                OrgUnitService.open().then(function(){
-                    OrgUnitService.get(dhis2Event.orgUnit).then(function(ou){
-                        if(ou){
-                            dhis2Event.eventOrgUnitName = ou.n;
-                            return dhis2Event;                            
-                        }                                                       
-                    });                            
-                }); 
-            }
-        },
         reconstruct: function(dhis2Event, programStage, optionSets){
             
             var e = {dataValues: [], 

=== 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	2015-02-12 10:51:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2015-02-18 13:00:15 +0000
@@ -91,10 +91,8 @@
     line-height: inherit;
 }
 
-.empty-stage-container {
+.empty-event-container {
     display: inline-block;
-    width: 135px;
-    height: 60px;
     opacity: 1.0;
     white-space: normal;
     padding-top: 5px;
@@ -113,6 +111,20 @@
 
 .stage-container:hover {
     border: 2px solid;
+    font-weight: bold;
+}
+
+.event-container {
+    cursor: pointer;
+    opacity: 1.0;
+    white-space: normal;
+    padding-top: 5px;
+    border: 2px dotted;
+}
+
+.event-container:hover {
+    border: 2px solid;
+    font-weight: bold;
 }
 
 .new-event {    
@@ -133,6 +145,7 @@
 
 .current-stage {
     border: 2px solid;
+    font-weight: bold;
 }
 
 .current-stage-color {