Skip to content

Commit

Permalink
fix(payroll); improve multipayroll grid columns
Browse files Browse the repository at this point in the history
This commit adds the ability to filter on any of the rubrics in the
multiple payroll by index grid.  It also removes the row selection
checkbox.

Closes #6387.
  • Loading branch information
jniles committed Jun 1, 2022
1 parent d42d8ce commit 22b32b0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
10 changes: 3 additions & 7 deletions client/src/js/services/grid/GridColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ function GridColumnService(uiGridConstants, AppCache, Modal, util, $translate) {
});
}


/**
* returns [{field1 : displayName1}, {field2 : displayName2}, ...]
* this function is useful for renaming keys
Expand Down Expand Up @@ -113,7 +112,6 @@ function GridColumnService(uiGridConstants, AppCache, Modal, util, $translate) {
this.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN);
};


/**
* @method hasEnoughColumns
*
Expand All @@ -138,7 +136,6 @@ function GridColumnService(uiGridConstants, AppCache, Modal, util, $translate) {
return visibleColumns > 0;
};


/**
* @method resetDefaultVisibility
*
Expand All @@ -161,7 +158,7 @@ function GridColumnService(uiGridConstants, AppCache, Modal, util, $translate) {
* core.
*/
Columns.prototype.getColumns = function getColumns() {
return this.gridApi.grid.columns;
return this.gridApi.grid.columns.filter(col => col.field !== 'selectionRowHeaderCol');
};

/**
Expand Down Expand Up @@ -194,10 +191,9 @@ function GridColumnService(uiGridConstants, AppCache, Modal, util, $translate) {
templateUrl : 'modules/templates/modals/columnConfig.modal.html',
controller : 'ColumnsConfigModalController as ColumnsConfigModalCtrl',
size : 'lg',
resolve : {
Columns : function columnsProvider() { return self; },
},
resolve : { Columns : () => self },
});

return modal.result;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</div>

<bh-filter-toggle on-toggle="MultiplePayrollCtrl.toggleInlineFilter()">
</bh-filter-toggle>
</bh-filter-toggle>
</div>
</div>
</div>
Expand Down Expand Up @@ -92,4 +92,4 @@
error-state="MultiplePayrollCtrl.hasError">
</bh-grid-loading-indicator>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -99,38 +99,40 @@ function MultiplePayrollIndiceController(

MultiplePayroll.read(null, filters)
.then((result) => {
renameGidHeaders(result.rubrics);
renameGridHeaders(result.rubrics);
vm.gridOptions.data = setGridData(result.employees);
})
.catch(errorHandler)
.finally(toggleLoadingIndicator);
}

function renameGidHeaders(rubrics) {
function renameGridHeaders(rubrics) {
const actions = angular.copy(columnDefs[columnDefs.length - 1]);
const newColumns = columnDefs.slice(0, 1);

const header = {
type : 'number',
enableFiltering : false,
headerCellFilter : 'translate',
cellClass : 'text-right',
footerCellClass : 'text-right',
footerCellFilter : 'number:2',
cellFilter : 'number:2',
aggregationType : uiGridConstants.aggregationTypes.sum,
// width : 100,
aggregationHideLabel : true,
};

rubrics.forEach(rubric => {
newColumns.push(angular.extend({}, header, {
field : `${rubric.id}`,
displayName : rubric.abbr,
headerTooltip : rubric.label,
}));
});

vm.gridOptions.columnDefs = [...newColumns, actions];

// notify the grid of a data change
vm.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN);
}

function setGridData(employees) {
Expand Down

0 comments on commit 22b32b0

Please sign in to comment.