-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send email to user when status is changed
- Loading branch information
Showing
2 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ import { | |
} from './db'; | ||
import { inviteUserToCalendarEvent, updateEventPrefix } from './calendars'; | ||
|
||
import { sendHTMLEmail } from './emails'; | ||
import { sendHTMLEmail, sendTextEmail } from './emails'; | ||
|
||
export const bookingContents = (id: string) => { | ||
const values = fetchById(TableNames.BOOKING, id); | ||
|
@@ -112,6 +112,11 @@ export const approveEvent = (id: string) => { | |
id, | ||
ActiveSheetBookingStatusColumns.EMAIL | ||
); | ||
sendTextEmail( | ||
guestEmail, | ||
'Media Commons Reservation Approved', | ||
'Your reservation request for Media Commons is approved.' | ||
); | ||
|
||
updateEventPrefix(id, 'APPROVED'); | ||
inviteUserToCalendarEvent(id, guestEmail); | ||
|
@@ -125,7 +130,16 @@ export const reject = (id: string) => { | |
new Date() | ||
); | ||
|
||
//TODO: send email to user | ||
const guestEmail = getActiveSheetValueById( | ||
TableNames.BOOKING_STATUS, | ||
id, | ||
ActiveSheetBookingStatusColumns.EMAIL | ||
); | ||
sendTextEmail( | ||
guestEmail, | ||
'Media Commons Reservation Has Been Rejected', | ||
'Your reservation request for Media Commons has been rejected. For detailed reasons regarding this decision, please contact us at [email protected].' | ||
); | ||
updateEventPrefix(id, 'REJECTED'); | ||
}; | ||
|
||
|
@@ -136,6 +150,16 @@ export const cancel = (id: string) => { | |
ActiveSheetBookingStatusColumns.CANCELLED_DATE, | ||
new Date() | ||
); | ||
const guestEmail = getActiveSheetValueById( | ||
TableNames.BOOKING_STATUS, | ||
id, | ||
ActiveSheetBookingStatusColumns.EMAIL | ||
); | ||
sendTextEmail( | ||
guestEmail, | ||
'Media Commons Reservation Has Been Cancelled', | ||
'Your reservation request for Media Commons has been cancelled. For detailed reasons regarding this decision, please contact us at [email protected].' | ||
); | ||
updateEventPrefix(id, 'CANCELLED'); | ||
}; | ||
|
||
|
@@ -146,6 +170,16 @@ export const checkin = (id: string) => { | |
ActiveSheetBookingStatusColumns.CHECKED_IN_DATE, | ||
new Date() | ||
); | ||
const guestEmail = getActiveSheetValueById( | ||
TableNames.BOOKING_STATUS, | ||
id, | ||
ActiveSheetBookingStatusColumns.EMAIL | ||
); | ||
sendTextEmail( | ||
guestEmail, | ||
'Media Commons Reservation Has Been Checked In', | ||
'Your reservation request for Media Commons has been checked in. Thank you for choosing Media Commons.' | ||
); | ||
updateEventPrefix(id, 'CHECKED IN'); | ||
}; | ||
|
||
|