diff --git a/resources/jscomposition/cases/casesMain/config/columns.js b/resources/jscomposition/cases/casesMain/config/columns.js index ea5e9a9fa9..c8dffed759 100644 --- a/resources/jscomposition/cases/casesMain/config/columns.js +++ b/resources/jscomposition/cases/casesMain/config/columns.js @@ -1,7 +1,7 @@ import { t } from "i18next"; import { CaseTitleCell, - TruncatedOptionsCell, + TruncatedGroupOptionsCell, ParticipantsCell, StatusCell, LinkCell, @@ -82,15 +82,37 @@ export const taskColumn = () => ({ resizable: true, width: 200, cellRenderer: () => ({ - component: TruncatedOptionsCell, + component: TruncatedGroupOptionsCell, params: { href: (option) => `/tasks/${option.id}/edit`, formatterOptions: (option, row, column, columns) => option.name, - filterData: (row, column, columns) => { + formatData: (row, column, columns) => { if (row.case_status === "COMPLETED") { return []; } - return row.tasks.filter((el) => el.status === "ACTIVE"); + + const groupedTasks = row.tasks.reduce((acc, task) => { + if (task.status !== "ACTIVE") { + return acc; + } + + const processId = task.process_id; + const existGroup = acc.find((group) => group.process_id === processId); + + if (existGroup) { + existGroup.options.push(task); + } else { + acc.push({ + process_id: processId, + options: [task], + ...row.processes.find((process) => process.id === processId), + }); + } + + return acc; + }, []); + + return groupedTasks; }, }, }), diff --git a/resources/jscomposition/system/table/cell/index.js b/resources/jscomposition/system/table/cell/index.js index 28db36a95f..2afe2e06c8 100644 --- a/resources/jscomposition/system/table/cell/index.js +++ b/resources/jscomposition/system/table/cell/index.js @@ -1,5 +1,6 @@ import ParticipantsCell from "./ParticipantsCell.vue"; import ParticipantCell from "./ParticipantCell.vue"; +import TruncatedGroupOptionsCell from "./truncatedGroupOptionsCell/TruncatedGroupOptionsCell.vue"; import TruncatedOptionsCell from "./TruncatedOptionsCell.vue"; import StatusCell from "./StatusCell.vue"; import CaseTitleCell from "./CaseTitleCell.vue"; @@ -9,6 +10,7 @@ import TruncatedColumn from "./TruncatedColumn.vue"; export { ParticipantsCell, + TruncatedGroupOptionsCell, TruncatedOptionsCell, StatusCell, CaseTitleCell, diff --git a/resources/jscomposition/system/table/cell/truncatedGroupOptionsCell/BaseOption.vue b/resources/jscomposition/system/table/cell/truncatedGroupOptionsCell/BaseOption.vue new file mode 100644 index 0000000000..04d0968cff --- /dev/null +++ b/resources/jscomposition/system/table/cell/truncatedGroupOptionsCell/BaseOption.vue @@ -0,0 +1,61 @@ + + diff --git a/resources/jscomposition/system/table/cell/truncatedGroupOptionsCell/TitleOption.vue b/resources/jscomposition/system/table/cell/truncatedGroupOptionsCell/TitleOption.vue new file mode 100644 index 0000000000..e4a935396a --- /dev/null +++ b/resources/jscomposition/system/table/cell/truncatedGroupOptionsCell/TitleOption.vue @@ -0,0 +1,48 @@ + + diff --git a/resources/jscomposition/system/table/cell/truncatedGroupOptionsCell/TruncatedGroupOptionsCell.vue b/resources/jscomposition/system/table/cell/truncatedGroupOptionsCell/TruncatedGroupOptionsCell.vue new file mode 100644 index 0000000000..98500babae --- /dev/null +++ b/resources/jscomposition/system/table/cell/truncatedGroupOptionsCell/TruncatedGroupOptionsCell.vue @@ -0,0 +1,149 @@ + +