From 0ed89e649d70910d15edb07eecc8f588874e120b Mon Sep 17 00:00:00 2001 From: lucia <51058748+lucia-gomez@users.noreply.github.com> Date: Sat, 6 Apr 2024 14:45:21 -0400 Subject: [PATCH 1/4] hide nav bar links based on permissions --- .../src/client/routes/components/navBar.js | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/media_commons_booking_app/src/client/routes/components/navBar.js b/media_commons_booking_app/src/client/routes/components/navBar.js index fb5644f2..4f111c17 100644 --- a/media_commons_booking_app/src/client/routes/components/navBar.js +++ b/media_commons_booking_app/src/client/routes/components/navBar.js @@ -1,11 +1,16 @@ +import React, { useContext } from 'react'; + import Container from 'react-bootstrap/Container'; +import { DatabaseContext } from './Provider'; import Nav from 'react-bootstrap/Nav'; import NavDropdown from 'react-bootstrap/NavDropdown'; import { NavLink } from 'react-router-dom'; import Navbar from 'react-bootstrap/Navbar'; -import React from 'react'; +import { PagePermission } from '../../../types'; export default function NavBar() { + const { pagePermission } = useContext(DatabaseContext); + return ( @@ -24,20 +29,25 @@ export default function NavBar() { My Bookings - - - Admin - - - - - PA - - + {pagePermission === PagePermission.ADMIN && ( + + + Admin + + + )} + {(pagePermission === PagePermission.ADMIN || + pagePermission === PagePermission.PA) && ( + + + PA + + + )} Spaces Index From 4e1adc3ae9be27f1038d77fe52f8278c1ec419bf Mon Sep 17 00:00:00 2001 From: lucia <51058748+lucia-gomez@users.noreply.github.com> Date: Sat, 6 Apr 2024 14:46:32 -0400 Subject: [PATCH 2/4] delete navbar resources dropdown --- .../src/client/routes/components/navBar.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/media_commons_booking_app/src/client/routes/components/navBar.js b/media_commons_booking_app/src/client/routes/components/navBar.js index 4f111c17..eb608810 100644 --- a/media_commons_booking_app/src/client/routes/components/navBar.js +++ b/media_commons_booking_app/src/client/routes/components/navBar.js @@ -3,7 +3,6 @@ import React, { useContext } from 'react'; import Container from 'react-bootstrap/Container'; import { DatabaseContext } from './Provider'; import Nav from 'react-bootstrap/Nav'; -import NavDropdown from 'react-bootstrap/NavDropdown'; import { NavLink } from 'react-router-dom'; import Navbar from 'react-bootstrap/Navbar'; import { PagePermission } from '../../../types'; @@ -48,17 +47,6 @@ export default function NavBar() { )} - - - Spaces Index - - - Garage Equipment - - - Stakeholder Matrix - - From 35605b8bc31a626b80deb16652a49b39f074bd4d Mon Sep 17 00:00:00 2001 From: "riho.takagi" Date: Thu, 11 Apr 2024 10:14:01 -0400 Subject: [PATCH 3/4] update email header message --- .../routes/booking/hooks/useSubmitBooking.tsx | 1 + media_commons_booking_app/src/server/admin.ts | 30 +++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/media_commons_booking_app/src/client/routes/booking/hooks/useSubmitBooking.tsx b/media_commons_booking_app/src/client/routes/booking/hooks/useSubmitBooking.tsx index 28208d8f..15d0a205 100644 --- a/media_commons_booking_app/src/client/routes/booking/hooks/useSubmitBooking.tsx +++ b/media_commons_booking_app/src/client/routes/booking/hooks/useSubmitBooking.tsx @@ -151,6 +151,7 @@ export default function useSubmitBooking(): [ endDate: bookingCalendarInfo?.endStr, approvalUrl: values[0], rejectedUrl: values[1], + headerMessage: 'This is a request email for first approval.', ...data, }; sendApprovalEmail(firstApprovers, userEventInputs); diff --git a/media_commons_booking_app/src/server/admin.ts b/media_commons_booking_app/src/server/admin.ts index 6b8c2b8f..33b7356a 100644 --- a/media_commons_booking_app/src/server/admin.ts +++ b/media_commons_booking_app/src/server/admin.ts @@ -65,10 +65,14 @@ export const approveBooking = (id: string) => { updateEventPrefix(id, BookingStatusLabel.PRE_APPROVED); const contents = bookingContents(id); + const emailContents = { + headerMessage: 'This is a request email for final approval.', + ...contents, + }; const recipient = getSecondApproverEmail(process.env.BRANCH_NAME); sendHTMLEmail( 'approval_email', - contents, + emailContents, recipient, BookingStatusLabel.PRE_APPROVED, contents.title, @@ -79,10 +83,10 @@ export const approveBooking = (id: string) => { export const sendConfirmationEmail = ( calendarEventId: string, - status: BookingStatusLabel + status: BookingStatusLabel, + headerMessage ) => { const email = getSecondApproverEmail(process.env.BRANCH_NAME); - const headerMessage = 'This is a confirmation email.'; sendBookingDetailEmail(calendarEventId, email, headerMessage, status); }; @@ -104,6 +108,7 @@ export const approveEvent = (id: string) => { ActiveSheetBookingStatusColumns.EMAIL ); + // for user const headerMessage = 'Your reservation request for Media Commons is approved.'; console.log('sending booking detail email...'); @@ -113,7 +118,12 @@ export const approveEvent = (id: string) => { headerMessage, BookingStatusLabel.APPROVED ); - sendConfirmationEmail(id, BookingStatusLabel.APPROVED); + // for second approver + sendConfirmationEmail( + id, + BookingStatusLabel.APPROVED, + `This is a confirmation email.` + ); updateEventPrefix(id, BookingStatusLabel.APPROVED); inviteUserToCalendarEvent(id, guestEmail); @@ -163,7 +173,11 @@ export const cancel = (id: string) => { headerMessage, BookingStatusLabel.CANCELED ); - sendConfirmationEmail(id, BookingStatusLabel.CANCELED); + sendConfirmationEmail( + id, + BookingStatusLabel.CANCELED, + `This is a cancelation email.` + ); updateEventPrefix(id, BookingStatusLabel.CANCELED); }; @@ -212,7 +226,11 @@ export const noShow = (id: string) => { headerMessage, BookingStatusLabel.NO_SHOW ); - sendConfirmationEmail(id, BookingStatusLabel.NO_SHOW); + sendConfirmationEmail( + id, + BookingStatusLabel.NO_SHOW, + `This is a no show email.` + ); updateEventPrefix(id, BookingStatusLabel.NO_SHOW); }; From 86726825ec072ee64b306c0f2270f8ce9a825442 Mon Sep 17 00:00:00 2001 From: "riho.takagi" Date: Thu, 11 Apr 2024 10:38:01 -0400 Subject: [PATCH 4/4] Add header message to a approval email template --- .../src/client/routes/booking/approval_email.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/media_commons_booking_app/src/client/routes/booking/approval_email.html b/media_commons_booking_app/src/client/routes/booking/approval_email.html index 625466f1..ee0d0806 100644 --- a/media_commons_booking_app/src/client/routes/booking/approval_email.html +++ b/media_commons_booking_app/src/client/routes/booking/approval_email.html @@ -58,7 +58,9 @@
-
+
+

+

Room Reservation Request