← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17025: tracker capture - cleanup

 

------------------------------------------------------------
revno: 17025
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-10-09 17:37:26 +0200
message:
  tracker capture - cleanup
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/profile/profile-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html
  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/scripts/controllers.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/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2014-10-08 08:48:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2014-10-09 15:37:26 +0000
@@ -123,6 +123,5 @@
 
         modalInstance.result.then(function () {
         });
-    };   
-
+    };
 });

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2014-09-05 12:52:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2014-10-09 15:37:26 +0000
@@ -10,7 +10,7 @@
     TranslationService.translate();
     
     //attributes for profile    
-    $scope.attributes = {};    
+    $scope.attributes = [];    
     $scope.editProfile = false;    
     
     AttributesFactory.getAll().then(function(atts){
@@ -27,10 +27,10 @@
         $scope.selectedProgram = selections.pr;   
         $scope.selectedEnrollment = selections.enrollment;  
         
-        //display only those attributes that belong the selected program
+        //display only those attributes that belong to the selected program
         //if no program, display attributesInNoProgram
         TEIService.processAttributes($scope.selectedTei, $scope.selectedProgram, $scope.selectedEnrollment).then(function(tei){
-            $scope.selectedTei = tei; 
+            $scope.selectedTei = tei;
         });
     });
     

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html	2014-10-09 13:41:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/profile/profile.html	2014-10-09 15:37:26 +0000
@@ -55,6 +55,10 @@
                                     <input type="number" name="foo" class="form-control" ng-model="attribute.value" ng-disabled="!editProfile" ng-required="attribute.mandatory"/>
                                     <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}} - {{attribute.type}}</span>
                                 </div>
+                                <div ng-switch-when="email">
+                                    <input type="email" name="foo" class="form-control" ng-model="attribute.value" ng-disabled="!editProfile" ng-required="attribute.mandatory"/>
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                                </div>
                                 <div ng-switch-default>
                                     <input type="text" name="foo" class="form-control" ng-model="attribute.value" ng-disabled="!editProfile" ng-required="attribute.mandatory"/>
                                     <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}} - {{attribute.type}}</span>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2014-10-09 13:41:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2014-10-09 15:37:26 +0000
@@ -23,9 +23,9 @@
     $scope.selectedOrgUnit = storage.get('SELECTED_OU');
     $scope.enrollment = {enrollmentDate: '', incidentDate: ''};   
     
-    AttributesFactory.getWithoutProgram().then(function(atts){
+    /*AttributesFactory.getWithoutProgram().then(function(atts){
         $scope.attributes = atts;
-    });
+    });*/
             
     $scope.trackedEntities = {available: []};
     TEService.getAll().then(function(entities){
@@ -35,14 +35,40 @@
     
     //watch for selection of program
     $scope.$watch('selectedProgram', function() {        
-        if( angular.isObject($scope.selectedProgram)){
+        /*if( angular.isObject($scope.selectedProgram)){
             $scope.trackedEntityList = [];
             AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
                 $scope.attributes = atts;
             });
-        }
+        }*/
+        
+        $scope.getAttributes();
     });    
-            
+        
+    $scope.getAttributes = function(){
+
+        if($scope.selectedProgram){
+            AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
+                $scope.attributesLighter = [];
+                $scope.attributes = [];
+                angular.forEach(atts, function(att){
+                    $scope.attributesLighter.push({id: att.id, name: att.name, type: att.valueType, displayInListNoProgram: att.displayInListNoProgram});
+                    $scope.attributes[att.id] = att;
+                });
+            });           
+        }
+        else{            
+            AttributesFactory.getWithoutProgram().then(function(atts){
+                $scope.attributesLighter = [];
+                $scope.attributes = [];
+                angular.forEach(atts, function(att){
+                    $scope.attributesLighter.push({id: att.id, name: att.name, type: att.valueType, displayInListNoProgram: att.displayInListNoProgram});
+                    $scope.attributes[att.id] = att;
+                });
+            });
+        }
+    };
+    
     $scope.registerEntity = function(destination){
         
         //check for form validity
@@ -63,7 +89,7 @@
         //registration form comes empty, in this case enforce at least one value
         $scope.valueExists = false;
         var registrationAttributes = [];    
-        angular.forEach($scope.attributes, function(attribute){
+        angular.forEach($scope.attributesLighter, function(attribute){
             if(!angular.isUndefined(attribute.value)){
                 var att = {attribute: attribute.id, value: attribute.value};
                 registrationAttributes.push(att);
@@ -124,7 +150,7 @@
             
             $timeout(function() { 
                 //reset form
-                angular.forEach($scope.attributes, function(attribute){
+                angular.forEach($scope.attributesLighter, function(attribute){
                     delete attribute.value;                
                 });            
 
@@ -187,6 +213,5 @@
                 });
             }
         }
-    };       
-    
+    };    
 });
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	2014-10-09 13:41:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	2014-10-09 15:37:26 +0000
@@ -19,13 +19,13 @@
 
         <h3>{{'profile' | translate}}</h3>
         <table class="table-borderless table-striped">
-            <tr ng-repeat="attribute in attributes">
+            <tr ng-repeat="attribute in attributesLighter">
                 <td>
                     {{attribute.name}}
                 </td>
                 <td>
                     <ng-form name="innerForm">     
-                        <div ng-switch="attribute.valueType">
+                        <div ng-switch="attribute.type">
                             <div ng-switch-when="date">
                                 <input type="text" placeholder="{{dhis2CalendarFormat.keyDateFormat}}" name="foo" class="form-control" ng-date ng-model="attribute.value" ng-required="attribute.mandatory" />
                                 <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
@@ -48,7 +48,7 @@
                                        name="foo"
                                        class="form-control"
                                        ng-model="attribute.value"                                                 
-                                       typeahead="option.code as option.name for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
+                                       typeahead="option.code as option.name for option in attributes[attribute.id].optionSet.options | filter:$viewValue | limitTo:20" 
                                        typeahead-open-on-focus
                                        ng-required="attribute.mandatory"/>
                                 </div>
@@ -58,7 +58,7 @@
                                            name="foo"
                                            class="form-control"
                                            ng-model="attribute.value"                                                 
-                                           typeahead="option.code as option.name for option in attribute.optionSet.options | filter:$viewValue | limitTo:20" 
+                                           typeahead="option.code as option.name for option in attributes[attribute.id].optionSet.options | filter:$viewValue | limitTo:20" 
                                            typeahead-open-on-focus
                                            ng-required="attribute.mandatory"/>
                                     </div>
@@ -87,6 +87,10 @@
                                 <input type="number" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
                                 <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
                             </div>
+                            <div ng-switch-when="email">
+                                <input type="email" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
+                                <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>
+                            </div>
                             <div ng-switch-default>
                                 <input type="text" name="foo" class="form-control" ng-model="attribute.value" ng-required="attribute.mandatory"/>
                                 <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="error">{{'required'| translate}}</span>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html	2014-08-29 12:39:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/reportForm.html	2014-10-09 15:37:26 +0000
@@ -34,17 +34,17 @@
                 <td>
                     <input type="text" 
                            name="reportStartDate" 
-                           placeholder="{{'start_date'| translate}} (yyyy-mm-dd)" 
+                           placeholder="{{'start_date'| translate}} ({{dhis2CalendarFormat.keyDateFormat}})" 
                            class="form-control" 
                            ng-date 
                            ng-model="report.startDate" 
                            max="today" 
                            ng-required="true"/> 
-                    <span ng-show="outerForm.submitted && outerForm.reportStartDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
+                    <span ng-show="outerForm.submitted && outerForm.reportStartDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} ({{dhis2CalendarFormat.keyDateFormat}})</span>
                 </td>
                 <td>
-                    <input type="text" name="reportEndDate" placeholder="{{'end_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.endDate" max="today" ng-required="true"/>
-                    <span ng-show="outerForm.submitted && outerForm.reportEndDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
+                    <input type="text" name="reportEndDate" placeholder="{{'end_date'| translate}} ({{dhis2CalendarFormat.keyDateFormat}})" class="form-control" ng-date ng-model="report.endDate" max="today" ng-required="true"/>
+                    <span ng-show="outerForm.submitted && outerForm.reportEndDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} ({{dhis2CalendarFormat.keyDateFormat}})</span>
                 </td>
             </tr>
         </table>                

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html	2014-09-24 11:39:51 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events.html	2014-10-09 15:37:26 +0000
@@ -88,17 +88,17 @@
                         <td>
                             <input type="text" 
                                    name="reportStartDate" 
-                                   placeholder="{{'start_date'| translate}} (yyyy-mm-dd)" 
+                                   placeholder="{{'start_date'| translate}} ({{dhis2CalendarFormat.keyDateFormat}})" 
                                    class="form-control" 
                                    ng-date 
                                    ng-model="report.startDate" 
                                    min-date="today" 
                                    ng-required="true"/> 
-                            <span ng-show="outerForm.submitted && outerForm.reportStartDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
+                            <span ng-show="outerForm.submitted && outerForm.reportStartDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} ({{dhis2CalendarFormat.keyDateFormat}})</span>
                         </td>
                         <td>
-                            <input type="text" name="reportEndDate" placeholder="{{'end_date'| translate}} (yyyy-mm-dd)" class="form-control" ng-date ng-model="report.endDate" min-date="today" ng-required="true"/>
-                            <span ng-show="outerForm.submitted && outerForm.reportEndDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} (yyyy-mm-dd)</span>
+                            <input type="text" name="reportEndDate" placeholder="{{'end_date'| translate}} ({{dhis2CalendarFormat.keyDateFormat}})" class="form-control" ng-date ng-model="report.endDate" min-date="today" ng-required="true"/>
+                            <span ng-show="outerForm.submitted && outerForm.reportEndDate.$invalid" style="color:red;font-size:12px">{{'required'| translate}} ({{dhis2CalendarFormat.keyDateFormat}})</span>
                         </td>
                     </tr>
                 </table>                

=== 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-03 08:25:10 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/en.json	2014-10-09 15:37:26 +0000
@@ -149,7 +149,7 @@
     "data_exists": "Data exists",
     "data_registerd": "No data registered",
     "no_visit_made": "No visit made",
-    "visit_not_made": "Visit not yet conducted",
+    "visit_not_made": "Visit not made",
     "_visit": "visit",
     "visit": "Visit",
     "visits": "Visits",

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-10-09 13:41:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2014-10-09 15:37:26 +0000
@@ -60,8 +60,22 @@
             
             $scope.loadPrograms($scope.selectedOrgUnit);                                
         }
+    });    
+    
+    //watch for changes in ou mode - mode could be selected without notifcation to grid column generator
+    $scope.$watch('selectedOuMode.name', function() {           
+
+        if( $scope.selectedOuMode.name && angular.isObject($scope.gridColumns)){
+            var continueLoop = true;
+            for(var i=0; i<$scope.gridColumns.length && continueLoop; i++){
+                if($scope.gridColumns[i].id === 'orgUnitName' && $scope.selectedOuMode.name !== 'SELECTED'){
+                    $scope.gridColumns[i].show = true;
+                    continueLoop = false;
+                }
+            }           
+        }
     });
-    
+        
     //watch for program feedback (this is when coming back from dashboard)
     if($scope.dashboardProgramId && $scope.dashboardProgramId !== 'null'){
         $scope.selectedOrgUnit = storage.get('SELECTED_OU');            
@@ -103,6 +117,7 @@
                     }
                 }                
                 $scope.processAttributes();
+                
                 $scope.search($scope.searchMode.listAll);
             });
         }        
@@ -130,6 +145,7 @@
             AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
                 $scope.attributesLighter = [];
                 $scope.attributes = [];
+                
                 setTimeout(function () {
                     $scope.$apply(function () {                        
                         angular.forEach(atts, function(att){
@@ -146,6 +162,7 @@
             AttributesFactory.getWithoutProgram().then(function(atts){
                 $scope.attributesLighter = [];
                 $scope.attributes = [];
+                
                 setTimeout(function () {
                     $scope.$apply(function () {
                         angular.forEach(atts, function(att){
@@ -160,8 +177,8 @@
         }
     };
    
-    $scope.searchParam = {bools: []};
-    $scope.search = function(mode){ 
+    //$scope.searchParam = {bools: []};
+    $scope.search = function(mode){
         
         $scope.teiFetched = false;
         $scope.selectedSearchMode = mode;
@@ -213,7 +230,7 @@
         if( $scope.selectedSearchMode === $scope.searchMode.listAll ){
             $scope.searchText = '';
             
-            $scope.attributes = EntityQueryFactory.resetAttributesQuery($scope.attributes, $scope.enrollment);
+            $scope.attributesLighter = EntityQueryFactory.resetAttributesQuery($scope.attributesLighter, $scope.enrollment);
         }
         
         $scope.fetchTeis();
@@ -272,8 +289,7 @@
             if(attribute.type === 'number' || attribute.type === 'date'){
                 attribute.operator = $scope.defaultOperators[0];
             }
-        });
-                    
+        });                    
         return attributes;
     };
     

=== 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	2014-10-09 13:41:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2014-10-09 15:37:26 +0000
@@ -1182,7 +1182,6 @@
                 }  
                 column.showFilter = false;
             });
-            
             return columns;  
         },
         getData: function(rows, columns){