From d97c1d0fb7849792e4cf3bf082e1d156a9e94097 Mon Sep 17 00:00:00 2001 From: MehrdadAdabi <126083584+mehrdadAdabi@users.noreply.github.com> Date: Fri, 28 Nov 2025 10:49:55 +0330 Subject: [PATCH] finish dynamci form --- src/core/components/base/form-field.tsx | 11 +------ .../pages/step-form/dynamic-form.tsx | 1 - src/modules/dashboard/pages/steps/index.tsx | 29 ++++++++----------- .../dashboard/pages/steps/step.type.ts | 11 +++---- 4 files changed, 19 insertions(+), 33 deletions(-) diff --git a/src/core/components/base/form-field.tsx b/src/core/components/base/form-field.tsx index f021765..4557e83 100644 --- a/src/core/components/base/form-field.tsx +++ b/src/core/components/base/form-field.tsx @@ -314,7 +314,7 @@ const FormField: FC = ({ handleMultiSelectChange(option.value, e) @@ -357,15 +357,6 @@ const FormField: FC = ({ {field.Description || field.Name}

); - // default: - // return ( - // - // ); } }; diff --git a/src/modules/dashboard/pages/step-form/dynamic-form.tsx b/src/modules/dashboard/pages/step-form/dynamic-form.tsx index d101d34..205b067 100644 --- a/src/modules/dashboard/pages/step-form/dynamic-form.tsx +++ b/src/modules/dashboard/pages/step-form/dynamic-form.tsx @@ -231,7 +231,6 @@ const DynamicForm: FC = ({ fields, processId, stepId, workflow updatedValues[key] = fileID.data.data; } } - const filterData = { ...updatedValues, run_process: workflowId, diff --git a/src/modules/dashboard/pages/steps/index.tsx b/src/modules/dashboard/pages/steps/index.tsx index f80119f..dfc0abc 100644 --- a/src/modules/dashboard/pages/steps/index.tsx +++ b/src/modules/dashboard/pages/steps/index.tsx @@ -40,14 +40,10 @@ const StepsPage: FC = () => { score: String(row[`process${i}_score`]), stageId: String(row[`process${i}_stage_id`]), status: String(row[`process${i}_status`]), - // title: String(row[`process${i}_title`]), - // selected: false, - // groupIndex: 0, // placeholder + }); } }); - - // 2) گروه‌بندی + حذف تکراری const grouped: GroupedCampaign[] = Object.values( temp.reduce((acc: Record, item) => { if (!item?.category) return acc; @@ -56,7 +52,7 @@ const StepsPage: FC = () => { acc[item.category] = { category: item.category, processes: [], - // groupIndex: 0, + isDone: false, }; } @@ -64,23 +60,22 @@ const StepsPage: FC = () => { p => p.processId === item.processId ); + + if (!exists) { acc[item.category].processes.push(item); } + + acc[item.category].isDone = acc[item.category].processes.every( + p => p.status === 'انجام شده' + ); return acc; }, {}) ); - // 3) ست کردن groupIndex روی گروه‌ها و process های داخلش - // grouped.forEach((group, index) => { - // group.groupIndex = index; - // group.processes.forEach(proc => { - // proc.groupIndex = index; - // }); - // }); - return grouped; + return grouped }, [data]); @@ -170,10 +165,10 @@ const StepsPage: FC = () => { hover:shadow-lg hover:border-blue-300 focus-within:ring-2 focus-within:ring-blue-500 focus-within:ring-opacity-50 transition-all duration-300 ease-in-out transform - - + ${step.isDone ? 'bg-green-500 cursor-not-allowed!' : ''} + `} - onClick={() => handleStepClick(step)} + onClick={() => !step.isDone && handleStepClick(step)} tabIndex={0} // Make list item focusable >
+ category: "بخش اول" + processId: 1232 + processes: Array stageID: 18267 }