Merge remote-tracking branch 'origin/dev' into dj-franc

This commit is contained in:
ghost2023
2026-09-06 21:57:27 +03:00
149 changed files with 10387 additions and 566 deletions

View File

@@ -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,

View File

@@ -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,