diff --git a/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts b/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts index 993ff52db0..873b1254aa 100644 --- a/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts +++ b/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts @@ -8,7 +8,7 @@ import { ServiceValidationException } from '../../../../../libs/common/src/excep import { generateCANCApplicationHtml } from '../../../../../templates/emails/cancelled'; import { generateSUBGTurApplicantHtml, - generateSUBGTurGovernmentHtml, + generateSUBGNoReviewGovernmentTemplateEmail, } from '../../../../../templates/emails/submitted-to-alc'; import { generateSUBGApplicantHtml, @@ -452,7 +452,7 @@ describe('ApplicationSubmissionController', () => { expect( mockStatusEmailService.sendApplicationStatusEmail, ).toHaveBeenCalledWith({ - generateStatusHtml: generateSUBGTurGovernmentHtml, + generateStatusHtml: generateSUBGNoReviewGovernmentTemplateEmail, status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, applicationSubmission: mockApplicationSubmission, government: mockGovernment, 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 7041ace2f0..1b5da076a0 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 @@ -17,8 +17,9 @@ import { import { generateCANCApplicationHtml } from '../../../../../templates/emails/cancelled'; import { generateSUBGTurApplicantHtml, - generateSUBGTurGovernmentHtml, + generateSUBGNoReviewGovernmentTemplateEmail, } from '../../../../../templates/emails/submitted-to-alc'; +import { generateSUBGCoveApplicantHtml } from '../../../../../templates/emails/submitted-to-alc/cove-applicant.template'; import { generateSUBGApplicantHtml, generateSUBGGovernmentHtml, @@ -31,6 +32,7 @@ import { LocalGovernmentService } from '../../alcs/local-government/local-govern import { PortalAuthGuard } from '../../common/authorization/portal-auth-guard.service'; import { StatusEmailService } from '../../providers/email/status-email.service'; import { User } from '../../user/user.entity'; +import { APPLICATION_SUBMISSION_TYPES } from '../pdf-generation/generate-submission-document.service'; import { ApplicationSubmissionValidatorService, ValidatedApplicationSubmission, @@ -326,30 +328,40 @@ export class ApplicationSubmissionController { ); if (primaryContact) { - await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateSUBGTurApplicantHtml, - status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, - applicationSubmission: validatedSubmission, - government: submissionGovernment, - parentType: PARENT_TYPE.APPLICATION, - primaryContact, - }); - } + if ( + matchingType.code === APPLICATION_SUBMISSION_TYPES.TURP || + matchingType.code === APPLICATION_SUBMISSION_TYPES.COVE + ) { + const generateTemplateFunction = + matchingType.code === APPLICATION_SUBMISSION_TYPES.TURP + ? generateSUBGTurApplicantHtml + : generateSUBGCoveApplicantHtml; - if (submissionGovernment) { - await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateSUBGTurGovernmentHtml, - status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, - applicationSubmission: validatedSubmission, - government: submissionGovernment, - parentType: PARENT_TYPE.APPLICATION, - }); - } + await this.statusEmailService.sendApplicationStatusEmail({ + generateStatusHtml: generateTemplateFunction, + status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, + applicationSubmission: validatedSubmission, + government: submissionGovernment, + parentType: PARENT_TYPE.APPLICATION, + primaryContact, + }); + } - return await this.applicationSubmissionService.updateStatus( - validatedSubmission, - SUBMISSION_STATUS.SUBMITTED_TO_ALC, - ); + if (submissionGovernment) { + await this.statusEmailService.sendApplicationStatusEmail({ + generateStatusHtml: generateSUBGNoReviewGovernmentTemplateEmail, + status: SUBMISSION_STATUS.SUBMITTED_TO_ALC, + applicationSubmission: validatedSubmission, + government: submissionGovernment, + parentType: PARENT_TYPE.APPLICATION, + }); + } + + return await this.applicationSubmissionService.updateStatus( + validatedSubmission, + SUBMISSION_STATUS.SUBMITTED_TO_ALC, + ); + } } } } diff --git a/services/templates/emails/submitted-to-alc/cove-applicant.template.ts b/services/templates/emails/submitted-to-alc/cove-applicant.template.ts new file mode 100644 index 0000000000..a4cd371325 --- /dev/null +++ b/services/templates/emails/submitted-to-alc/cove-applicant.template.ts @@ -0,0 +1,50 @@ +import { MJMLParseResults } from 'mjml-core'; +import { StatusUpdateEmail } from '../../../apps/alcs/src/providers/email/status-email.service'; +import { EmailTemplateService } from '../../../libs/common/src/email-template-service/email-template.service'; +import { header, footer, notificationOnly, portalButton } from '../partials'; + +const template = ` + + + .line-height div { + line-height: 24px !important; + } + + .align-left { + float: left !important; + } + + + + ${header} + + + + + This email is to acknowledge that the Agricultural Land Commission (ALC) is in receipt of the above noted {{ childType }} application. Please refer to the ALC Application ID in all future correspondence with this office. A copy of this application has been forwarded to the {{ governmentName }} for information purposes. + + + There is no application fee associated with registering a Restrictive Covenant. + + + 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. + + + Please log into the ALC Portal for further updates on the application as it progresses. + + ${notificationOnly} + + + + ${portalButton} + + ${footer} + + +`; + +export const generateSUBGCoveApplicantHtml = ( + data: StatusUpdateEmail, +): MJMLParseResults => { + return new EmailTemplateService().generateEmailBase(template, data); +}; diff --git a/services/templates/emails/submitted-to-alc/index.ts b/services/templates/emails/submitted-to-alc/index.ts index 0232ab77f0..b3862e78c7 100644 --- a/services/templates/emails/submitted-to-alc/index.ts +++ b/services/templates/emails/submitted-to-alc/index.ts @@ -2,4 +2,4 @@ export * from './application.template'; export * from './noi-applicant.template'; export * from './noi-government.template'; export * from './tur-applicant.template'; -export * from './tur-government.template'; +export * from './no-review-government.template'; diff --git a/services/templates/emails/submitted-to-alc/tur-government.template.ts b/services/templates/emails/submitted-to-alc/no-review-government.template.ts similarity index 96% rename from services/templates/emails/submitted-to-alc/tur-government.template.ts rename to services/templates/emails/submitted-to-alc/no-review-government.template.ts index b39d2ff217..4738519796 100644 --- a/services/templates/emails/submitted-to-alc/tur-government.template.ts +++ b/services/templates/emails/submitted-to-alc/no-review-government.template.ts @@ -37,7 +37,7 @@ const template = ` `; -export const generateSUBGTurGovernmentHtml = ( +export const generateSUBGNoReviewGovernmentTemplateEmail = ( data: StatusUpdateEmail, ): MJMLParseResults => { return new EmailTemplateService().generateEmailBase(template, data);