Skip to content

Commit

Permalink
Merge pull request #1863 from bcgov/backport/2024-09-19
Browse files Browse the repository at this point in the history
Backport 2024/09/19
  • Loading branch information
Abradat authored Sep 26, 2024
2 parents 70a0bce + a411d41 commit 23bb643
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 22 deletions.
9 changes: 8 additions & 1 deletion alcs-frontend/src/app/features/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,20 @@ export class SearchComponent implements OnInit, OnDestroy {
getSearchParams(): SearchRequestDto {
const resolutionNumberString = this.formatStringSearchParam(this.searchForm.controls.resolutionNumber.value);
let fileTypes: string[];
let portalStatusCodes;

if (this.searchForm.controls.componentType.value === null) {
fileTypes = this.isCommissioner ? this.fileTypeService.getCommissionerListData() : [];
} else {
fileTypes = this.searchForm.controls.componentType.value!;
}

if (this.searchForm.controls.portalStatus.value?.length === 0) {
portalStatusCodes = this.isCommissioner ? this.portalStatusDataService.getCommissionerListData() : [];
} else {
portalStatusCodes = this.searchForm.controls.portalStatus.value!;
}

return {
// pagination
pageSize: this.itemsPerPage,
Expand All @@ -273,7 +280,7 @@ export class SearchComponent implements OnInit, OnDestroy {
pid: this.formatStringSearchParam(this.searchForm.controls.pid.value),
resolutionNumber: resolutionNumberString ? parseInt(resolutionNumberString) : undefined,
resolutionYear: this.searchForm.controls.resolutionYear.value ?? undefined,
portalStatusCodes: this.portalStatusControl.value !== null ? this.portalStatusControl.value : undefined,
portalStatusCodes: portalStatusCodes,
governmentName: this.formatStringSearchParam(this.searchForm.controls.government.value),
regionCode: this.searchForm.controls.region.value ?? undefined,
dateSubmittedFrom: this.searchForm.controls.dateSubmittedFrom.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h2>Attachments</h2>
(uploadFiles)="attachStaffReport($event)"
(deleteFile)="deleteFile($event)"
(openFile)="openFile($event)"
[isRequired]="true"
[isRequired]="isAuthorized"
[showErrors]="showErrors"
[showVirusError]="showStaffReportVirusError"
></app-file-drag-drop>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,19 @@ export class ApplicationDecisionMeetingService {
.addSelect(
`
CASE
WHEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END) is NOT NULL
THEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END)
ELSE MAX(CASE WHEN meeting.date < (CURRENT_DATE) THEN meeting.date END)
WHEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE AT TIME ZONE \'America/Vancouver\') THEN meeting.date END) is NOT NULL
THEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE AT TIME ZONE \'America/Vancouver\') THEN meeting.date END)
ELSE MAX(CASE WHEN meeting.date < (CURRENT_DATE AT TIME ZONE \'America/Vancouver\') THEN meeting.date END)
END
`,
'next_meeting',
)
.innerJoin('meeting.application', 'application')
.innerJoin('application.reconsiderations', 'reconsideration')
.innerJoin('reconsideration.card', 'card')
.where(`card.status_code != '${CARD_STATUS.DECISION_RELEASED}'`)
.where('card.status_code NOT IN (:...values)', {
values: [CARD_STATUS.DECISION_RELEASED, CARD_STATUS.CANCELLED],
})
.groupBy('reconsideration.uuid')
.getRawMany();
}
Expand All @@ -159,16 +161,18 @@ export class ApplicationDecisionMeetingService {
.addSelect(
`
CASE
WHEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END) is NOT NULL
THEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END)
ELSE MAX(CASE WHEN meeting.date < (CURRENT_DATE) THEN meeting.date END)
WHEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE AT TIME ZONE \'America/Vancouver\') THEN meeting.date END) is NOT NULL
THEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE AT TIME ZONE \'America/Vancouver\') THEN meeting.date END)
ELSE MAX(CASE WHEN meeting.date < (CURRENT_DATE AT TIME ZONE \'America/Vancouver\') THEN meeting.date END)
END
`,
'next_meeting',
)
.innerJoin('meeting.application', 'application')
.innerJoin('application.card', 'card')
.where(`card.status_code != '${CARD_STATUS.DECISION_RELEASED}'`)
.where('card.status_code NOT IN (:...values)', {
values: [CARD_STATUS.DECISION_RELEASED, CARD_STATUS.CANCELLED],
})
.groupBy('application.uuid')
.getRawMany();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,19 @@ export class PlanningReviewMeetingService {
.addSelect(
`
CASE
WHEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END) is NOT NULL
THEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE) THEN meeting.date END)
ELSE MAX(CASE WHEN meeting.date < (CURRENT_DATE) THEN meeting.date END)
WHEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE AT TIME ZONE \'America/Vancouver\') THEN meeting.date END) is NOT NULL
THEN MIN(CASE WHEN meeting.date >= (CURRENT_DATE AT TIME ZONE \'America/Vancouver\') THEN meeting.date END)
ELSE MAX(CASE WHEN meeting.date < (CURRENT_DATE AT TIME ZONE \'America/Vancouver\') THEN meeting.date END)
END
`,
'next_meeting',
)
.innerJoin('meeting.planningReview', 'planningReview')
.innerJoin('planningReview.referrals', 'referrals')
.innerJoin('referrals.card', 'card')
.where(`card.status_code != '${CARD_STATUS.DECISION_RELEASED}'`)
.where('card.status_code NOT IN (:...values)', {
values: [CARD_STATUS.DECISION_RELEASED, CARD_STATUS.CANCELLED],
})
.groupBy('planningReview.uuid')
.getRawMany();
}
Expand Down
2 changes: 1 addition & 1 deletion services/apps/alcs/src/alcs/search/search.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export class SearchController {
}

@Post('/advanced/application')
@UserRoles(...ROLES_ALLOWED_APPLICATIONS)
@UserRoles(...ROLES_ALLOWED_SEARCH)
async advancedSearchApplications(
@Body() searchDto: SearchRequestDto,
): Promise<AdvancedSearchResultDto<ApplicationSearchResultDto[]>> {
Expand Down
3 changes: 2 additions & 1 deletion services/templates/emails/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { footer } from './partials/footer.template';
export const build = (
content: string,
includeButton: boolean = true,
isNotification: boolean = false,
): string => `
${header}
${header(isNotification)}
${content}
${includeButton ? portalButton : ''}
${footer}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ export const template = build(
Attachment: {{fileName}}
</p>`,
false,
true,
);
4 changes: 2 additions & 2 deletions services/templates/emails/partials/header.template.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { masthead } from './masthead.template';

export const header = `
export const header = (isNotification: boolean = false) => `
<!DOCTYPE html>
<html lang="en">
<head>
Expand All @@ -14,5 +14,5 @@ export const header = `
<![endif]-->
<div style="max-width: 600px; margin: 0 auto; padding-top: 40px; font-family: Helvetica, Arial, sans-serif;">
${masthead}
${masthead(isNotification)}
`;
20 changes: 16 additions & 4 deletions services/templates/emails/partials/masthead.template.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import * as config from 'config';

export const masthead = `
const defaultDetails = `
<p style="font-size: 21px;"><b>{{ parentTypeLabel }} ID #{{ fileNumber }}</b></p>
<p>Name: <b>{{ applicantName }}</b></p>
<p>Status: <b>{{ status }}</b></p>
`;

const notificationDetails = `
<p style="font-size: 21px;"><b>{{ parentTypeLabel }} ID #SRW{{ fileNumber }}</b></p>
<p>Primary Contact: <b>{{ contactName }}</b></p>
<p>Status: <b>{{ status }}</b></p>
<p>{{ dateSubmitted }}</p>
<p>Submitter's File Number: {{ submittersFileNumber }}</p>
`;

export const masthead = (isNotification: boolean = false) => `
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 400px; vertical-align: top;" align="left" vertical-align:top>
<p style="font-size: 21px;"><b>{{ parentTypeLabel }} ID #{{ fileNumber }}</b></p>
<p>Name: <b>{{ applicantName }}</b></p>
<p>Status: <b>{{ status }}</b></p>
${isNotification ? notificationDetails : defaultDetails}
</td>
<td style="width: 200px; vertical-align: top;" align="right">
<table border="0" cellpadding="0" cellspacing="0">
Expand Down

0 comments on commit 23bb643

Please sign in to comment.