Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Release 04.11 #169

Merged
merged 7 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
</head>
<body>
<div id="index"></div>
<div class="container"></div>
<div class="container">
<p><?= headerMessage ?></p>
</div>
<div class="container">
<h2>Room Reservation Request</h2>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
52 changes: 25 additions & 27 deletions media_commons_booking_app/src/client/routes/components/navBar.js
Original file line number Diff line number Diff line change
@@ -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 (
<Navbar expand="md" className="bg-body-tertiary z-10">
<Container fluid>
Expand All @@ -24,31 +28,25 @@ export default function NavBar() {
My Bookings
</NavLink>
</Nav.Item>
<Nav.Item>
<NavLink
className="nav-link"
activeClassName="active"
to="/admin"
>
Admin
</NavLink>
</Nav.Item>
<Nav.Item>
<NavLink className="nav-link" activeClassName="active" to="/pa">
PA
</NavLink>
</Nav.Item>
<NavDropdown title="Resources" id="basic-nav-dropdown" align="end">
<NavDropdown.Item href="https://docs.google.com/presentation/d/1SwMhL65dR6x2BMqlcQ4GbyD1w2ydfrd3MG5XCJrsmAA/edit?authuser=0#slide=id.p">
Spaces Index
</NavDropdown.Item>
<NavDropdown.Item href="https://docs.google.com/spreadsheets/d/1fziyVrzeytQJyZ8585Wtqxer-PBt6L-u-Z0LHVavK5k/edit?usp=sharing&authuser=0">
Garage Equipment
</NavDropdown.Item>
<NavDropdown.Item href="https://drive.google.com/a/nyu.edu/open?id=10D5aFildkZHi1fyVrXcPXPsvXGZDBTGPitputVkjZsk&authuser=0">
Stakeholder Matrix
</NavDropdown.Item>
</NavDropdown>
{pagePermission === PagePermission.ADMIN && (
<Nav.Item>
<NavLink
className="nav-link"
activeClassName="active"
to="/admin"
>
Admin
</NavLink>
</Nav.Item>
)}
{(pagePermission === PagePermission.ADMIN ||
pagePermission === PagePermission.PA) && (
<Nav.Item>
<NavLink className="nav-link" activeClassName="active" to="/pa">
PA
</NavLink>
</Nav.Item>
)}
</Nav>
</Navbar.Collapse>
</Container>
Expand Down
30 changes: 24 additions & 6 deletions media_commons_booking_app/src/server/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
};

Expand All @@ -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...');
Expand All @@ -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);
Expand Down Expand Up @@ -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);
};

Expand Down Expand Up @@ -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);
};

Expand Down
Loading