← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21414: tracker-capture: when in view mode, profile widget shows only those attributes marked display in ...

 

------------------------------------------------------------
revno: 21414
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-12-10 23:51:07 +0100
message:
  tracker-capture: when in view mode, profile widget shows only those attributes marked display in list. All attributes are displayed during edit mode. This helps for users to focus only on key info.
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/select2x2.png
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.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/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/registration/default-registration-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2015-12-10 16:21:48 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2015-12-10 22:51:07 +0000
@@ -1,6 +1,6 @@
 <h3 ng-if="widget !== 'PROFILE'">{{'profile'| translate}}</h3>
 <table class="dhis2-list-table-striped dhis2-table-hover">
-    <tr ng-repeat="attribute in attributes" ng-if="!hiddenFields[attribute.id]">
+    <tr ng-repeat="attribute in attributes | filter: {attribute: 'true'} " ng-if="!hiddenFields[attribute.id] && ((editingDisabled  && attribute.show) || !editingDisabled)">
         <td>
             <span ng-bind="attribute.name"></span><span ng-if="attribute.mandatory || attribute.unique" class="required">*</span>
         </td>

=== 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	2015-12-09 10:05:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-12-10 22:51:07 +0000
@@ -18,6 +18,7 @@
                 RegistrationService,
                 DateUtils,
                 SessionStorageService,
+                TEIGridService,
                 TrackerRulesFactory,
                 TrackerRulesExecutionService) {
     
@@ -113,7 +114,7 @@
     $scope.getAttributes = function(_mode){        
         var mode = _mode ? _mode : 'ENROLLMENT';
         AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){            
-            $scope.attributes = atts;
+            $scope.attributes = TEIGridService.generateGridColumns(atts, null).columns;
             $scope.customFormExists = false;
             if($scope.selectedProgram && $scope.selectedProgram.id && $scope.selectedProgram.dataEntryForm && $scope.selectedProgram.dataEntryForm.htmlCode){
                 $scope.customFormExists = 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-12-10 11:09:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-12-10 22:51:07 +0000
@@ -1512,7 +1512,7 @@
             invalidTeis = !invalidTeis ? [] : invalidTeis;
             if(!grid || !grid.rows){
                 return;
-            }
+            }            
             
             //grid.headers[0-5] = Instance, Created, Last updated, Org unit, Tracked entity, Inactive
             //grid.headers[6..] = Attribute, Attribute,.... 
@@ -1532,6 +1532,7 @@
 
                     entity.id = row[0];
                     entity.created = DateUtils.formatFromApiToUser( row[1] );
+                    
                     entity.orgUnit = row[3];                              
                     entity.type = row[4];
                     entity.inactive = row[5] !== "" ? row[5] : false;
@@ -1578,22 +1579,26 @@
         },
         generateGridColumns: function(attributes, ouMode){
             
+            if( ouMode === null ){
+                ouMode = 'SELECTED';
+            }
             var filterTypes = {}, filterText = {};
             var columns = [];
        
             //also add extra columns which are not part of attributes (orgunit for example)
-            columns.push({id: 'orgUnitName', name: $translate.instant('registering_unit'), valueType: 'TEXT', displayInListNoProgram: false});
-            columns.push({id: 'created', name: $translate.instant('registration_date'), valueType: 'DATE', displayInListNoProgram: false});
-            columns.push({id: 'inactive', name: $translate.instant('inactive'), valueType: 'BOOLEAN', displayInListNoProgram: false});
+            columns.push({id: 'orgUnitName', name: $translate.instant('registering_unit'), valueType: 'TEXT', displayInListNoProgram: false, attribute: false});
+            columns.push({id: 'created', name: $translate.instant('registration_date'), valueType: 'DATE', displayInListNoProgram: false, attribute: false});
+            columns.push({id: 'inactive', name: $translate.instant('inactive'), valueType: 'BOOLEAN', displayInListNoProgram: false, attribute: false});
             columns = columns.concat(attributes ? angular.copy(attributes) : []);
             
             //generate grid column for the selected program/attributes
             angular.forEach(columns, function(column){
-                column.show = false;                
+                column.attribute = angular.isUndefined(column.attribute) ? true : false;
+                column.show = false;                    
                 if( (column.id === 'orgUnitName' && ouMode !== 'SELECTED') ||
                     column.displayInListNoProgram || 
                     column.displayInList){
-                    column.show = true;    
+                    column.show = true;
                 }                
                 column.showFilter = false;                
                 filterTypes[column.id] = column.valueType;

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/select2x2.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/select2x2.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/select2x2.png	2015-12-10 22:51:07 +0000 differ