diff --git a/bciers/apps/reporting/src/app/components/datagrid/models/operations/operationGroupColumns.ts b/bciers/apps/reporting/src/app/components/datagrid/models/operations/operationGroupColumns.ts index 0eeb20405e..97cf5bba70 100644 --- a/bciers/apps/reporting/src/app/components/datagrid/models/operations/operationGroupColumns.ts +++ b/bciers/apps/reporting/src/app/components/datagrid/models/operations/operationGroupColumns.ts @@ -5,53 +5,29 @@ import { import EmptyGroupCell from "@bciers/components/datagrid/cells/EmptyGroupCell"; import { OPERATOR_COLUMN_INDEX } from "./operationColumns"; +const createColumnGroup = ( + groupId: string, + headerName: string, + renderHeaderGroup: any, +) => ({ + groupId, + headerName, + renderHeaderGroup, + children: [{ field: groupId }], +}); + const operationGroupColumns = ( isOperatorColumn: boolean, SearchCell: (params: GridColumnGroupHeaderParams) => JSX.Element, ) => { const columnGroupModel = [ - { - groupId: "bcghg_id", - headerName: "BC GHG ID", - renderHeaderGroup: SearchCell, - children: [{ field: "bcghg_id" }], - }, - { - groupId: "name", - headerName: "Operation", - renderHeaderGroup: SearchCell, - children: [{ field: "name" }], - }, - { - groupId: "submission_date", - headerName: "Submission Date", - renderHeaderGroup: EmptyGroupCell, - children: [{ field: "submission_date" }], - }, - { - groupId: "bc_obps_regulated_operation", - headerName: "BORO ID", - renderHeaderGroup: SearchCell, - children: [{ field: "bc_obps_regulated_operation" }], - }, - { - groupId: "status", - headerName: "Application Status", - renderHeaderGroup: SearchCell, - children: [{ field: "status" }], - }, - { - groupId: "report_status", - headerName: "Status", - renderHeaderGroup: SearchCell, - children: [{ field: "report_status" }], - }, - { - groupId: "action", - headerName: "Action", - renderHeaderGroup: EmptyGroupCell, - children: [{ field: "action" }], - }, + createColumnGroup("bcghg_id", "BC GHG ID", SearchCell), + createColumnGroup("name", "Operation", SearchCell), + createColumnGroup("submission_date", "Submission Date", EmptyGroupCell), + createColumnGroup("bc_obps_regulated_operation", "BORO ID", SearchCell), + createColumnGroup("status", "Application Status", SearchCell), + createColumnGroup("report_status", "Status", SearchCell), + createColumnGroup("action", "Action", EmptyGroupCell), ] as GridColumnGroupingModel; if (isOperatorColumn) {