Booking tools
This commit is contained in:
@@ -210,7 +210,7 @@ interface BookingSlotBlockProps {
|
||||
}
|
||||
|
||||
function BookingSlotBlock({ segment, schedule, rangeStart, totalMinutes }: BookingSlotBlockProps) {
|
||||
const { openCreateBooking, updateBookingStatus } = useBooking();
|
||||
const { openCreateBooking, updateBookingStatus, openBookingTools } = useBooking();
|
||||
const left = ((segment.startMinutes - rangeStart) / totalMinutes) * 100;
|
||||
const width = ((segment.endMinutes - segment.startMinutes) / totalMinutes) * 100;
|
||||
const isFree = segment.status === 'free';
|
||||
@@ -225,13 +225,16 @@ function BookingSlotBlock({ segment, schedule, rangeStart, totalMinutes }: Booki
|
||||
segment.status === 'reserved' &&
|
||||
'border-reserved/70 bg-reserved/80 text-reserved-foreground',
|
||||
segment.status === 'maintenance' &&
|
||||
'border-maintenance/80 bg-maintenance/75 text-maintenance-foreground'
|
||||
'border-maintenance/80 bg-maintenance/75 text-maintenance-foreground',
|
||||
segment.booking?.status === 'COMPLETED' &&
|
||||
'border-reserved/70 bg-reserved/25 dark:text-reserved-foreground text-gray-600 line-through',
|
||||
|
||||
)}
|
||||
style={{
|
||||
left: `calc(${left}% + 4px)`,
|
||||
width: `calc(${width}% - 8px)`,
|
||||
}}
|
||||
onClick={() => {
|
||||
onClick={(event) => {
|
||||
if (isFree) {
|
||||
openCreateBooking({
|
||||
courtId: schedule.court.id,
|
||||
@@ -239,13 +242,11 @@ function BookingSlotBlock({ segment, schedule, rangeStart, totalMinutes }: Booki
|
||||
sportId: schedule.court.sportId,
|
||||
});
|
||||
} else {
|
||||
//console.log(JSON.stringify(segment, null, 2));
|
||||
setPopoverOpen(true);
|
||||
}
|
||||
}}
|
||||
onDoubleClick={() => {
|
||||
if (segment.booking?.status === 'CONFIRMED') {
|
||||
updateBookingStatus(segment.booking.id, 'COMPLETED');
|
||||
if(event.shiftKey && segment.booking?.status === 'CONFIRMED') {
|
||||
updateBookingStatus(segment.booking.id, 'COMPLETED');
|
||||
} else {
|
||||
openBookingTools(segment);
|
||||
}
|
||||
}
|
||||
}}
|
||||
title={
|
||||
|
||||
Reference in New Issue
Block a user