mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 13:38:20 +00:00
Merge remote-tracking branch 'origin/dev' into dj-franc
This commit is contained in:
@@ -64,6 +64,17 @@ export function useBookingMutations(bookingId: string) {
|
||||
onError: (error) => toast.error(parseApiError(error, "Failed to reject booking")),
|
||||
});
|
||||
|
||||
const rescheduleOperation = useMutation({
|
||||
mutationFn: (payload: {
|
||||
scheduledDate: string;
|
||||
trainScheduleId?: string;
|
||||
note?: string;
|
||||
}) => api.bookings.rescheduleOperation.call({ id: bookingId, ...payload }),
|
||||
onSuccess: (data) => onSuccess(data, "Shipment day updated"),
|
||||
onError: (error) =>
|
||||
toast.error(parseApiError(error, "Failed to change the shipment day")),
|
||||
});
|
||||
|
||||
const reviewOperation = useMutation({
|
||||
mutationFn: (payload: {
|
||||
decision: "ACCEPT" | "REQUEST_CHANGES";
|
||||
@@ -162,6 +173,7 @@ export function useBookingMutations(bookingId: string) {
|
||||
startTransit.isPending ||
|
||||
complete.isPending ||
|
||||
reviewOperation.isPending ||
|
||||
rescheduleOperation.isPending ||
|
||||
cancel.isPending;
|
||||
|
||||
return {
|
||||
@@ -170,6 +182,7 @@ export function useBookingMutations(bookingId: string) {
|
||||
requestChanges,
|
||||
staffReject,
|
||||
reviewOperation,
|
||||
rescheduleOperation,
|
||||
generateContract,
|
||||
signContract,
|
||||
payBooking,
|
||||
|
||||
@@ -172,6 +172,14 @@ export function useContractMutations(contractId: string) {
|
||||
onError: (error) => toast.error(extractErrorMessage(error, "Failed to lift suspension")),
|
||||
});
|
||||
|
||||
const extend = useMutation({
|
||||
mutationFn: (payload: Freight.ExtendContractDto) =>
|
||||
contractsService.extend(contractId, payload),
|
||||
onSuccess: (data) =>
|
||||
onSuccess(data, `Contract extended — it is back to ${data.status}`),
|
||||
onError: (error) => toast.error(extractErrorMessage(error, "Failed to extend contract")),
|
||||
});
|
||||
|
||||
const approveStep = useMutation({
|
||||
// The server derives the required role from the step itself, so the client
|
||||
// does not send one.
|
||||
@@ -280,6 +288,7 @@ export function useContractMutations(contractId: string) {
|
||||
cancelByStaff,
|
||||
suspend,
|
||||
resume,
|
||||
extend,
|
||||
approveStep,
|
||||
rejectStep,
|
||||
generateContract,
|
||||
|
||||
Reference in New Issue
Block a user