mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 18:48:11 +00:00
booking flow,summtion, approval, contract, mock payemnt and integration to back office, and also add permissions
This commit is contained in:
@@ -17,6 +17,14 @@ export function useBookingList(filter?: BookingListFilter, enabled = true) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useBookingListSummary(filter?: BookingListFilter, enabled = true) {
|
||||
return useQuery({
|
||||
queryKey: QUERY_KEYS.BOOKINGS.listSummary(filter),
|
||||
queryFn: () => bookingsService.getListSummary(filter),
|
||||
enabled,
|
||||
});
|
||||
}
|
||||
|
||||
export function useBookingDetail(id: string | undefined) {
|
||||
return useQuery({
|
||||
queryKey: QUERY_KEYS.BOOKINGS.byId(id ?? ""),
|
||||
@@ -103,23 +111,10 @@ export function useBookingMutations(bookingId: string) {
|
||||
onError: () => toast.error("Failed to sign contract"),
|
||||
});
|
||||
|
||||
const generatePnr = useMutation({
|
||||
mutationFn: () => api.bookings.generatePnr.call({ id: bookingId }),
|
||||
onSuccess: (data) => onSuccess(data, "PNR generated"),
|
||||
onError: () => toast.error("Failed to generate PNR"),
|
||||
});
|
||||
|
||||
const submitPaymentProof = useMutation({
|
||||
mutationFn: (file: File) =>
|
||||
bookingsService.submitPaymentProof(bookingId, file),
|
||||
onSuccess: (data) => onSuccess(data, "Payment proof uploaded"),
|
||||
onError: () => toast.error("Failed to upload payment proof"),
|
||||
});
|
||||
|
||||
const verifyPayment = useMutation({
|
||||
mutationFn: () => api.bookings.verifyPayment.call({ id: bookingId }),
|
||||
onSuccess: (data) => onSuccess(data, "Payment verified"),
|
||||
onError: () => toast.error("Failed to verify payment"),
|
||||
const payBooking = useMutation({
|
||||
mutationFn: () => api.bookings.payBooking.call({ id: bookingId }),
|
||||
onSuccess: (data) => onSuccess(data, "Payment completed"),
|
||||
onError: () => toast.error("Failed to complete payment"),
|
||||
});
|
||||
|
||||
const startTransit = useMutation({
|
||||
@@ -149,9 +144,7 @@ export function useBookingMutations(bookingId: string) {
|
||||
rejectStep.isPending ||
|
||||
generateContract.isPending ||
|
||||
signContract.isPending ||
|
||||
generatePnr.isPending ||
|
||||
submitPaymentProof.isPending ||
|
||||
verifyPayment.isPending ||
|
||||
payBooking.isPending ||
|
||||
startTransit.isPending ||
|
||||
complete.isPending ||
|
||||
cancel.isPending;
|
||||
@@ -164,15 +157,11 @@ export function useBookingMutations(bookingId: string) {
|
||||
rejectStep,
|
||||
generateContract,
|
||||
signContract,
|
||||
generatePnr,
|
||||
submitPaymentProof,
|
||||
verifyPayment,
|
||||
payBooking,
|
||||
startTransit,
|
||||
complete,
|
||||
cancel,
|
||||
isPending,
|
||||
downloadContract: () => bookingsService.downloadContract(bookingId),
|
||||
downloadPaymentLetter: () =>
|
||||
bookingsService.downloadPaymentRequestLetter(bookingId),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user