Skip to content

Commit c3337c3

Browse files
committed
ALCS-2562 Backend and NOI implementation
1 parent afbfca5 commit c3337c3

File tree

13 files changed

+145
-54
lines changed

13 files changed

+145
-54
lines changed

alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-input-v2.component.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,11 @@ export class DecisionInputV2Component implements OnInit, OnDestroy {
373373
this.form.controls['criterionModification'].updateValueAndValidity();
374374
}
375375

376-
async onSubmit(isStayOnPage: boolean = false, isDraft: boolean = true, ccEmails: string[] = []) {
376+
async onSubmit(isStayOnPage: boolean = false, isDraft: boolean = true, ccEmails: string[] = [], sendEmail: boolean = true) {
377377
this.isLoading = true;
378378

379379
try {
380-
await this.saveDecision(isDraft, ccEmails);
380+
await this.saveDecision(isDraft, ccEmails, sendEmail);
381381
} finally {
382382
if (!isStayOnPage) {
383383
this.onCancel();
@@ -389,9 +389,8 @@ export class DecisionInputV2Component implements OnInit, OnDestroy {
389389
}
390390
}
391391

392-
async saveDecision(isDraft: boolean = true, ccEmails: string[] = []) {
393-
const data = this.mapDecisionDataForSave(isDraft, ccEmails);
394-
392+
async saveDecision(isDraft: boolean = true, ccEmails: string[] = [], sendEmail: boolean = true) {
393+
const data = this.mapDecisionDataForSave(isDraft, ccEmails, sendEmail);
395394
if (this.uuid) {
396395
await this.decisionService.update(this.uuid, data);
397396
} else {
@@ -403,7 +402,7 @@ export class DecisionInputV2Component implements OnInit, OnDestroy {
403402
}
404403
}
405404

406-
private mapDecisionDataForSave(isDraft: boolean, ccEmails: string[]) {
405+
private mapDecisionDataForSave(isDraft: boolean, ccEmails: string[], sendEmail: boolean = true) {
407406
const {
408407
date,
409408
outcome,
@@ -449,6 +448,7 @@ export class DecisionInputV2Component implements OnInit, OnDestroy {
449448
decisionComponents: this.components,
450449
conditions: this.conditionUpdates,
451450
ccEmails,
451+
sendEmail,
452452
};
453453
if (ceoCriterion && ceoCriterion === CeoCriterion.MODIFICATION) {
454454
data.isTimeExtension = criterionModification?.includes('isTimeExtension');
@@ -592,9 +592,9 @@ export class DecisionInputV2Component implements OnInit, OnDestroy {
592592
},
593593
})
594594
.afterClosed()
595-
.subscribe(async (result: { confirmed: boolean; ccEmails: string[] }) => {
595+
.subscribe(async (result: { confirmed: boolean; ccEmails: string[], sendEmail: boolean }) => {
596596
if (result.confirmed) {
597-
await this.onSubmit(false, false, result.ccEmails);
597+
await this.onSubmit(false, false, result.ccEmails, result.sendEmail);
598598
await this.applicationService.loadApplication(this.fileNumber);
599599
}
600600
});

alcs-frontend/src/app/features/application/decision/decision-v2/release-dialog/release-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h2 class="card-title">Confirm Release Decision</h2>
33
</div>
44
<mat-dialog-content class="content">
5-
<div class="row">
5+
<div *ngIf="!wasReleased" class="row">
66
<div class="toggle-label" id="sendEmailLabel">Send Email (with decision document)</div>
77
<div class="toggle">
88
<mat-slide-toggle

alcs-frontend/src/app/features/application/decision/decision-v2/release-dialog/release-dialog.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export class ReleaseDialogComponent implements OnInit, OnDestroy {
5959
this.matDialogRef.close({
6060
confirmed: true,
6161
ccEmails: this.emails,
62+
sendEmail: this.sendEmail,
6263
});
6364
}
6465

alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-input-v2.component.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,11 @@ export class DecisionInputV2Component implements OnInit, OnDestroy {
270270
}
271271
}
272272

273-
async onSubmit(isStayOnPage: boolean = false, isDraft: boolean = true, ccEmails: string[] = []) {
273+
async onSubmit(isStayOnPage: boolean = false, isDraft: boolean = true, ccEmails: string[] = [], sendEmail: boolean = true) {
274274
this.isLoading = true;
275275

276276
try {
277-
await this.saveDecision(isDraft, ccEmails);
277+
await this.saveDecision(isDraft, ccEmails, sendEmail);
278278
} finally {
279279
if (!isStayOnPage) {
280280
this.onCancel();
@@ -286,8 +286,8 @@ export class DecisionInputV2Component implements OnInit, OnDestroy {
286286
}
287287
}
288288

289-
async saveDecision(isDraft: boolean = true, ccEmails: string[]) {
290-
const data = this.mapDecisionDataForSave(isDraft, ccEmails);
289+
async saveDecision(isDraft: boolean = true, ccEmails: string[], sendEmail: boolean = true) {
290+
const data = this.mapDecisionDataForSave(isDraft, ccEmails, sendEmail);
291291

292292
if (this.uuid) {
293293
await this.decisionService.update(this.uuid, data);
@@ -300,7 +300,7 @@ export class DecisionInputV2Component implements OnInit, OnDestroy {
300300
}
301301
}
302302

303-
private mapDecisionDataForSave(isDraft: boolean, ccEmails: string[]) {
303+
private mapDecisionDataForSave(isDraft: boolean, ccEmails: string[], sendEmail: boolean = true) {
304304
const {
305305
date,
306306
outcome,
@@ -334,6 +334,7 @@ export class DecisionInputV2Component implements OnInit, OnDestroy {
334334
conditions: this.conditionUpdates,
335335
decisionMaker: decisionMaker ?? undefined,
336336
ccEmails,
337+
sendEmail,
337338
};
338339

339340
return data;
@@ -441,9 +442,9 @@ export class DecisionInputV2Component implements OnInit, OnDestroy {
441442
},
442443
})
443444
.afterClosed()
444-
.subscribe(async (res: { confirmed: boolean; ccEmails: string[] }) => {
445+
.subscribe(async (res: { confirmed: boolean; ccEmails: string[], sendEmail: boolean }) => {
445446
if (res.confirmed) {
446-
await this.onSubmit(false, false, res.ccEmails);
447+
await this.onSubmit(false, false, res.ccEmails, res.sendEmail);
447448
await this.noticeOfIntentDetailService.load(this.fileNumber);
448449
}
449450
});

alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/release-dialog/release-dialog.component.html

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,57 @@
22
<h2 class="card-title">Confirm Release Decision</h2>
33
</div>
44
<mat-dialog-content class="content">
5+
<div *ngIf="!wasReleased" class="row">
6+
<div class="toggle-label" id="sendEmailLabel">Send Email (with decision document)</div>
7+
<div class="toggle">
8+
<mat-slide-toggle
9+
[(ngModel)]="sendEmail"
10+
aria-labelledby="sendEmailLabel"
11+
></mat-slide-toggle
12+
>
13+
</div>
14+
</div>
15+
<div *ngIf="!sendEmail" class="warning-section">
16+
<div class="warning">
17+
<mat-icon>info</mat-icon> <b>Warning: </b>&nbsp; Email will not be sent
18+
</div>
19+
</div>
20+
<div *ngIf="sendEmail">
21+
<div>
22+
<span *ngIf="!wasReleased">Email will be sent to Primary Contact and Local/First Nation Government</span>
23+
<span *ngIf="wasReleased">No auto-emails will be sent</span>
24+
</div>
25+
<div *ngIf="!wasReleased" style="margin-top: 24px; margin-bottom: 24px;">
26+
<div style="margin-bottom: 4px">
27+
<mat-label>CC additional recipients on decision release email (optional):</mat-label>
28+
</div>
29+
<mat-form-field style="width: 100%" appearance="outline">
30+
<mat-chip-grid #chipGrid aria-label="Enter emails">
31+
<mat-chip-row
32+
*ngFor="let email of emails"
33+
(removed)="onRemoveEmail(email)"
34+
[editable]="true"
35+
(edited)="editEmail(email, $event)"
36+
[aria-description]="'press enter to edit ' + email"
37+
>
38+
{{ email }}
39+
<button matChipRemove [attr.aria-label]="'remove ' + email">
40+
<mat-icon>cancel</mat-icon>
41+
</button>
42+
</mat-chip-row>
43+
</mat-chip-grid>
44+
<input
45+
placeholder="Type and hit ‘space’ to add emails"
46+
[matChipInputFor]="chipGrid"
47+
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
48+
[matChipInputAddOnBlur]="true"
49+
(matChipInputTokenEnd)="addEmail($event)"
50+
[formControl]="email"
51+
/>
52+
</mat-form-field>
53+
<mat-error *ngIf="email.invalid"><mat-icon>warning</mat-icon>&nbsp;Please type a valid email address</mat-error>
54+
</div>
55+
</div>
556
<p>Upon releasing the decision:</p>
657
<div class="release-data">
758
<div><strong>Visibility:</strong> Applicant, Local/First Nation Government, and Public</div>
@@ -16,42 +67,6 @@ <h2 class="card-title">Confirm Release Decision</h2>
1667
[type]="cancelledStatus"
1768
></app-application-submission-status-type-pill>
1869
</div>
19-
<div>
20-
<strong>Email (with decision document) sent to: </strong>
21-
<span *ngIf="!wasReleased">Primary Contact and Local/First Nation Government</span>
22-
<span *ngIf="wasReleased">No auto-emails will be sent</span>
23-
</div>
24-
</div>
25-
<div *ngIf="!wasReleased" style="margin-top: 24px">
26-
<div style="margin-bottom: 4px">
27-
<mat-label>CC additional recipients on decision release email (optional):</mat-label>
28-
</div>
29-
<mat-form-field style="width: 100%" appearance="outline">
30-
<mat-chip-grid #chipGrid aria-label="Enter emails">
31-
<mat-chip-row
32-
*ngFor="let email of emails"
33-
class="chip"
34-
(removed)="onRemoveEmail(email)"
35-
[editable]="true"
36-
(edited)="editEmail(email, $event)"
37-
[aria-description]="'press enter to edit ' + email"
38-
>
39-
{{ email }}
40-
<button matChipRemove [attr.aria-label]="'remove ' + email">
41-
<mat-icon>cancel</mat-icon>
42-
</button>
43-
</mat-chip-row>
44-
</mat-chip-grid>
45-
<input
46-
placeholder="Type and hit ‘space’ to add emails"
47-
[matChipInputFor]="chipGrid"
48-
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
49-
[matChipInputAddOnBlur]="true"
50-
(matChipInputTokenEnd)="addEmail($event)"
51-
[formControl]="email"
52-
/>
53-
</mat-form-field>
54-
<mat-error *ngIf="email.invalid"><mat-icon>warning</mat-icon>&nbsp;Please type a valid email address</mat-error>
5570
</div>
5671
</mat-dialog-content>
5772

alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/release-dialog/release-dialog.component.scss

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,66 @@
2020
.mat-mdc-form-field-infix {
2121
display: flex;
2222
}
23+
.toggle {
24+
mat-label {
25+
margin-right: 8px;
26+
}
27+
28+
& .mdc-form-field {
29+
display: flex;
30+
}
31+
32+
& .mdc-label {
33+
font-size: 16px;
34+
padding-left: 12px;
35+
}
36+
37+
& .mat-mdc-slide-toggle .mdc-form-field {
38+
color: colors.$grey;
39+
}
40+
41+
& .mat-mdc-slide-toggle-checked .mdc-form-field {
42+
color: colors.$black;
43+
44+
.mdc-label {
45+
font-weight: 700 !important;
46+
}
47+
}
48+
}
49+
}
50+
51+
.toggle-label {
52+
font-weight: 700;
53+
}
54+
55+
.toggle {
56+
display: flex;
57+
gap: 4px;
58+
color: colors.$black;
59+
font-weight: 700;
60+
margin-left: 14px;
61+
margin-top: 6px;
62+
}
63+
64+
.row {
65+
display: flex;
66+
margin: 24px 0;
67+
align-items: flex-start;
68+
}
69+
70+
.warning {
71+
padding: 16px;
72+
font-size: 14px;
73+
background-color: rgba(colors.$field-warning-bg-color, 0.5);
74+
border-radius: 8px;
75+
display: flex;
76+
align-items: center;
77+
color: colors.$dark-contrast-text;
78+
margin-top: 18px;
79+
margin-bottom: 18px;
80+
81+
mat-icon {
82+
color: colors.$dark-contrast-text;
83+
margin-right: 16px;
84+
}
2385
}

alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/release-dialog/release-dialog.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class ReleaseDialogComponent implements OnInit, OnDestroy {
2222
firstDecision = false;
2323
releasedStatus: ApplicationSubmissionStatusPill | undefined;
2424
cancelledStatus: ApplicationSubmissionStatusPill | undefined;
25+
sendEmail = true;
2526

2627
readonly separatorKeysCodes = [ENTER, COMMA, SPACE] as const;
2728
emails: string[] = [];
@@ -57,6 +58,7 @@ export class ReleaseDialogComponent implements OnInit, OnDestroy {
5758
this.matDialogRef.close({
5859
confirmed: true,
5960
ccEmails: this.emails,
61+
sendEmail: this.sendEmail,
6062
});
6163
}
6264

alcs-frontend/src/app/services/application/decision/application-decision-v2/application-decision-v2.dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface UpdateApplicationDecisionDto {
3838
flaggedByUuid?: string | null;
3939
flagEditedByUuid?: string | null;
4040
flagEditedAt?: number | null;
41+
sendEmail?: boolean;
4142
}
4243

4344
export interface CreateApplicationDecisionDto extends UpdateApplicationDecisionDto {

alcs-frontend/src/app/services/notice-of-intent/decision-v2/notice-of-intent-decision.dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface UpdateNoticeOfIntentDecisionDto {
3131
flaggedByUuid?: string | null;
3232
flagEditedByUuid?: string | null;
3333
flagEditedAt?: number | null;
34+
sendEmail?: boolean;
3435
}
3536

3637
export interface CreateNoticeOfIntentDecisionDto extends UpdateNoticeOfIntentDecisionDto {

services/apps/alcs/src/alcs/application-decision/application-decision-v2/application-decision/application-decision-v2.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ export class ApplicationDecisionV2Service {
286286
existingDecision.rescindedComment = updateDto.rescindedComment;
287287
existingDecision.wasReleased = existingDecision.wasReleased || !updateDto.isDraft;
288288
existingDecision.linkedResolutionOutcomeCode = updateDto.linkedResolutionOutcomeCode;
289-
existingDecision.emailSent = updateDto.emailSent;
289+
existingDecision.emailSent = updateDto.sendEmail ? updateDto.emailSent : new Date();
290290
existingDecision.ccEmails = filterUndefined(updateDto.ccEmails, existingDecision.ccEmails);
291291
existingDecision.isFlagged = updateDto.isFlagged;
292292
existingDecision.reasonFlagged = updateDto.reasonFlagged;

0 commit comments

Comments
 (0)