← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15852: tracker capture - tei attributes now respect defined orders

 

------------------------------------------------------------
revno: 15852
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Wed 2014-06-25 16:21:55 +0200
message:
  tracker capture - tei attributes now respect defined orders
modified:
  dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2014-06-25 14:08:18 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js	2014-06-25 14:21:55 +0000
@@ -1,6 +1,7 @@
 trackerCapture.controller('ProfileController',
         function($rootScope,
-                $scope,                
+                $scope,     
+                orderByFilter,
                 CurrentSelection,
                 TEService,
                 TEIService,
@@ -53,11 +54,12 @@
                         if(atts[i].id === $scope.selectedEntity.attributes[j].attribute){
                             processed = true;
                             $scope.selectedEntity.attributes[j].show = true;
+                            $scope.selectedEntity.attributes[j].order = i;
                         }
                     }
 
                     if(!processed){//attribute was empty, so a chance to put some value
-                        $scope.selectedEntity.attributes.push({show: true, attribute: atts[i].id, displayName: atts[i].name, type: atts[i].valueType, value: ''});
+                        $scope.selectedEntity.attributes.push({show: true, order: i, attribute: atts[i].id, displayName: atts[i].name, type: atts[i].valueType, value: ''});
                     }                   
                 }
             }); 
@@ -72,15 +74,19 @@
                         if(atts[i].id === $scope.selectedEntity.attributes[j].attribute){
                             processed = true;
                             $scope.selectedEntity.attributes[j].show = true;
+                            $scope.selectedEntity.attributes[j].order = i;
                         }
                     }
 
                     if(!processed){//attribute was empty, so a chance to put some value
-                        $scope.selectedEntity.attributes.push({show: true, attribute: atts[i].id, displayName: atts[i].name, type: atts[i].valueType, value: ''});
+                        $scope.selectedEntity.attributes.push({show: true, order: i, attribute: atts[i].id, displayName: atts[i].name, type: atts[i].valueType, value: ''});
                     }                   
                 }
             });
-        }              
+        }
+        
+        $scope.selectedEntity.attributes = orderByFilter($scope.selectedEntity.attributes, '-order');
+        $scope.selectedEntity.attributes.reverse();
     };
     
     $scope.enableEdit = function(){