From 93b1134d8c4343e0922a8073acc1466c0c400d88 Mon Sep 17 00:00:00 2001
From: Tristan Slater <1631008+trslater@users.noreply.github.com>
Date: Mon, 9 Sep 2024 12:44:48 -0700
Subject: [PATCH 1/5] Conver to plain HTML email templates with bare-bones
templates
---
.../application-submission.controller.ts | 4 +-
.../application/application.controller.ts | 4 +-
.../notice-of-intent.controller.ts | 4 +-
...pplication-submission-review.controller.ts | 20 +-
.../application-submission.controller.ts | 32 ++-
...tice-of-intent-submission-draft.service.ts | 4 +-
.../notice-of-intent-submission.controller.ts | 10 +-
.../notification-submission.service.ts | 7 +-
.../providers/email/status-email.service.ts | 12 +-
.../decision-emails.consumer.ts | 12 +-
.../status-emails/status-emails.consumer.ts | 12 +-
.../decision-emails.consumer.ts | 4 +-
.../email-template.service.spec.ts | 22 ---
.../email-template.service.ts | 24 ---
.../emails/cancelled/application.template.ts | 56 ++----
services/templates/emails/cancelled/index.ts | 2 -
.../cancelled/notice-of-intent.template.ts | 56 ++----
.../decision-released/application.template.ts | 93 +++------
.../emails/decision-released/index.ts | 2 -
.../notice-of-intent.template.ts | 93 +++------
services/templates/emails/index.ts | 13 ++
.../notifications/srw-notice.template.ts | 115 +++--------
.../emails/partials/footer.template.ts | 20 +-
.../emails/partials/header.template.ts | 33 ++--
services/templates/emails/partials/index.ts | 4 -
.../partials/notification-only.template.ts | 6 +-
.../emails/partials/portal-button.template.ts | 17 +-
.../emails/refused-to-forward.template.ts | 64 ++----
.../return-to-lfng/application.template.ts | 56 ++----
.../templates/emails/return-to-lfng/index.ts | 1 -
.../emails/returned-as-incomplete.template.ts | 64 ++----
.../submitted-to-alc/application.template.ts | 182 ++++++++----------
.../cove-applicant.template.ts | 72 ++-----
.../emails/submitted-to-alc/index.ts | 5 -
.../no-review-government.template.ts | 56 ++----
.../noi-applicant.template.ts | 168 +++++++---------
.../noi-government.template.ts | 56 ++----
.../tur-applicant.template.ts | 158 ++++++---------
.../submitted-to-lfng/applicant.template.ts | 102 ++++------
.../submitted-to-lfng/government.template.ts | 87 +++------
.../emails/submitted-to-lfng/index.ts | 2 -
.../emails/under-review-by-alc.template.ts | 60 ++----
.../emails/under-review-by-lfng.template.ts | 64 ++----
.../templates/emails/wrong-lfng.template.ts | 60 ++----
44 files changed, 611 insertions(+), 1327 deletions(-)
delete mode 100644 services/libs/common/src/email-template-service/email-template.service.spec.ts
delete mode 100644 services/libs/common/src/email-template-service/email-template.service.ts
delete mode 100644 services/templates/emails/cancelled/index.ts
delete mode 100644 services/templates/emails/decision-released/index.ts
create mode 100644 services/templates/emails/index.ts
delete mode 100644 services/templates/emails/partials/index.ts
delete mode 100644 services/templates/emails/return-to-lfng/index.ts
delete mode 100644 services/templates/emails/submitted-to-alc/index.ts
delete mode 100644 services/templates/emails/submitted-to-lfng/index.ts
diff --git a/services/apps/alcs/src/alcs/application/application-submission/application-submission.controller.ts b/services/apps/alcs/src/alcs/application/application-submission/application-submission.controller.ts
index 0446e4a990..7030acd9e2 100644
--- a/services/apps/alcs/src/alcs/application/application-submission/application-submission.controller.ts
+++ b/services/apps/alcs/src/alcs/application/application-submission/application-submission.controller.ts
@@ -12,7 +12,7 @@ import { Mapper } from 'automapper-core';
import { InjectMapper } from 'automapper-nestjs';
import * as config from 'config';
import { ServiceValidationException } from '../../../../../../libs/common/src/exceptions/base.exception';
-import { generateINCGApplicationHtml } from '../../../../../../templates/emails/return-to-lfng';
+import { template } from '../../../../../../templates/emails/return-to-lfng/application.template';
import { ANY_AUTH_ROLE } from '../../../common/authorization/roles';
import { RolesGuard } from '../../../common/authorization/roles-guard.service';
import { UserRoles } from '../../../common/authorization/roles.decorator';
@@ -144,7 +144,7 @@ export class ApplicationSubmissionController {
//Send Email
if (primaryContact && submissionGovernment) {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateINCGApplicationHtml,
+ template,
status: SUBMISSION_STATUS.RETURNED_TO_LG,
applicationSubmission: submission,
government: submissionGovernment,
diff --git a/services/apps/alcs/src/alcs/application/application.controller.ts b/services/apps/alcs/src/alcs/application/application.controller.ts
index f66ee885ab..b585714c46 100644
--- a/services/apps/alcs/src/alcs/application/application.controller.ts
+++ b/services/apps/alcs/src/alcs/application/application.controller.ts
@@ -18,7 +18,7 @@ import {
} from '@nestjs/common';
import { ApiOAuth2 } from '@nestjs/swagger';
import * as config from 'config';
-import { generateCANCApplicationHtml } from '../../../../../templates/emails/cancelled';
+import { template } from '../../../../../templates/emails/cancelled/application.template';
import { ROLES_ALLOWED_APPLICATIONS } from '../../common/authorization/roles';
import { RolesGuard } from '../../common/authorization/roles-guard.service';
import { UserRoles } from '../../common/authorization/roles.decorator';
@@ -144,7 +144,7 @@ export class ApplicationController {
SUBMISSION_STATUS.IN_PROGRESS
) {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateCANCApplicationHtml,
+ template,
status: SUBMISSION_STATUS.CANCELLED,
applicationSubmission,
government: submissionGovernment,
diff --git a/services/apps/alcs/src/alcs/notice-of-intent/notice-of-intent.controller.ts b/services/apps/alcs/src/alcs/notice-of-intent/notice-of-intent.controller.ts
index 4a58d4afcc..daae6fd1fa 100644
--- a/services/apps/alcs/src/alcs/notice-of-intent/notice-of-intent.controller.ts
+++ b/services/apps/alcs/src/alcs/notice-of-intent/notice-of-intent.controller.ts
@@ -11,7 +11,7 @@ import { ApiOAuth2 } from '@nestjs/swagger';
import { Mapper } from 'automapper-core';
import { InjectMapper } from 'automapper-nestjs';
import * as config from 'config';
-import { generateCANCNoticeOfIntentHtml } from '../../../../../templates/emails/cancelled';
+import { template } from '../../../../../templates/emails/cancelled/notice-of-intent.template';
import {
ROLES_ALLOWED_APPLICATIONS,
ROLES_ALLOWED_BOARDS,
@@ -111,7 +111,7 @@ export class NoticeOfIntentController {
NOI_SUBMISSION_STATUS.IN_PROGRESS
) {
await this.statusEmailService.sendNoticeOfIntentStatusEmail({
- generateStatusHtml: generateCANCNoticeOfIntentHtml,
+ template,
status: NOI_SUBMISSION_STATUS.CANCELLED,
noticeOfIntentSubmission,
government: submissionGovernment,
diff --git a/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.ts b/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.ts
index 58d59eaf81..7ff8eb4615 100644
--- a/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.ts
+++ b/services/apps/alcs/src/portal/application-submission-review/application-submission-review.controller.ts
@@ -12,11 +12,11 @@ import {
Req,
UseGuards,
} from '@nestjs/common';
-import { generateRFFGHtml } from '../../../../../templates/emails/refused-to-forward.template';
-import { generateINCMHtml } from '../../../../../templates/emails/returned-as-incomplete.template';
-import { generateSUBMApplicationHtml } from '../../../../../templates/emails/submitted-to-alc';
-import { generateREVGHtml } from '../../../../../templates/emails/under-review-by-lfng.template';
-import { generateWRNGHtml } from '../../../../../templates/emails/wrong-lfng.template';
+import { template as rffgTemplate } from '../../../../../templates/emails/refused-to-forward.template';
+import { template as incmTemplate } from '../../../../../templates/emails/returned-as-incomplete.template';
+import { template as submApplicationTemplate } from '../../../../../templates/emails/submitted-to-alc/application.template';
+import { template as revgTemplate } from '../../../../../templates/emails/under-review-by-lfng.template';
+import { template as wrngTemplate } from '../../../../../templates/emails/wrong-lfng.template';
import { ApplicationDocumentService } from '../../alcs/application/application-document/application-document.service';
import { ApplicationSubmissionStatusService } from '../../alcs/application/application-submission-status/application-submission-status.service';
import { SUBMISSION_STATUS } from '../../alcs/application/application-submission-status/submission-status.dto';
@@ -193,7 +193,7 @@ export class ApplicationSubmissionReviewController {
if (primaryContact) {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateREVGHtml,
+ template: revgTemplate,
status: SUBMISSION_STATUS.IN_REVIEW_BY_LG,
applicationSubmission,
government: userLocalGovernment,
@@ -302,7 +302,7 @@ export class ApplicationSubmissionReviewController {
if (primaryContact) {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateSUBMApplicationHtml,
+ template: submApplicationTemplate,
status: SUBMISSION_STATUS.SUBMITTED_TO_ALC,
applicationSubmission: submission,
government: userLocalGovernment,
@@ -320,7 +320,7 @@ export class ApplicationSubmissionReviewController {
if (primaryContact) {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateRFFGHtml,
+ template: rffgTemplate,
status: SUBMISSION_STATUS.REFUSED_TO_FORWARD_LG,
applicationSubmission: submission,
government: userLocalGovernment,
@@ -412,7 +412,7 @@ export class ApplicationSubmissionReviewController {
if (primaryContact) {
if (returnDto.reasonForReturn === 'wrongGovernment') {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateWRNGHtml,
+ template: wrngTemplate,
status: SUBMISSION_STATUS.WRONG_GOV,
applicationSubmission,
government: userLocalGovernment,
@@ -424,7 +424,7 @@ export class ApplicationSubmissionReviewController {
if (returnDto.reasonForReturn === 'incomplete') {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateINCMHtml,
+ template: incmTemplate,
status: SUBMISSION_STATUS.INCOMPLETE,
applicationSubmission,
government: userLocalGovernment,
diff --git a/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts b/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts
index 72cb299ad6..08b1bc3c1d 100644
--- a/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts
+++ b/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts
@@ -14,16 +14,12 @@ import {
BaseServiceException,
ServiceValidationException,
} from '../../../../../libs/common/src/exceptions/base.exception';
-import { generateCANCApplicationHtml } from '../../../../../templates/emails/cancelled';
-import {
- generateSUBGNoReviewGovernmentTemplateEmail,
- generateSUBGTurApplicantHtml,
-} from '../../../../../templates/emails/submitted-to-alc';
-import { generateSUBGCoveApplicantHtml } from '../../../../../templates/emails/submitted-to-alc/cove-applicant.template';
-import {
- generateSUBGApplicantHtml,
- generateSUBGGovernmentHtml,
-} from '../../../../../templates/emails/submitted-to-lfng';
+import { template as cancApplicationTemplate } from '../../../../../templates/emails/cancelled/application.template';
+import { template as subgNoReviewGovernmentTemplate } from '../../../../../templates/emails/submitted-to-alc/no-review-government.template';
+import { template as subgTurApplicantTemplate } from '../../../../../templates/emails/submitted-to-alc/tur-applicant.template';
+import { template as subgCoveApplicantTemplate } from '../../../../../templates/emails/submitted-to-alc/cove-applicant.template';
+import { template as subgApplicantTemplate } from '../../../../../templates/emails/submitted-to-lfng/applicant.template';
+import { template as subgGovernmentTemplate } from '../../../../../templates/emails/submitted-to-lfng/government.template';
import { SUBMISSION_STATUS } from '../../alcs/application/application-submission-status/submission-status.dto';
import { ApplicationService } from '../../alcs/application/application.service';
import { PARENT_TYPE } from '../../alcs/card/card-subtask/card-subtask.dto';
@@ -224,7 +220,7 @@ export class ApplicationSubmissionController {
application.status.statusTypeCode !== SUBMISSION_STATUS.IN_PROGRESS
) {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateCANCApplicationHtml,
+ template: cancApplicationTemplate,
status: SUBMISSION_STATUS.CANCELLED,
applicationSubmission: application,
government: submissionGovernment,
@@ -291,7 +287,7 @@ export class ApplicationSubmissionController {
if (matchingType.requiresGovernmentReview) {
if (primaryContact) {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateSUBGApplicantHtml,
+ template: subgApplicantTemplate,
status: SUBMISSION_STATUS.SUBMITTED_TO_LG,
applicationSubmission: validatedSubmission,
government: submissionGovernment,
@@ -303,7 +299,7 @@ export class ApplicationSubmissionController {
if (submissionGovernment) {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateSUBGGovernmentHtml,
+ template: subgGovernmentTemplate,
status: SUBMISSION_STATUS.SUBMITTED_TO_LG,
applicationSubmission: validatedSubmission,
government: submissionGovernment,
@@ -326,13 +322,13 @@ export class ApplicationSubmissionController {
matchingType.code === APPLICATION_SUBMISSION_TYPES.TURP ||
matchingType.code === APPLICATION_SUBMISSION_TYPES.COVE
) {
- const generateTemplateFunction =
+ const template =
matchingType.code === APPLICATION_SUBMISSION_TYPES.TURP
- ? generateSUBGTurApplicantHtml
- : generateSUBGCoveApplicantHtml;
+ ? subgTurApplicantTemplate
+ : subgCoveApplicantTemplate;
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateTemplateFunction,
+ template: template,
status: SUBMISSION_STATUS.SUBMITTED_TO_ALC,
applicationSubmission: validatedSubmission,
government: submissionGovernment,
@@ -344,7 +340,7 @@ export class ApplicationSubmissionController {
if (submissionGovernment) {
await this.statusEmailService.sendApplicationStatusEmail({
- generateStatusHtml: generateSUBGNoReviewGovernmentTemplateEmail,
+ template: subgNoReviewGovernmentTemplate,
status: SUBMISSION_STATUS.SUBMITTED_TO_ALC,
applicationSubmission: validatedSubmission,
government: submissionGovernment,
diff --git a/services/apps/alcs/src/portal/notice-of-intent-submission-draft/notice-of-intent-submission-draft.service.ts b/services/apps/alcs/src/portal/notice-of-intent-submission-draft/notice-of-intent-submission-draft.service.ts
index 1c08aa6ba4..d53bf59f5b 100644
--- a/services/apps/alcs/src/portal/notice-of-intent-submission-draft/notice-of-intent-submission-draft.service.ts
+++ b/services/apps/alcs/src/portal/notice-of-intent-submission-draft/notice-of-intent-submission-draft.service.ts
@@ -2,7 +2,7 @@ import { BaseServiceException } from '@app/common/exceptions/base.exception';
import { BadRequestException, Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
-import { generateSUBMNoiGovernmentHtml } from '../../../../../templates/emails/submitted-to-alc/noi-government.template';
+import { template } from '../../../../../templates/emails/submitted-to-alc/noi-government.template';
import { PARENT_TYPE } from '../../alcs/card/card-subtask/card-subtask.dto';
import { LocalGovernmentService } from '../../alcs/local-government/local-government.service';
import { NOI_SUBMISSION_STATUS } from '../../alcs/notice-of-intent/notice-of-intent-submission-status/notice-of-intent-status.dto';
@@ -250,7 +250,7 @@ export class NoticeOfIntentSubmissionDraftService {
if (submissionGovernment) {
await this.statusEmailService.sendNoticeOfIntentStatusEmail({
- generateStatusHtml: generateSUBMNoiGovernmentHtml,
+ template,
status: NOI_SUBMISSION_STATUS.SUBMITTED_TO_ALC,
noticeOfIntentSubmission: savedDraft,
government: submissionGovernment,
diff --git a/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.ts b/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.ts
index 74e4b68215..35aad3bd91 100644
--- a/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.ts
+++ b/services/apps/alcs/src/portal/notice-of-intent-submission/notice-of-intent-submission.controller.ts
@@ -10,10 +10,8 @@ import {
Req,
UseGuards,
} from '@nestjs/common';
-import {
- generateSUBMNoiApplicantHtml,
- generateSUBMNoiGovernmentHtml,
-} from '../../../../../templates/emails/submitted-to-alc';
+import { template as submNoiApplicantTemplate } from '../../../../../templates/emails/submitted-to-alc/noi-applicant.template';
+import { template as submNoiGovernmentTemplate } from '../../../../../templates/emails/submitted-to-alc/noi-government.template';
import { PARENT_TYPE } from '../../alcs/card/card-subtask/card-subtask.dto';
import { LocalGovernmentService } from '../../alcs/local-government/local-government.service';
import { NOI_SUBMISSION_STATUS } from '../../alcs/notice-of-intent/notice-of-intent-submission-status/notice-of-intent-status.dto';
@@ -191,7 +189,7 @@ export class NoticeOfIntentSubmissionController {
if (primaryContact) {
await this.statusEmailService.sendNoticeOfIntentStatusEmail({
- generateStatusHtml: generateSUBMNoiApplicantHtml,
+ template: submNoiApplicantTemplate,
status: NOI_SUBMISSION_STATUS.SUBMITTED_TO_ALC,
noticeOfIntentSubmission,
government: submissionGovernment,
@@ -203,7 +201,7 @@ export class NoticeOfIntentSubmissionController {
if (submissionGovernment) {
await this.statusEmailService.sendNoticeOfIntentStatusEmail({
- generateStatusHtml: generateSUBMNoiGovernmentHtml,
+ template: submNoiGovernmentTemplate,
status: NOI_SUBMISSION_STATUS.SUBMITTED_TO_ALC,
noticeOfIntentSubmission,
government: submissionGovernment,
diff --git a/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts b/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts
index 4b8f7c0bb6..f31aa220fb 100644
--- a/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts
+++ b/services/apps/alcs/src/portal/notification-submission/notification-submission.service.ts
@@ -11,7 +11,7 @@ import {
Not,
Repository,
} from 'typeorm';
-import { generateSRWTemplate } from '../../../../../templates/emails/notifications/srw-notice.template';
+import { template } from '../../../../../templates/emails/notifications/srw-notice.template';
import { SUBMISSION_STATUS } from '../../alcs/application/application-submission-status/submission-status.dto';
import { PARENT_TYPE } from '../../alcs/card/card-subtask/card-subtask.dto';
import { LocalGovernmentService } from '../../alcs/local-government/local-government.service';
@@ -38,6 +38,7 @@ import {
NotificationSubmissionUpdateDto,
} from './notification-submission.dto';
import { NotificationSubmission } from './notification-submission.entity';
+import { compile } from 'handlebars';
@Injectable()
export class NotificationSubmissionService {
@@ -462,7 +463,7 @@ export class NotificationSubmissionService {
submission.fileNumber,
);
- const emailTemplate = generateSRWTemplate({
+ const html = compile(template)({
fileNumber: submission.fileNumber,
contactName: `${submission.contactFirstName} ${submission.contactLastName}`,
status: 'ALC Response Sent',
@@ -485,7 +486,7 @@ export class NotificationSubmissionService {
}
return {
- html: emailTemplate.html,
+ html: html,
cc: ccEmails,
to: submission.contactEmail!,
parentId: notification.uuid,
diff --git a/services/apps/alcs/src/providers/email/status-email.service.ts b/services/apps/alcs/src/providers/email/status-email.service.ts
index 9f01c965ea..261fece800 100644
--- a/services/apps/alcs/src/providers/email/status-email.service.ts
+++ b/services/apps/alcs/src/providers/email/status-email.service.ts
@@ -1,6 +1,5 @@
import { CONFIG_TOKEN, IConfig } from '@app/common/config/config.module';
import { Inject, Injectable, Logger, NotFoundException } from '@nestjs/common';
-import { MJMLParseResults } from 'mjml-core';
import { ApplicationDecisionV2Service } from '../../alcs/application-decision/application-decision-v2/application-decision/application-decision-v2.service';
import { ApplicationDecision } from '../../alcs/application-decision/application-decision.entity';
import { SUBMISSION_STATUS } from '../../alcs/application/application-submission-status/submission-status.dto';
@@ -20,6 +19,7 @@ import { NoticeOfIntentSubmission } from '../../portal/notice-of-intent-submissi
import { NoticeOfIntentSubmissionService } from '../../portal/notice-of-intent-submission/notice-of-intent-submission.service';
import { FALLBACK_APPLICANT_NAME } from '../../utils/owner.constants';
import { EmailService } from './email.service';
+import { compile } from 'handlebars';
export interface StatusUpdateEmail {
fileNumber: string;
@@ -36,7 +36,7 @@ export type DocumentEmailData = {
};
type BaseStatusEmailData = {
- generateStatusHtml: MJMLParseResults;
+ template: string;
government: LocalGovernment | null;
parentType: PARENT_TYPE;
ccGovernment?: boolean;
@@ -182,7 +182,7 @@ export class StatusEmailService {
const applicantName =
data.applicationSubmission.applicant || FALLBACK_APPLICANT_NAME;
- const emailTemplate = data.generateStatusHtml({
+ const html = compile(data.template)({
fileNumber,
applicantName,
childType:
@@ -198,7 +198,7 @@ export class StatusEmailService {
const parentId = await this.applicationService.getUuid(fileNumber);
return {
- body: emailTemplate.html,
+ body: html,
subject: `Agricultural Land Commission Application ID: ${fileNumber} (${applicantName})`,
parentType: data.parentType,
parentId,
@@ -222,7 +222,7 @@ export class StatusEmailService {
const applicantName =
data.noticeOfIntentSubmission.applicant || FALLBACK_APPLICANT_NAME;
- const emailTemplate = data.generateStatusHtml({
+ const html = compile(data.template)({
fileNumber,
applicantName,
childType:
@@ -238,7 +238,7 @@ export class StatusEmailService {
const parentId = await this.noticeOfIntentService.getUuid(fileNumber);
return {
- body: emailTemplate.html,
+ body: html,
subject: `Agricultural Land Commission NOI ID: ${fileNumber} (${applicantName})`,
parentType: data.parentType,
parentId,
diff --git a/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.ts b/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.ts
index c18abf7f7e..4e4cfc28e3 100644
--- a/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.ts
+++ b/services/apps/alcs/src/queues/scheduler/application/decision-emails/decision-emails.consumer.ts
@@ -3,8 +3,8 @@ import { Logger } from '@nestjs/common';
import * as dayjs from 'dayjs';
import * as timezone from 'dayjs/plugin/timezone';
import * as utc from 'dayjs/plugin/utc';
-import { generateALCDApplicationHtml } from '../../../../../../../templates/emails/decision-released';
-import { generateREVAHtml } from '../../../../../../../templates/emails/under-review-by-alc.template';
+import { template as alcdApplicationTemplate } from '../../../../../../../templates/emails/decision-released/application.template';
+import { template as revaTemplate } from '../../../../../../../templates/emails/under-review-by-alc.template';
import { ApplicationDecisionV2Service } from '../../../../alcs/application-decision/application-decision-v2/application-decision/application-decision-v2.service';
import { ApplicationSubmissionStatusService } from '../../../../alcs/application/application-submission-status/application-submission-status.service';
import { SUBMISSION_STATUS } from '../../../../alcs/application/application-submission-status/submission-status.dto';
@@ -107,10 +107,10 @@ export class ApplicationDecisionEmailConsumer extends WorkerHost {
applicationSubmission.status.statusTypeCode ===
submissionStatus.statusTypeCode
) {
- const generateStatusHtml =
+ const template =
submissionStatus.statusTypeCode === SUBMISSION_STATUS.ALC_DECISION
- ? generateALCDApplicationHtml
- : generateREVAHtml;
+ ? alcdApplicationTemplate
+ : revaTemplate;
const documents =
await this.statusEmailService.getApplicationDecisionDocuments(
@@ -123,7 +123,7 @@ export class ApplicationDecisionEmailConsumer extends WorkerHost {
parentType: PARENT_TYPE.APPLICATION,
primaryContact,
ccGovernment: true,
- generateStatusHtml,
+ template,
status:
+ This email is to advise that the above noted {{ childType }} application has been cancelled and will not be considered further.
+
+ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence.
+
+ This email is to advise that the above noted {{ childType }} Notice of Intent has been cancelled and will not be considered further.
+
+ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise your client(s) of this, and any future, correspondence.
+
+ This email is to advise that the Reasons for Decision for the above noted application has been released.
+
+ You can access the decision document by clicking the link(s) below:
+
+
- {{#each documents}}
-
-
+ {{#each documents}}
+
+
+ The decision can also be accessed via the ALC Portal and Public Search tool. +
++ Further correspondence with respect to this application should be directed to the ALC Land Use Planner for your region, found on the ALC website Contact Us page. +
++ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise them of this, and any future, correspondence. +
+ ${notificationOnly}`, +); diff --git a/services/templates/emails/decision-released/index.ts b/services/templates/emails/decision-released/index.ts deleted file mode 100644 index cf7fa6130d..0000000000 --- a/services/templates/emails/decision-released/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './application.template'; -export * from './notice-of-intent.template'; diff --git a/services/templates/emails/decision-released/notice-of-intent.template.ts b/services/templates/emails/decision-released/notice-of-intent.template.ts index 2e4112ab62..1579fe3106 100644 --- a/services/templates/emails/decision-released/notice-of-intent.template.ts +++ b/services/templates/emails/decision-released/notice-of-intent.template.ts @@ -1,67 +1,28 @@ -import { MJMLParseResults } from 'mjml-core'; -import { - DocumentEmailData, - StatusUpdateEmail, -} from '../../../apps/alcs/src/providers/email/status-email.service'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { footer, header, notificationOnly, portalButton } from '../partials'; +import { build } from '..'; +import { notificationOnly } from '../partials/notification-only.template'; -type DecisionReleasedStatusEmail = StatusUpdateEmail & { - documents: DocumentEmailData[]; -}; - -const template = `+ This email is to advise that the Reasons for Decision for the above noted Notice of Intent (NOI) has been released. +
++ You can access the decision document by clicking the link(s) below: +
++
+ The decision can also be accessed via the ALC Portal and Public Search tool. +
++ Further correspondence with respect to this NOI should be directed to ALC.Soil@gov.bc.ca. +
++ If you are an agent acting on behalf of the applicant(s)/landowner(s), it is your responsibility to advise them of this, and any future, correspondence. +
+ ${notificationOnly}`, +); diff --git a/services/templates/emails/index.ts b/services/templates/emails/index.ts new file mode 100644 index 0000000000..b78297307e --- /dev/null +++ b/services/templates/emails/index.ts @@ -0,0 +1,13 @@ +import { header } from './partials/header.template'; +import { portalButton } from './partials/portal-button.template'; +import { footer } from './partials/footer.template'; + +export const build = ( + content: string, + includeButton: boolean = true, +): string => ` +${header} +${content} +${includeButton ? portalButton : ''} +${footer} +`; diff --git a/services/templates/emails/notifications/srw-notice.template.ts b/services/templates/emails/notifications/srw-notice.template.ts index 28a7c993d4..a7ab0f51ac 100644 --- a/services/templates/emails/notifications/srw-notice.template.ts +++ b/services/templates/emails/notifications/srw-notice.template.ts @@ -1,88 +1,29 @@ -import { MJMLParseResults } from 'mjml-core'; -import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; -import { footer } from '../partials'; -import * as config from 'config'; +import { build } from '..'; -type SrwNoticeTemplateData = { - contactName: string; - status: string; - dateSubmitted: string; - fileNumber: string; - submittersFileNumber: string; - fileName: string; -}; - -const template = `+ The ALC's attached PDF response is proof that the notification of statutory right of way has been provided for a s. 218 Statutory Right of Way of the Land Title Act as required by s.18.1(2) of the Agricultural Land Commission Act. +
++ The ALC's attached PDF response must be appended as an additional document to the LTSA SRW application package. +
++ Disclaimer for Transferee(s): +
++ This letter is not an approval to use, construct, or remove soil or place fill (including gravel) within the SRW, nor does it compel the ALC to approve construction in the SRW. An application or notice of intent must be submitted to the ALC before starting any construction, fill placement, or soil removal within the SRW. Please consult the ALC for direction. +
++ Please refer to ALC Notification ID SRW{{ fileNumber }} in all future correspondence with this office. If you are acting on behalf of the transferee, it is your responsibility to advise your client(s) of this, and any future, correspondence. +
++ Further correspondence with respect to this notification should be directed to ALC.LUPRT@gov.bc.ca. +
++ PROVINCIAL AGRICULTURAL LAND COMMISSION +
++ Attachment: {{fileName}} +
`, + false, +); diff --git a/services/templates/emails/partials/footer.template.ts b/services/templates/emails/partials/footer.template.ts index 0f045072d0..5a2b745ffb 100644 --- a/services/templates/emails/partials/footer.template.ts +++ b/services/templates/emails/partials/footer.template.ts @@ -1,15 +1,9 @@ import { v4 } from 'uuid'; -export const footer = () => ` -