From 06e8e5929716f99e7e42eabe143ee41d77aa5db7 Mon Sep 17 00:00:00 2001 From: "riho.takagi" Date: Wed, 17 Jan 2024 11:11:52 -0500 Subject: [PATCH] Change title on calendar --- .../src/client/booking/components/Calendars.tsx | 6 ++++++ .../src/client/booking/components/SheetEditor.tsx | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) 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 3bfc0ca2..e63a002d 100644 --- a/media_commons_booking_app/src/client/booking/components/Calendars.tsx +++ b/media_commons_booking_app/src/client/booking/components/Calendars.tsx @@ -221,6 +221,12 @@ export const Calendars = ({ googleCalendarApiKey={apiKey} events={{ googleCalendarId: room.calendarId }} eventDidMount={function (info) { + // Change the title status only + const match = info.event.title.match(/\[(.*?)\]/); + if (match) { + info.el.querySelector('.fc-event-title').textContent = + match[1]; + } // Change the background color of the event depending on its title if (info.event.title.includes('REQUESTED')) { info.el.style.backgroundColor = '#d60000'; diff --git a/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx b/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx index 495dda3f..ebdb9274 100644 --- a/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx +++ b/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx @@ -176,7 +176,7 @@ const SheetEditor = () => { )?.calendarId; const calendarEventId = await serverFunctions.addEventToCalendar( roomCalendarId, - `[REQUESTED] ${room.roomId} ${data.firstName} ${data.lastName} (${data.netId})`, + `[REQUESTED] ${room.roomId} ${data.department} - ${data.firstName} ${data.lastName} (${data.netId})`, 'Your reservation is not yet confirmed. The coordinator will review and finalize your reservation within a few days.', bookInfo.startStr, bookInfo.endStr, @@ -216,9 +216,7 @@ const SheetEditor = () => { }); } }); - alert( - "Your request has been sent.\n Please check the calendar to verify that your submitted event has been registered.\n If you don't see the event, please contact us." - ); + alert('Your request has been sent.'); setLoading(false); setSection('selectRoom'); });