From 1885ca4c147de19215b1197b83cbe036860fcde9 Mon Sep 17 00:00:00 2001 From: "riho.takagi" Date: Thu, 29 Feb 2024 12:39:30 -0500 Subject: [PATCH 1/4] for testing --- .../client/booking/components/RoomCalendar.tsx | 4 ++-- .../client/booking/components/SheetEditor.tsx | 18 ++++++++++-------- media_commons_booking_app/src/server/admin.js | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/media_commons_booking_app/src/client/booking/components/RoomCalendar.tsx b/media_commons_booking_app/src/client/booking/components/RoomCalendar.tsx index 26930666..7a375c54 100644 --- a/media_commons_booking_app/src/client/booking/components/RoomCalendar.tsx +++ b/media_commons_booking_app/src/client/booking/components/RoomCalendar.tsx @@ -21,9 +21,9 @@ export const RoomCalendar = ({ useEffect(() => { //PROD - fetchCalendarEvents(room.calendarIdProd); + //fetchCalendarEvents(room.calendarIdProd); //DEV - //fetchCalendarEvents(room.calendarId); + fetchCalendarEvents(room.calendarId); }, []); const fetchCalendarEvents = async (calendarId) => { serverFunctions.getCalendarEvents(calendarId).then((rows) => { 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 f477d487..1ceb4f4b 100644 --- a/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx +++ b/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx @@ -50,16 +50,16 @@ const SAFTY_TRAINING_SHEET_NAME = 'safety_training_users'; const INSTANT_APPROVAL_ROOMS = ['221', '222', '223', '224']; const SheetEditor = () => { - //IN PRODUCTION - const roomCalendarId = (room) => { - return findByRoomId(mappingRoomSettings, room.roomId)?.calendarIdProd; - }; - - //IN DEV + //PRODUCTION //const roomCalendarId = (room) => { - // return findByRoomId(mappingRoomSettings, room.roomId)?.calendarId; + // return findByRoomId(mappingRoomSettings, room.roomId)?.calendarIdProd; //}; + //DEV + const roomCalendarId = (room) => { + return findByRoomId(mappingRoomSettings, room.roomId)?.calendarId; + }; + const getActiveUserEmail = () => { serverFunctions.getActiveUserEmail().then((response) => { console.log('userEmail response', response); @@ -200,7 +200,9 @@ const SheetEditor = () => { [] ); const trained = emails.includes(userEmail); - setIsSafetyTrained(trained); + if (trained) { + setIsSafetyTrained(trained); + } }); } }; diff --git a/media_commons_booking_app/src/server/admin.js b/media_commons_booking_app/src/server/admin.js index 0b7751d6..ddb170f2 100644 --- a/media_commons_booking_app/src/server/admin.js +++ b/media_commons_booking_app/src/server/admin.js @@ -1,6 +1,6 @@ export const BOOKING_SHEET_NAME = 'bookings'; export const BOOKING_STATUS_SHEET_NAME = 'bookingStatus'; -const SECOND_APPROVER_EMAIL = 'ss12430@nyu.edu'; +const SECOND_APPROVER_EMAIL = 'mediacommons.reservations@nyu.edu'; const current = new Date(); From 2756771af9aa956133bc67cd2a1c49eb350e169b Mon Sep 17 00:00:00 2001 From: "riho.takagi" Date: Thu, 29 Feb 2024 12:47:41 -0500 Subject: [PATCH 2/4] Update room numbers --- .../src/client/booking/components/SheetEditor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1ceb4f4b..f0bcae80 100644 --- a/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx +++ b/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx @@ -47,7 +47,7 @@ const BASE_URL = const BOOKING_SHEET_NAME = 'bookings'; const SAFTY_TRAINING_SHEET_NAME = 'safety_training_users'; -const INSTANT_APPROVAL_ROOMS = ['221', '222', '223', '224']; +const INSTANT_APPROVAL_ROOMS = ['220', '221', '222', '223', '224', '233']; const SheetEditor = () => { //PRODUCTION From 741d129d4c5f2fa60282dbbdc218ec0fc9efb8da Mon Sep 17 00:00:00 2001 From: "riho.takagi" Date: Fri, 1 Mar 2024 15:41:26 -0500 Subject: [PATCH 3/4] Send email to user --- .../src/client/booking/components/SheetEditor.tsx | 7 ++++++- media_commons_booking_app/src/server/admin.js | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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 f0bcae80..51634d77 100644 --- a/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx +++ b/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx @@ -286,6 +286,12 @@ const SheetEditor = () => { } }); alert('Your request has been sent.'); + + serverFunctions.sendTextEmail( + email, + 'Your Request Sent to Media Commons', + 'Your reservation is not yet confirmed. The coordinator will review and finalize your reservation within a few days.' + ); setLoading(false); setSection('selectRoom'); }; @@ -301,7 +307,6 @@ const SheetEditor = () => { const sendApprovalEmail = (recipient, contents) => { var subject = 'Approval Request'; - //serverFunctions.sendTextEmail(recipient, subject, body); serverFunctions.sendHTMLEmail( 'approval_email', contents, diff --git a/media_commons_booking_app/src/server/admin.js b/media_commons_booking_app/src/server/admin.js index ddb170f2..b06cda42 100644 --- a/media_commons_booking_app/src/server/admin.js +++ b/media_commons_booking_app/src/server/admin.js @@ -118,6 +118,11 @@ export const approveEvent = (rowIndex, id) => { updateEventPrefix(id, 'APPROVED'); inviteUserToCalendarEvent(id, guestEmail); + sendTextEmail( + guestEmail, + 'Media Commons Reservation Approved', + 'Your reservation request for Media Commons is approved.' + ); }; const inviteUserToCalendarEvent = (eventId, guestEmail) => { From 305a3fb5ed4675bd780119388a568bbff48f13ea Mon Sep 17 00:00:00 2001 From: "riho.takagi" Date: Thu, 14 Mar 2024 12:30:20 -0400 Subject: [PATCH 4/4] Use production calendarId --- .../src/client/booking/components/RoomCalendar.tsx | 4 ++-- .../src/client/booking/components/SheetEditor.tsx | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/media_commons_booking_app/src/client/booking/components/RoomCalendar.tsx b/media_commons_booking_app/src/client/booking/components/RoomCalendar.tsx index 7a375c54..26930666 100644 --- a/media_commons_booking_app/src/client/booking/components/RoomCalendar.tsx +++ b/media_commons_booking_app/src/client/booking/components/RoomCalendar.tsx @@ -21,9 +21,9 @@ export const RoomCalendar = ({ useEffect(() => { //PROD - //fetchCalendarEvents(room.calendarIdProd); + fetchCalendarEvents(room.calendarIdProd); //DEV - fetchCalendarEvents(room.calendarId); + //fetchCalendarEvents(room.calendarId); }, []); const fetchCalendarEvents = async (calendarId) => { serverFunctions.getCalendarEvents(calendarId).then((rows) => { 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 51634d77..4de1181d 100644 --- a/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx +++ b/media_commons_booking_app/src/client/booking/components/SheetEditor.tsx @@ -51,15 +51,15 @@ const INSTANT_APPROVAL_ROOMS = ['220', '221', '222', '223', '224', '233']; const SheetEditor = () => { //PRODUCTION - //const roomCalendarId = (room) => { - // return findByRoomId(mappingRoomSettings, room.roomId)?.calendarIdProd; - //}; - - //DEV const roomCalendarId = (room) => { - return findByRoomId(mappingRoomSettings, room.roomId)?.calendarId; + return findByRoomId(mappingRoomSettings, room.roomId)?.calendarIdProd; }; + //DEV + //const roomCalendarId = (room) => { + // return findByRoomId(mappingRoomSettings, room.roomId)?.calendarId; + //}; + const getActiveUserEmail = () => { serverFunctions.getActiveUserEmail().then((response) => { console.log('userEmail response', response);