mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 05:18:11 +00:00
Seats holding, booking, blocking inconsistencies resolution
This commit is contained in:
@@ -87,7 +87,8 @@ export default function SeatsPage() {
|
||||
};
|
||||
|
||||
const blockMutation = useMutation({
|
||||
mutationFn: ({ seatId, reason }: any) => seatsApi.block(seatId, { reason }),
|
||||
mutationFn: ({ seatId, reason }: any) =>
|
||||
seatsApi.block(seatId, { reason, ...(activeTab === 'schedule' && selectedSchedule ? { scheduleId: selectedSchedule } : {}) }),
|
||||
onSuccess: () => {
|
||||
invalidateSeatData();
|
||||
setShowBlockModal(false);
|
||||
@@ -97,7 +98,8 @@ export default function SeatsPage() {
|
||||
});
|
||||
|
||||
const unblockMutation = useMutation({
|
||||
mutationFn: (seatId: string) => seatsApi.unblock(seatId),
|
||||
mutationFn: (seatId: string) =>
|
||||
seatsApi.unblock(seatId, activeTab === 'schedule' ? selectedSchedule : undefined),
|
||||
onSuccess: () => {
|
||||
invalidateSeatData();
|
||||
},
|
||||
@@ -143,7 +145,8 @@ export default function SeatsPage() {
|
||||
mutationFn: async ({ coachId, reason }: any) => {
|
||||
const coachSeats = coaches.find((c: any) => c.id === coachId)?.seats || [];
|
||||
const seatIds = coachSeats.map((s: any) => s.id).filter((id: any) => id);
|
||||
return Promise.all(seatIds.map((seatId: string) => seatsApi.block(seatId, { reason })));
|
||||
const scheduleId = activeTab === 'schedule' ? selectedSchedule : undefined;
|
||||
return Promise.all(seatIds.map((seatId: string) => seatsApi.block(seatId, { reason, ...(scheduleId ? { scheduleId } : {}) })));
|
||||
},
|
||||
onSuccess: () => {
|
||||
invalidateSeatData();
|
||||
@@ -157,7 +160,8 @@ export default function SeatsPage() {
|
||||
mutationFn: async ({ coachId }: any) => {
|
||||
const coachSeats = coaches.find((c: any) => c.id === coachId)?.seats || [];
|
||||
const seatIds = coachSeats.map((s: any) => s.id).filter((id: any) => id);
|
||||
return Promise.all(seatIds.map((seatId: string) => seatsApi.unblock(seatId)));
|
||||
const scheduleId = activeTab === 'schedule' ? selectedSchedule : undefined;
|
||||
return Promise.all(seatIds.map((seatId: string) => seatsApi.unblock(seatId, scheduleId)));
|
||||
},
|
||||
onSuccess: () => {
|
||||
invalidateSeatData();
|
||||
|
||||
@@ -154,7 +154,7 @@ export const seatsApi = {
|
||||
hold: (data: any) => apiClient.post<any>('/seats/hold', data),
|
||||
release: (holdId: string) => apiClient.delete(`/seats/hold/${holdId}`),
|
||||
block: (seatId: string, data: any) => apiClient.post<any>(`/seats/${seatId}/block`, data),
|
||||
unblock: (seatId: string) => apiClient.delete(`/seats/${seatId}/block`),
|
||||
unblock: (seatId: string, scheduleId?: string) => apiClient.delete(`/seats/${seatId}/block${scheduleId ? `?scheduleId=${scheduleId}` : ''}`),
|
||||
removeSeat: (seatId: string) => apiClient.patch<any>(`/seats/${seatId}/remove`, {}),
|
||||
undoRemove: (seatId: string) => apiClient.patch<any>(`/seats/${seatId}/undo-remove`, {}),
|
||||
setMaintenance: (seatId: string, reason: string) => apiClient.post<any>(`/seats/${seatId}/maintenance`, { reason }),
|
||||
|
||||
Reference in New Issue
Block a user