finish dynamci form

This commit is contained in:
MehrdadAdabi 2025-11-28 10:49:55 +03:30
parent 47ea7f34d2
commit d97c1d0fb7
4 changed files with 19 additions and 33 deletions

View File

@ -314,7 +314,7 @@ const FormField: FC<FormFieldProps> = ({
<CustomCheckbox
key={`${field.ID}-${option.value}`}
id={`${field.ID}-${option.value}`}
label={option.label}
label={option.value}
checked={Array.isArray(value) && value.includes(option.value)}
onChange={(e: boolean) =>
handleMultiSelectChange(option.value, e)
@ -357,15 +357,6 @@ const FormField: FC<FormFieldProps> = ({
{field.Description || field.Name}
</p>
);
// default:
// return (
// <CustomInput
// {...commonProps}
// type="text"
// maxLength={field.Length!}
// placeholder={field.Name}
// />
// );
}
};

View File

@ -231,7 +231,6 @@ const DynamicForm: FC<DynamicFormProps> = ({ fields, processId, stepId, workflow
updatedValues[key] = fileID.data.data;
}
}
const filterData = {
...updatedValues,
run_process: workflowId,

View File

@ -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<string, GroupedCampaign>, 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
>
<div

View File

@ -7,10 +7,11 @@ export interface CampaignProcess {
}
export interface GroupedCampaign {
stageID: number;
processId: number;
// stageID: number;
// processId: number;
category: string;
processes: CampaignProcess[];
isDone?: boolean,
}
export interface StepItems {