From 8584859bb0fa81be941b2deb499ac9f19f1a0844 Mon Sep 17 00:00:00 2001
From: Tristan Slater <1631008+trslater@users.noreply.github.com>
Date: Thu, 5 Dec 2024 11:38:17 -0800
Subject: [PATCH 1/4] Fix undefined app component name
---
.../decision-conditions.component.ts | 20 ++++++++++---------
.../decision-input-v2.component.html | 5 +++--
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.ts b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.ts
index 6bf60fb9c..7e18c7b14 100644
--- a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.ts
+++ b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.ts
@@ -16,6 +16,7 @@ import {
ApplicationDecisionComponentDto,
UpdateApplicationDecisionConditionDto,
ApplicationDecisionConditionTypeDto,
+ DecisionComponentTypeDto,
} from '../../../../../../services/application/decision/application-decision-v2/application-decision-v2.dto';
import { ApplicationDecisionV2Service } from '../../../../../../services/application/decision/application-decision-v2/application-decision-v2.service';
import { ConfirmationDialogService } from '../../../../../../shared/confirmation-dialog/confirmation-dialog.service';
@@ -36,6 +37,7 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
@Input() set types(types: ApplicationDecisionConditionTypeDto[]) {
this.activeTypes = types.filter((type) => type.isActive);
}
+ @Input() componentTypes!: DecisionComponentTypeDto[];
@Input() components: ApplicationDecisionComponentDto[] = [];
@Input() conditions: ApplicationDecisionConditionDto[] = [];
@Input() showError = false;
@@ -52,7 +54,7 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
constructor(
private decisionService: ApplicationDecisionV2Service,
- private confirmationDialogService: ConfirmationDialogService
+ private confirmationDialogService: ConfirmationDialogService,
) {}
ngOnInit(): void {
@@ -66,10 +68,10 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
decision.uuid,
decision.components,
decision.resolutionNumber,
- decision.resolutionYear
+ decision.resolutionYear,
);
const otherDecisionsComponents = mappedComponents.filter(
- (component) => component.decisionUuid !== selectedDecision?.uuid
+ (component) => component.decisionUuid !== selectedDecision?.uuid,
);
otherDecisionComponents.push(...otherDecisionsComponents);
}
@@ -81,7 +83,7 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
selectedDecision.uuid,
this.components,
selectedDecision.resolutionNumber,
- selectedDecision.resolutionYear
+ selectedDecision.resolutionYear,
);
this.selectableComponents = [...this.allComponents, ...updatedComponents];
@@ -131,7 +133,7 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
this.decision.uuid,
this.components,
this.decision.resolutionNumber,
- this.decision.resolutionYear
+ this.decision.resolutionYear,
);
this.selectableComponents = [...this.allComponents, ...updatedComponents];
const validComponentIds = this.selectableComponents.map((component) => component.tempId);
@@ -139,7 +141,7 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
this.mappedConditions = this.mappedConditions.map((condition) => {
if (condition.componentsToCondition) {
condition.componentsToCondition = condition.componentsToCondition.filter((component) =>
- validComponentIds.includes(component.tempId)
+ validComponentIds.includes(component.tempId),
);
}
return condition;
@@ -157,7 +159,7 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
this.mappedConditions = conditions.map((condition) => {
const selectedComponents = this.selectableComponents
.filter((component) =>
- condition.components?.map((conditionComponent) => conditionComponent.uuid).includes(component.uuid)
+ condition.components?.map((conditionComponent) => conditionComponent.uuid).includes(component.uuid),
)
.map((e) => ({
componentDecisionUuid: e.decisionUuid,
@@ -177,10 +179,10 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
decisionUuid: string,
components: ApplicationDecisionComponentDto[],
decisionNumber: number | null,
- decisionYear: number | null
+ decisionYear: number | null,
) {
return components.map((component) => {
- const matchingType = this.activeTypes.find(
+ const matchingType = this.componentTypes.find(
(type) => type.code === component.applicationDecisionComponentTypeCode,
);
return {
diff --git a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-input-v2.component.html b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-input-v2.component.html
index 76fd3fc34..db81199b7 100644
--- a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-input-v2.component.html
+++ b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-input-v2.component.html
@@ -27,7 +27,7 @@
Resolution
color="primary"
(click)="onGenerateResolutionNumber()"
[ngClass]="{
- 'error-field-outlined ng-invalid': !resolutionNumberControl.valid && resolutionNumberControl.touched
+ 'error-field-outlined ng-invalid': !resolutionNumberControl.valid && resolutionNumberControl.touched,
}"
>
Get Resolution Number
@@ -142,7 +142,7 @@ Resolution
(change)="onChangeSubjectToConditions($event)"
[ngClass]="{
'error-field-outlined':
- !form.controls.isSubjectToConditions.valid && form.controls.isSubjectToConditions.touched
+ !form.controls.isSubjectToConditions.valid && form.controls.isSubjectToConditions.touched,
}"
>
Yes
@@ -203,6 +203,7 @@ Resolution
Date: Thu, 5 Dec 2024 11:38:33 -0800
Subject: [PATCH 2/4] Apply same change to NOI's
---
.../decision-conditions.component.html | 8 ++------
.../decision-conditions.component.ts | 19 ++++++++++++-------
.../decision-input-v2.component.html | 9 +++++----
3 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.html b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.html
index 32e2452ce..d65f361fa 100644
--- a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.html
+++ b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.html
@@ -16,13 +16,9 @@ Conditions
-
diff --git a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.ts b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.ts
index 7371165a2..5398bbdee 100644
--- a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.ts
+++ b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.ts
@@ -12,14 +12,15 @@ import {
import { combineLatestWith, Subject, takeUntil } from 'rxjs';
import { NoticeOfIntentDecisionV2Service } from '../../../../../../services/notice-of-intent/decision-v2/notice-of-intent-decision-v2.service';
import {
- NoticeOfIntentDecisionCodesDto,
NoticeOfIntentDecisionComponentDto,
NoticeOfIntentDecisionConditionDto,
+ NoticeOfIntentDecisionConditionTypeDto,
NoticeOfIntentDecisionDto,
UpdateNoticeOfIntentDecisionConditionDto,
} from '../../../../../../services/notice-of-intent/decision-v2/notice-of-intent-decision.dto';
import { ConfirmationDialogService } from '../../../../../../shared/confirmation-dialog/confirmation-dialog.service';
import { DecisionConditionComponent } from './decision-condition/decision-condition.component';
+import { DecisionComponentTypeDto } from 'src/app/services/application/decision/application-decision-v2/application-decision-v2.dto';
export type TempNoticeOfIntentDecisionConditionDto = UpdateNoticeOfIntentDecisionConditionDto & { tempUuid?: string };
export type SelectableComponent = { uuid?: string; tempId: string; decisionUuid: string; code: string; label: string };
@@ -32,7 +33,12 @@ export type SelectableComponent = { uuid?: string; tempId: string; decisionUuid:
export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy {
$destroy = new Subject();
- @Input() codes!: NoticeOfIntentDecisionCodesDto;
+ activeTypes!: NoticeOfIntentDecisionConditionTypeDto[];
+ @Input() set types(types: NoticeOfIntentDecisionConditionTypeDto[]) {
+ this.activeTypes = types.filter((type) => type.isActive);
+ console.log(this.activeTypes);
+ }
+ @Input() componentTypes!: DecisionComponentTypeDto[];
@Input() components: NoticeOfIntentDecisionComponentDto[] = [];
@Input() conditions: NoticeOfIntentDecisionConditionDto[] = [];
@Input() showError = false;
@@ -91,7 +97,7 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
}
onAddNewCondition(typeCode: string) {
- const matchingType = this.codes.decisionConditionTypes.find((code) => code.code === typeCode);
+ const matchingType = this.activeTypes.find((code) => code.code === typeCode);
this.mappedConditions.unshift({
type: matchingType,
tempUuid: (Math.random() * 10000).toFixed(0),
@@ -153,9 +159,8 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
private populateConditions(conditions: NoticeOfIntentDecisionConditionDto[]) {
this.mappedConditions = conditions.map((condition) => {
const selectedComponents = this.selectableComponents
- .filter(
- (component) =>
- condition.components?.map((conditionComponent) => conditionComponent.uuid).includes(component.uuid),
+ .filter((component) =>
+ condition.components?.map((conditionComponent) => conditionComponent.uuid).includes(component.uuid),
)
.map((e) => ({
componentDecisionUuid: e.decisionUuid,
@@ -178,7 +183,7 @@ export class DecisionConditionsComponent implements OnInit, OnChanges, OnDestroy
decisionYear: number | null,
) {
return components.map((component) => {
- const matchingType = this.codes.decisionComponentTypes.find(
+ const matchingType = this.componentTypes.find(
(type) => type.code === component.noticeOfIntentDecisionComponentTypeCode,
);
return {
diff --git a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-input-v2.component.html b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-input-v2.component.html
index dd8194848..d1de68c0e 100644
--- a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-input-v2.component.html
+++ b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-input-v2.component.html
@@ -27,7 +27,7 @@ Resolution
color="primary"
(click)="onGenerateResolutionNumber()"
[ngClass]="{
- 'error-field-outlined ng-invalid': !resolutionNumberControl.valid && resolutionNumberControl.touched
+ 'error-field-outlined ng-invalid': !resolutionNumberControl.valid && resolutionNumberControl.touched,
}"
>
Get Resolution Number
@@ -72,7 +72,7 @@ Resolution
id="decisionMaker"
formControlName="decisionMaker"
[ngClass]="{
- 'error-field-outlined': !form.controls.decisionMaker.valid && form.controls.decisionMaker.touched
+ 'error-field-outlined': !form.controls.decisionMaker.valid && form.controls.decisionMaker.touched,
}"
>
CEO Delegate
@@ -121,7 +121,7 @@ Resolution
(change)="onChangeSubjectToConditions($event)"
[ngClass]="{
'error-field-outlined':
- !form.controls.isSubjectToConditions.valid && form.controls.isSubjectToConditions.touched
+ !form.controls.isSubjectToConditions.valid && form.controls.isSubjectToConditions.touched,
}"
>
Yes
@@ -181,7 +181,8 @@ Resolution
Date: Thu, 5 Dec 2024 11:46:50 -0800
Subject: [PATCH 3/4] Add success toast when deleting condition types
---
.../application-decision-condition-types.service.ts | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/alcs-frontend/src/app/services/application/application-decision-condition-types/application-decision-condition-types.service.ts b/alcs-frontend/src/app/services/application/application-decision-condition-types/application-decision-condition-types.service.ts
index 2ecca20fd..f8e8d155c 100644
--- a/alcs-frontend/src/app/services/application/application-decision-condition-types/application-decision-condition-types.service.ts
+++ b/alcs-frontend/src/app/services/application/application-decision-condition-types/application-decision-condition-types.service.ts
@@ -48,9 +48,13 @@ export class ApplicationDecisionConditionTypesService {
return;
}
- async delete(code: string) {
+ async delete(code: string): Promise {
try {
- return await firstValueFrom(this.http.delete(`${this.url}/${code}`));
+ const response = await firstValueFrom(
+ this.http.delete(`${this.url}/${code}`),
+ );
+ this.toastService.showSuccessToast('Condition successfully deleted.');
+ return response;
} catch (e: any) {
if (e && e.error && e.error.message) {
this.toastService.showErrorToast(e.error.message);
From 80f8c503327c999aa316688d1ef563734e400372 Mon Sep 17 00:00:00 2001
From: Tristan Slater <1631008+trslater@users.noreply.github.com>
Date: Thu, 5 Dec 2024 12:37:01 -0800
Subject: [PATCH 4/4] Fix failing test
---
.../decision-conditions.component.spec.ts | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.spec.ts b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.spec.ts
index 88377045b..1c51ad521 100644
--- a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.spec.ts
+++ b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-conditions.component.spec.ts
@@ -40,11 +40,8 @@ describe('DecisionConditionComponent', () => {
fixture = TestBed.createComponent(DecisionConditionsComponent);
component = fixture.componentInstance;
- component.codes = {
- decisionComponentTypes: [],
- outcomes: [],
- decisionConditionTypes: [],
- };
+ component.types = [];
+ component.componentTypes = [];
fixture.detectChanges();
});