dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41699
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21264: tracker-capture: grid columns reordering
------------------------------------------------------------
revno: 21264
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-12-02 13:35:44 +0100
message:
tracker-capture: grid columns reordering
modified:
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/upcoming-events-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/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 2015-11-23 17:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js 2015-12-02 12:35:44 +0000
@@ -156,19 +156,18 @@
AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
var grid = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode);
- $scope.gridColumns = grid.columns;
+ $scope.gridColumns = [];
+ $scope.gridColumns.push({name: $translate.instant('due_date'), id: 'dueDate', valueType: 'DATE', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
+ $scope.gridColumns.push({name: $translate.instant('event_name'), id: 'eventName', valueType: 'TEXT', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
+ $scope.gridColumns = $scope.gridColumns.concat(grid.columns);
+
+ $scope.filterTypes['eventName'] = 'TEXT';
+ $scope.filterTypes['dueDate'] = 'DATE';
+ $scope.filterText['dueDate']= {};
angular.forEach($scope.gridColumns, function(col){
col.eventCol = false;
});
-
- $scope.gridColumns.push({name: $translate.instant('event_orgunit_name'), id: 'orgUnitName', valueType: 'TEXT', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
- $scope.filterTypes['orgUnitName'] = 'string';
- $scope.gridColumns.push({name: $translate.instant('event_name'), id: 'eventName', valueType: 'TEXT', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
- $scope.filterTypes['eventName'] = 'string';
- $scope.gridColumns.push({name: $translate.instant('due_date'), id: 'dueDate', valueType: 'DATE', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
- $scope.filterTypes['dueDate'] = 'DATE';
- $scope.filterText['dueDate']= {};
});
}
};
=== 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 2015-12-02 11:45:57 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js 2015-12-02 12:35:44 +0000
@@ -66,7 +66,7 @@
};
//watch for selection of program
- $scope.$watch('selectedProgram', function() {
+ $scope.$watchCollection('[selectedProgram, selectedOuMode]', function () {
$scope.reportFinished = false;
$scope.reportStarted = false;
@@ -155,21 +155,20 @@
AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
var grid = TEIGridService.generateGridColumns(atts, $scope.selectedOuMode);
- $scope.gridColumns = grid.columns;
+
+ $scope.gridColumns = [];
+ $scope.gridColumns.push({name: $translate.instant('due_date'), id: 'dueDate', valueType: 'DATE', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
+ $scope.gridColumns.push({name: $translate.instant('event_name'), id: 'eventName', valueType: 'TEXT', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
+ $scope.gridColumns = $scope.gridColumns.concat(grid.columns);
+
+ $scope.filterTypes['eventName'] = 'TEXT';
+ $scope.filterTypes['dueDate'] = 'DATE';
+ $scope.filterText['dueDate']= {};
angular.forEach($scope.gridColumns, function(col){
col.eventCol = false;
- });
-
- $scope.gridColumns.push({name: $translate.instant('event_orgunit_name'), id: 'orgUnitName', valueType: 'TEXT', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
- $scope.filterTypes['orgUnitName'] = 'TEXT';
- $scope.gridColumns.push({name: $translate.instant('event_name'), id: 'eventName', valueType: 'TEXT', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
- $scope.filterTypes['eventName'] = 'TEXT';
- $scope.gridColumns.push({name: $translate.instant('due_date'), id: 'dueDate', valueType: 'DATE', displayInListNoProgram: false, showFilter: false, show: true, eventCol: true});
- $scope.filterTypes['dueDate'] = 'DATE';
- $scope.filterText['dueDate']= {};
- });
-
+ });
+ });
}
};
=== 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-11-23 17:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2015-12-02 12:35:44 +0000
@@ -1535,13 +1535,14 @@
generateGridColumns: function(attributes, ouMode){
var filterTypes = {}, filterText = {};
- var columns = attributes ? angular.copy(attributes) : [];
+ 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 = columns.concat(attributes ? angular.copy(attributes) : []);
+
//generate grid column for the selected program/attributes
angular.forEach(columns, function(column){
column.show = false;