Close dialog on status change
This commit is contained in:
@@ -255,7 +255,10 @@ export function BookingProvider({ children, complex }: BookingProviderProps) {
|
||||
[bookingsQuery.data?.bookings, selectedDate]
|
||||
);
|
||||
|
||||
const courts = useMemo(() => courtsQuery.data?.sort((a, b) => a.name.localeCompare(b.name)) ?? [], [courtsQuery.data]);
|
||||
const courts = useMemo(
|
||||
() => courtsQuery.data?.sort((a, b) => a.name.localeCompare(b.name)) ?? [],
|
||||
[courtsQuery.data]
|
||||
);
|
||||
|
||||
const filteredCourts = useMemo(() => {
|
||||
if (selectedSportId === 'all') return courts;
|
||||
@@ -293,7 +296,6 @@ export function BookingProvider({ children, complex }: BookingProviderProps) {
|
||||
}, []);
|
||||
|
||||
const currentTime = useMemo(() => {
|
||||
|
||||
if (!isTodayIso(selectedDate)) return null;
|
||||
const nowMinutes = timeToMinutes(now);
|
||||
const start = timeToMinutes(visibleTimeRange.start);
|
||||
@@ -345,10 +347,12 @@ export function BookingProvider({ children, complex }: BookingProviderProps) {
|
||||
(segment?: BookingTimelineSegment) => {
|
||||
setSelectedSegment(segment ?? null);
|
||||
setBookingToolsOpen(true);
|
||||
console.log(JSON.stringify(segment, null, 2))
|
||||
}, [selectedDate]);
|
||||
console.log(JSON.stringify(segment, null, 2));
|
||||
},
|
||||
[selectedDate]
|
||||
);
|
||||
|
||||
const closeBookingTools = () => setBookingToolsOpen(false)
|
||||
const closeBookingTools = () => setBookingToolsOpen(false);
|
||||
|
||||
useEffect(() => {
|
||||
const handleOpenCreateBooking = () => {
|
||||
@@ -426,9 +430,9 @@ export function BookingProvider({ children, complex }: BookingProviderProps) {
|
||||
errorMessage:
|
||||
courtsQuery.isError || bookingsQuery.isError
|
||||
? extractMessage(
|
||||
courtsQuery.error ?? bookingsQuery.error,
|
||||
'No pudimos cargar el panel de reservas.'
|
||||
)
|
||||
courtsQuery.error ?? bookingsQuery.error,
|
||||
'No pudimos cargar el panel de reservas.'
|
||||
)
|
||||
: null,
|
||||
isCreateBookingOpen,
|
||||
createBookingError: createBookingMutation.isError
|
||||
@@ -449,7 +453,7 @@ export function BookingProvider({ children, complex }: BookingProviderProps) {
|
||||
bookingToolsOpen,
|
||||
openBookingTools,
|
||||
closeBookingTools,
|
||||
selectedSegment
|
||||
selectedSegment,
|
||||
}),
|
||||
[
|
||||
bookings,
|
||||
@@ -480,7 +484,7 @@ export function BookingProvider({ children, complex }: BookingProviderProps) {
|
||||
updateBookingStatus,
|
||||
viewMode,
|
||||
visibleTimeRange,
|
||||
bookingToolsOpen
|
||||
bookingToolsOpen,
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user