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 b3cfc8aa..58bdbcc7 100644 --- a/media_commons_booking_app/src/client/booking/components/Calendars.tsx +++ b/media_commons_booking_app/src/client/booking/components/Calendars.tsx @@ -46,12 +46,11 @@ export const Calendars = ({ } if (bookInfo) { const isConfirmed = window.confirm( - `You are booking the following rooms: ${selectedRooms.map( + `You are requesting to book the following rooms${selectedRooms.map( (room) => `${room.roomId} ${room.name}` - )} - \nYour reserved time slot: ${formatDate( - bookInfo.startStr - )} ~ ${formatDate(bookInfo.endStr)}` + )} for the time slot ${formatDate(bookInfo.startStr)} ~ ${formatDate( + bookInfo.endStr + )}` ); if (isConfirmed) handleSetDate(bookInfo); } @@ -115,7 +114,7 @@ export const Calendars = ({ id: Date.now(), // Generate a unique ID for the event start: selectInfo.startStr, end: selectInfo.endStr, - title: `${TITLE_TAG} Reserve`, + title: `${TITLE_TAG}`, groupId: selectInfo.startStr, }); }); 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 d26c64fb..d3a72260 100644 --- a/media_commons_booking_app/src/client/booking/components/FormInput.tsx +++ b/media_commons_booking_app/src/client/booking/components/FormInput.tsx @@ -68,6 +68,8 @@ const FormInput = ({ hasEmail, roomNumber, handleParentSubmit }) => { const [agreement, setAgreement] = useState(false); const [resetRoom, setResetRoom] = useState(false); const [bookingPolicy, setBookingPolicy] = useState(false); + const [showTextbox, setShowTextbox] = useState(false); + const disabledButton = !( checklist && agreement && @@ -86,6 +88,14 @@ const FormInput = ({ hasEmail, roomNumber, handleParentSubmit }) => { }; console.log('errors', errors); + const handleSelectChange = (event) => { + if (event.target.value === 'others') { + setShowTextbox(true); + } else { + setShowTextbox(false); + } + }; + return (
{ required: true, validate: (value) => value !== '', })} + onChange={(e) => { + handleSelectChange(e); + }} > - {watch('department') === 'others' && ( + {showTextbox && ( { id="sponsorFirstName" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-[600px] p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="" - {...register('sponsorFirstName')} + {...register('sponsorFirstName', { + required: watch('role') === 'Student', + })} />
@@ -347,7 +362,9 @@ const FormInput = ({ hasEmail, roomNumber, handleParentSubmit }) => { id="sponsorLastName" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-[600px] p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="" - {...register('sponsorLastName')} + {...register('sponsorLastName', { + required: watch('role') === 'Student', + })} />
@@ -367,6 +384,7 @@ const FormInput = ({ hasEmail, roomNumber, handleParentSubmit }) => { className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-[600px] p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="" {...register('sponsorEmail', { + required: watch('role') === 'Student', pattern: { value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i, message: 'Invalid email address', @@ -522,12 +540,17 @@ const FormInput = ({ hasEmail, roomNumber, handleParentSubmit }) => { formation.

+ {errors.setupDetails && ( + + )}
)} @@ -663,8 +686,16 @@ const FormInput = ({ hasEmail, roomNumber, handleParentSubmit }) => { Catering Information

- Including catering in your event necessitates hiring CBS cleaning - services. + 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 + + .

-
- - )}
-
- -
- setAgreement(!agreement)} - className="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600" - /> - -
-