mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 15:25:45 +00:00
Add reject step functionality to contract approval process
- Implemented rejection handling in ContractApprovalStepsCard with a modal for rejection reasons. - Updated useContractMutations to include rejectStep mutation. - Added REJECT_STEP URL constant for API integration. - Enhanced ContractClearanceDetailPage to utilize linkedBookingId for improved booking handling.
This commit is contained in:
@@ -181,6 +181,15 @@ export function useContractMutations(contractId: string) {
|
||||
onError: () => toast.error("Failed to approve step"),
|
||||
});
|
||||
|
||||
// Per-step rejection by an approver (line staff / director / CEO). Terminal:
|
||||
// the contract goes to REJECTED and the customer must create a new one.
|
||||
const rejectStep = useMutation({
|
||||
mutationFn: ({ stepId, reason }: { stepId: string; reason: string }) =>
|
||||
contractsService.rejectStep({ id: contractId, stepId, reason }),
|
||||
onSuccess: (data) => onSuccess(data, "Contract rejected"),
|
||||
onError: () => toast.error("Failed to reject step"),
|
||||
});
|
||||
|
||||
// Manual fallback generate — used only if auto-generation failed.
|
||||
const generateContract = useMutation({
|
||||
mutationFn: () => contractsService.generateContract(contractId),
|
||||
@@ -210,6 +219,7 @@ export function useContractMutations(contractId: string) {
|
||||
requestChanges.isPending ||
|
||||
reject.isPending ||
|
||||
approveStep.isPending ||
|
||||
rejectStep.isPending ||
|
||||
generateContract.isPending ||
|
||||
signContract.isPending ||
|
||||
createBooking.isPending;
|
||||
@@ -219,6 +229,7 @@ export function useContractMutations(contractId: string) {
|
||||
requestChanges,
|
||||
reject,
|
||||
approveStep,
|
||||
rejectStep,
|
||||
generateContract,
|
||||
signContract,
|
||||
createBooking,
|
||||
|
||||
Reference in New Issue
Block a user