diff --git a/media_commons_booking_app/src/client/admin-page/components/Bookings.tsx b/media_commons_booking_app/src/client/admin-page/components/Bookings.tsx index 9505d0ca..48e8d201 100644 --- a/media_commons_booking_app/src/client/admin-page/components/Bookings.tsx +++ b/media_commons_booking_app/src/client/admin-page/components/Bookings.tsx @@ -38,11 +38,12 @@ export const Bookings = () => { const [showModal, setShowModal] = useState(false); const [selectedInfo, setSelectedInfo] = useState(); const [tab, setTab] = useState('bookings'); + const [reload, setReload] = useState(false); useEffect(() => { fetchBookings(); fetchBookingStatuses(); - }, []); + }, [reload]); useEffect(() => { const mappings = bookings .map((booking, index) => { @@ -245,7 +246,7 @@ export const Bookings = () => { await serverFunctions.approveBooking( booking.calendarEventId ); - window.location.reload(); + setReload(true); }} > Second Approve @@ -258,7 +259,7 @@ export const Bookings = () => { await serverFunctions.approveBooking( booking.calendarEventId ); - window.location.reload(); + setReload(true); }} > First Approve @@ -268,7 +269,7 @@ export const Bookings = () => { className="font-medium text-blue-600 dark:text-blue-500 hover:underline mx-2" onClick={async () => { await serverFunctions.reject(booking.calendarEventId); - window.location.reload(); + setReload(true); }} > Reject @@ -277,7 +278,7 @@ export const Bookings = () => { className="font-medium text-blue-600 dark:text-blue-500 hover:underline mx-2" onClick={async () => { await serverFunctions.cancel(booking.calendarEventId); - window.location.reload(); + setReload(true); }} > Cancel @@ -289,7 +290,7 @@ export const Bookings = () => { await serverFunctions.checkin( booking.calendarEventId ); - window.location.reload(); + setReload(true); }} > Check In diff --git a/media_commons_booking_app/src/client/booking/components/Calendars.tsx b/media_commons_booking_app/src/client/booking/components/Calendars.tsx index 1a21264c..6e8a065a 100644 --- a/media_commons_booking_app/src/client/booking/components/Calendars.tsx +++ b/media_commons_booking_app/src/client/booking/components/Calendars.tsx @@ -26,15 +26,15 @@ export const Calendars = ({ handleSetDate, }: CalendarProps) => { const [enrolledThisis, setEnrolledThesis] = useState(false); - const [bookInfo, setBookInfo] = useState(); + const [bookingTimeEvent, setBookingTimeEvent] = useState(); const editableEvent = (info) => { return info.title.includes(TITLE_TAG); }; const validateEvents = (e) => { e.stopPropagation; - const overlap = isOverlap(bookInfo); - const past = bookInfo.start < new Date(); + const overlap = isOverlap(bookingTimeEvent); + const past = bookingTimeEvent.start < new Date(); if (past) { alert("You can't schedule events in the past"); return; @@ -44,15 +44,15 @@ export const Calendars = ({ alert('The new event overlaps with an existing event on the same day!'); return; } - if (bookInfo) { + if (bookingTimeEvent) { const isConfirmed = window.confirm( `You are requesting to book the following rooms${selectedRooms.map( (room) => `${room.roomId} ${room.name}` - )} for the time slot ${formatDate(bookInfo.startStr)} ~ ${formatDate( - bookInfo.endStr - )}` + )} for the time slot ${formatDate( + bookingTimeEvent.startStr + )} ~ ${formatDate(bookingTimeEvent.endStr)}` ); - if (isConfirmed) handleSetDate(bookInfo); + if (isConfirmed) handleSetDate(bookingTimeEvent); } }; @@ -88,7 +88,7 @@ export const Calendars = ({ } }); }); - setBookInfo(null); + setBookingTimeEvent(null); return; } }; @@ -102,7 +102,7 @@ export const Calendars = ({ }), [selectedRooms]; const handleDateSelect = (selectInfo) => { - if (bookInfo) { + if (bookingTimeEvent) { alert('You can only book one time slot per reservation'); return; } @@ -118,7 +118,7 @@ export const Calendars = ({ groupId: selectInfo.startStr, }); }); - setBookInfo(selectInfo); + setBookingTimeEvent(selectInfo); }; const handleChange = (selectedDate: Date) => { @@ -140,6 +140,24 @@ export const Calendars = ({ console.log('isOverlap', !isOverlap(selectInfo)); return !isOverlap(selectInfo); }; + + const syncEventLengthAcrossCalendars = (changedEvent) => { + allRooms.forEach((room) => { + const targetGroupId = changedEvent.groupId; + if (room.calendarRef.current) { + let calendarApi = room.calendarRef.current.getApi(); + const events = calendarApi.getEvents(); + events.map((event) => { + //All events are retrieved, so change only for the event retrieved this time. + if (event.groupId === targetGroupId) { + event.setStart(changedEvent.start); + event.setEnd(changedEvent.end); + } + }); + } + }); + setBookingTimeEvent(changedEvent); + }; return (
@@ -160,12 +178,12 @@ export const Calendars = ({
))} diff --git a/media_commons_booking_app/src/client/booking/components/FormInput.tsx b/media_commons_booking_app/src/client/booking/components/FormInput.tsx index fcfeb9b5..dcd81705 100644 --- a/media_commons_booking_app/src/client/booking/components/FormInput.tsx +++ b/media_commons_booking_app/src/client/booking/components/FormInput.tsx @@ -691,14 +691,6 @@ const FormInput = ({ hasEmail, roomNumber, handleParentSubmit }) => {

It is required for the reservation holder to pay and arrange for CBS cleaning services if the event includes catering. - - Please see this link for more information - - .