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

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/client/routes/components/navBar.js b/media_commons_booking_app/src/client/routes/components/navBar.js index fb5644f2..eb608810 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,15 @@ +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,31 +28,25 @@ export default function NavBar() { My Bookings - - - Admin - - - - - PA - - - - - Spaces Index - - - Garage Equipment - - - Stakeholder Matrix - - + {pagePermission === PagePermission.ADMIN && ( + + + Admin + + + )} + {(pagePermission === PagePermission.ADMIN || + pagePermission === PagePermission.PA) && ( + + + PA + + + )} 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); };