← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16131: tracker capture - more synch between tei dashboard widgets

 

------------------------------------------------------------
revno: 16131
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Tue 2014-07-15 15:13:11 +0200
message:
  tracker capture - more synch between tei dashboard widgets
modified:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report.html
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html


--
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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html	2014-07-02 16:25:28 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html	2014-07-15 13:13:11 +0000
@@ -6,8 +6,9 @@
         <select ng-model="selectedProgram"
                 class="form-control-program"
                 ng-options="program as program.name for program in programs | orderBy: 'name'" 
+                ng-disabled="programs.length < 1"
                 ng-change="broadCastSelections()">
-            <option value="">{{'please_select_a_program'| translate}}</option>
+            <option value="">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists' | translate}}</option>
         </select>
 
         <div class="pull-right">

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment.html	2014-07-15 13:13:11 +0000
@@ -1,6 +1,9 @@
 <div class="panel panel-default" ng-controller="EnrollmentController">
     <div class="panel-heading handle bold">
         {{enrollmentWidget.title| translate}}
+        <span class="nav-pills" ng-show="selectedProgram && !selectedEnrollment">
+            | <a href ng-click="showEnrollment()" title="{{'new_enrollment'| translate}}"><span class="bold">{{'new_enrollment'| translate}}</span></a>
+        </span>
         <span class="pull-right">
             <a class="small-horizonal-spacing" href ng-click="expandCollapse(enrollmentWidget)">
                 <span ng-show="enrollmentWidget.expand"><i class="fa fa-chevron-up" title="{{'collapse'| translate}}"></i></span>
@@ -65,7 +68,7 @@
         </div>
         
         <form name="outerForm" novalidate>
-            <div ng-if="selectedProgram && !selectedEnrollment">
+            <div ng-if="showEnrollmentDiv">
                 <table class="table-borderless">
                     <tr class="col-md-12">
                         <td class="col-md-6">
@@ -149,11 +152,14 @@
             </div>
         </form>    
 
+        <div ng-if="selectedProgram && !selectedEnrollment && !showEnrollmentDiv">
+            <div class="alert alert-warning">{{'not_yet_enrolled_enrollment'| translate}}</div> 
+        </div>
         <div ng-if="!selectedProgram && programExists">
             <div class="alert alert-warning">{{'please_select_a_program_for_enrollment'| translate}}</div> 
         </div>
         <div ng-if="!programExists">
-            <div class="alert alert-warning">{{'no_program_exists'| translate}}</div> 
+            <div class="alert alert-warning">{{'no_program_exists_enrollment'| translate}}</div> 
         </div>
 
     </div>

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js	2014-07-15 09:20:54 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js	2014-07-15 13:13:11 +0000
@@ -39,7 +39,7 @@
     $scope.addNoteField = false;    
     
     $scope.showAddNote = function() {
-        $scope.addNoteField = true;
+        $scope.addNoteField = !$scope.addNoteField;
     };
     
     $scope.addNote = function(){

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report.html	2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/report/report.html	2014-07-15 13:13:11 +0000
@@ -36,7 +36,12 @@
             </div>
         </div>
     </form>
-    <div class="row" ng-if="!selectedProgram">
+    <div class="row" ng-if="programs.length < 1">        
+        <div class="col-md-12 vertical-spacing">
+            <div class="alert alert-warning">{{'no_program_exists_report'| translate}}</div> 
+        </div>
+    </div>
+    <div class="row" ng-if="programs.length > 0 && !selectedProgram">        
         <div class="col-md-12 vertical-spacing">
             <div class="alert alert-warning">{{'please_select_program_report'| translate}}</div> 
         </div>

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-07-15 13:13:11 +0000
@@ -4,13 +4,16 @@
     "program": "Program",
     "please_select": "[Please select]",
     "please_select_a_program": "[Please select a program]",
+    "no_program_exists": "[No program exists]",
     "please_select_a_program_for_enrollment": "Please select a program for enrollment.",
     "please_select_program_report": "Please select a program for reporting.",
     "please_select_a_relationship": "Please select a relationship",
     "no_relationship": "No relationship exists.",
     "relationship_not_possible": "No tracked entity instance, relationship not possible.",
-    "no_program_exists": "No program exists for the selected org unit. Enrollment not possible.",
+    "no_program_exists_enrollment": "No program exists for the selected org unit. Enrollment not possible.",
+    "no_program_exists_report": "No program exists for the selected org unit. Reporting not possible.",
     "not_yet_enrolled_data_entry": "Not yet enrolled. Data entry not possible.",
+    "not_yet_enrolled_enrollment": "Not yet enrolled. Please enroll.",
     "not_yet_enrolled_note": "Not yet enrolled. Note recording not possible.",
     "not_yet_enrolled_report": "Not yet enrolled. Reporting not possible",
     "no_data_report": "No record exists for reporting",
@@ -131,6 +134,7 @@
     "scheduling": "Scheduling",
     "reschedule": "Reschedule",
     "enroll": "Enroll",
+    "new_enrollment": "New enrollment",
     "start_date": "Start date",
     "end_date": "End date",
     "from": "From",

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-07-08 19:07:43 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-07-15 13:13:11 +0000
@@ -16,16 +16,10 @@
                 AttributesFactory,
                 EntityQueryFactory,
                 TEIGridService,
-                TEIService) {   
-   
+                TEIService) {  
+    
     //Selection
-    $scope.selectedOrgUnit = '';
-    $scope.selectedProgram = '';
-    $scope.ouModes = [{name: 'SELECTED'}, 
-                    {name: 'CHILDREN'}, 
-                    {name: 'DESCENDANTS'},
-                    {name: 'ACCESSIBLE'}
-                  ];         
+    $scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];         
     $scope.selectedOuMode = $scope.ouModes[0];
     
     //Paging
@@ -42,13 +36,8 @@
     $scope.defaultOperators = OperatorFactory.defaultOperators;
     $scope.boolOperators = OperatorFactory.boolOperators;
     $scope.enrollment = {programStartDate: '', programEndDate: '', operator: $scope.defaultOperators[0]};
-    $scope.searchState = true;
-   
-    $scope.searchMode = { 
-                            listAll: 'LIST_ALL', 
-                            freeText: 'FREE_TEXT', 
-                            attributeBased: 'ATTRIBUTE_BASED'
-                        };
+    $scope.searchState = true;   
+    $scope.searchMode = { listAll: 'LIST_ALL', freeText: 'FREE_TEXT', attributeBased: 'ATTRIBUTE_BASED' };
     
     //Registration
     $scope.showRegistrationDiv = false;
@@ -64,20 +53,29 @@
             storage.set('SELECTED_OU', $scope.selectedOrgUnit);
             
             $scope.trackedEntityList = [];
-            $scope.selectedProgram = '';
-            
+           
             //apply translation - by now user's profile is fetched from server.
             TranslationService.translate();
             
-            $scope.loadPrograms($scope.selectedOrgUnit); 
+            $scope.loadPrograms($scope.selectedOrgUnit);
             
-            AttributesFactory.getWithoutProgram().then(function(atts){
+            if($scope.selectedProgram){
+                AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
+                    $scope.attributes = atts;   
+                    $scope.attributes = $scope.generateAttributeFilters($scope.attributes);
+                    $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);      
+                    $scope.search($scope.searchMode.listAll); ;
+                });
+            }
+            else{
+                AttributesFactory.getWithoutProgram().then(function(atts){
                 
-                $scope.attributes = atts;   
-                $scope.attributes = $scope.generateAttributeFilters($scope.attributes);
-                $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);      
-                $scope.search($scope.searchMode.listAll);                
-            });           
+                    $scope.attributes = atts;   
+                    $scope.attributes = $scope.generateAttributeFilters($scope.attributes);
+                    $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);      
+                    $scope.search($scope.searchMode.listAll);                
+                });  
+            }                     
         }
     });
     
@@ -85,8 +83,6 @@
     $scope.loadPrograms = function(orgUnit) {        
                 
         $scope.selectedOrgUnit = orgUnit;
-        $scope.selectedProgram = null;
-        $scope.selectedProgramStage = null;
         
         if (angular.isObject($scope.selectedOrgUnit)) {   
 
@@ -97,18 +93,23 @@
                         $scope.programs.push(program);
                     }
                 });
-                
-                if(angular.isObject($scope.programs) && $scope.programs.length === 1){
-                    $scope.selectedProgram = $scope.programs[0];
-                    AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
-                        setTimeout(function () {
-                            $scope.$apply(function () {
-                                $scope.attributes = atts;    
-                                $scope.attributes = $scope.generateAttributeFilters($scope.attributes);
-                                $scope.gridColumns = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode.name);      
-                            });
-                        }, 100);
-                    });
+
+                if($scope.programs.length === 0){
+                    $scope.selectedProgram = null;
+                }
+                else{
+                    if($scope.selectedProgram){
+                        angular.forEach($scope.programs, function(program){                            
+                            if(program.id === $scope.selectedProgram.id){                                
+                                $scope.selectedProgram = program;
+                            }
+                        });
+                    }
+                    else{                        
+                        if($scope.programs.length === 1){
+                            $scope.selectedProgram = $scope.programs[0];
+                        }                        
+                    }
                 }                
             });
         }        

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2014-07-15 13:13:11 +0000
@@ -650,6 +650,29 @@
     transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
 }
 
+.form-control-program:focus {
+	border-color: #66afe9;
+	outline: 0;
+	-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(102,175,233,0.6);
+	box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(102,175,233,0.6)
+}
+.form-control-program:-moz-placeholder {
+	color: #999
+}
+.form-control-program::-moz-placeholder {
+	color: #999
+}
+.form-control-program:-ms-input-placeholder {
+	color: #999
+}
+.form-control-program::-webkit-input-placeholder {
+	color: #999
+}
+.form-control-program[disabled], .form-control-program[readonly], fieldset[disabled] .form-control-program {
+	cursor: not-allowed;
+	background-color: #eee
+}
+
 .form-control-select2 {
     display: block;
     width: 100%;

=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html	2014-07-13 13:08:50 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html	2014-07-15 13:13:11 +0000
@@ -43,12 +43,13 @@
     <!--- search, registration and reporting menu begins -->
     <div class="row"> 
         <div id="selectDropDownParent" class="input-group col-md-3">            
-            <button type="button" class="select-drop-down-button form-control" >{{selectedProgram ? selectedProgram.name : 'please_select_a_program'| translate}}</button>
+            <button type="button" class="select-drop-down-button form-control" ng-show="programs.length > 0">{{selectedProgram ? selectedProgram.name : 'please_select_a_program'| translate}}</button>
+            <button type="button" class="select-drop-down-button form-control" ng-show="programs.length < 1" ng-disabled="true">{{programs.length > 0 ? 'please_select_a_program' : 'no_program_exists' | translate}}</button>
             <div class="input-group-btn">
-                <button class="btn btn-default trim" type="button" title="{{'list_programs'| translate}}" data-toggle="dropdown"><i class="fa fa-caret-down"></i></button>
+                <button class="btn btn-default trim" type="button" title="{{'list_programs'| translate}}" data-toggle="dropdown" ng-disabled="programs.length < 1"><i class="fa fa-caret-down"></i></button>
                 <ul id="selectDropDown" class="dropdown-menu dropdown-menu-right">
                     <li>
-                        <a href ng-click="getProgramAttributes(null)">{{'please_select_a_program'| translate}}</a>
+                        <a href ng-click="getProgramAttributes(null)">{{'please_select_a_program' | translate}}</a>
                     </li>
                     <li ng-repeat="program in programs| orderBy: 'name'">
                         <a href ng-click="getProgramAttributes(program)">{{program.name}}</a>