implement edit workflow

This commit is contained in:
Joao Correia
2025-01-25 19:45:39 +00:00
parent ac072b0a5a
commit 73610dc273
5 changed files with 175 additions and 9 deletions

View File

@@ -242,15 +242,15 @@ export default function ApprovalWorkflows({ user, workflows, workflowsAssignees,
);
},
}),
{
columnHelper.accessor("steps", {
header: "ACTIONS",
id: "actions",
cell: ({ row }: { row: { original: ApprovalWorkflow } }) => {
cell: ({ row }) => {
const steps = row.original.steps;
const currentStep = steps.find((step) => !step.completed);
return (
<div className="flex gap-4">
<Link onClick={(e) => e.stopPropagation()} data-tip="Edit" href={`/approval-workflows/${row.original.id}/edit`} className="cursor-pointer tooltip">
<FaRegEdit className="hover:text-mti-purple-light transition ease-in-out duration-300" />
</Link>
<button
data-tip="Delete"
className="cursor-pointer tooltip"
@@ -261,10 +261,21 @@ export default function ApprovalWorkflows({ user, workflows, workflowsAssignees,
>
<BsTrash className="hover:text-mti-purple-light transition ease-in-out duration-300" />
</button>
{currentStep && (
<Link
onClick={(e) => e.stopPropagation()}
data-tip="Edit"
href={`/approval-workflows/${row.original.id}/edit`}
className="cursor-pointer tooltip"
>
<FaRegEdit className="hover:text-mti-purple-light transition ease-in-out duration-300" />
</Link>
)}
</div>
);
},
},
})
];
const table = useReactTable({