From 9753dc98715f3d8bd8fe415116009ca5a81bd118 Mon Sep 17 00:00:00 2001
From: Tristan Slater <1631008+trslater@users.noreply.github.com>
Date: Mon, 16 Dec 2024 14:39:45 -0800
Subject: [PATCH 1/3] Allow saving of dates to unsaved conditions
---
.../decision-condition/decision-condition.component.ts | 3 ---
1 file changed, 3 deletions(-)
diff --git a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
index 4f179f4b51..1a7d75785c 100644
--- a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
+++ b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
@@ -213,9 +213,6 @@ export class DecisionConditionComponent implements OnInit, OnChanges {
})
.beforeClosed()
.subscribe(async (dates: DueDate[]) => {
- if (!this.uuid) {
- return;
- }
this.dates = dates.map((date) => ({
uuid: date.uuid,
date: date.date?.toDate().getTime(),
From 4f8bd33df56a9434f48796410c1a6f88735b5ea3 Mon Sep 17 00:00:00 2001
From: Tristan Slater <1631008+trslater@users.noreply.github.com>
Date: Mon, 16 Dec 2024 15:16:34 -0800
Subject: [PATCH 2/3] Fix browser error on cancel date dialog
---
.../decision-condition-date-dialog.component.html | 2 +-
.../decision-condition-date-dialog.component.ts | 4 ++++
.../decision-condition/decision-condition.component.ts | 5 ++++-
.../decision-condition/decision-condition.component.ts | 5 ++++-
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition-date-dialog/decision-condition-date-dialog.component.html b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition-date-dialog/decision-condition-date-dialog.component.html
index 18830a1d1d..2af5436823 100644
--- a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition-date-dialog/decision-condition-date-dialog.component.html
+++ b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition-date-dialog/decision-condition-date-dialog.component.html
@@ -54,7 +54,7 @@
{{ isAdding ? 'Add' : 'Edit' }} Due Dates
-
+
diff --git a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition-date-dialog/decision-condition-date-dialog.component.ts b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition-date-dialog/decision-condition-date-dialog.component.ts
index 39d83ce0db..6a766cfe27 100644
--- a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition-date-dialog/decision-condition-date-dialog.component.ts
+++ b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition-date-dialog/decision-condition-date-dialog.component.ts
@@ -59,4 +59,8 @@ export class DecisionConditionDateDialogComponent {
async onSubmit() {
this.dialogRef.close(this.dates);
}
+
+ async onCancel() {
+ this.dialogRef.close(null);
+ }
}
diff --git a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
index f68674593f..a16894f91c 100644
--- a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
+++ b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
@@ -212,7 +212,10 @@ export class DecisionConditionComponent implements OnInit, OnChanges {
},
})
.beforeClosed()
- .subscribe(async (dates: DueDate[]) => {
+ .subscribe(async (dates: DueDate[] | null) => {
+ if (!dates) {
+ return;
+ }
this.dates = dates.map((date) => ({
uuid: date.uuid,
date: date.date?.toDate().getTime(),
diff --git a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
index 1a7d75785c..556c0f8133 100644
--- a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
+++ b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
@@ -212,7 +212,10 @@ export class DecisionConditionComponent implements OnInit, OnChanges {
},
})
.beforeClosed()
- .subscribe(async (dates: DueDate[]) => {
+ .subscribe(async (dates: DueDate[] | null) => {
+ if (!dates) {
+ return;
+ }
this.dates = dates.map((date) => ({
uuid: date.uuid,
date: date.date?.toDate().getTime(),
From 56fd31ba98e2d03621c533ffc92f50505abe2d72 Mon Sep 17 00:00:00 2001
From: Tristan Slater <1631008+trslater@users.noreply.github.com>
Date: Mon, 16 Dec 2024 15:54:38 -0800
Subject: [PATCH 3/3] Sort condition dates on setting
---
.../decision-condition/decision-condition.component.ts | 8 +++++++-
.../decision-condition/decision-condition.component.ts | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
index a16894f91c..c5ff5e89f1 100644
--- a/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
+++ b/alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
@@ -34,7 +34,13 @@ export class DecisionConditionComponent implements OnInit, OnChanges {
uuid: string | undefined;
- dates: ApplicationDecisionConditionDateDto[] = [];
+ private _dates: ApplicationDecisionConditionDateDto[] = [];
+ set dates(dates: ApplicationDecisionConditionDateDto[]) {
+ this._dates = dates.sort((a, b) => (a.date && b.date ? a.date - b.date : -1));
+ }
+ get dates(): ApplicationDecisionConditionDateDto[] {
+ return this._dates;
+ }
singleDateLabel = 'End Date';
showSingleDateField = false;
diff --git a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
index 556c0f8133..eca6d96379 100644
--- a/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
+++ b/alcs-frontend/src/app/features/notice-of-intent/decision/decision-v2/decision-input/decision-conditions/decision-condition/decision-condition.component.ts
@@ -34,7 +34,13 @@ export class DecisionConditionComponent implements OnInit, OnChanges {
uuid: string | undefined;
- dates: NoticeOfIntentDecisionConditionDateDto[] = [];
+ private _dates: NoticeOfIntentDecisionConditionDateDto[] = [];
+ set dates(dates: NoticeOfIntentDecisionConditionDateDto[]) {
+ this._dates = dates.sort((a, b) => (a.date && b.date ? a.date - b.date : -1));
+ }
+ get dates(): NoticeOfIntentDecisionConditionDateDto[] {
+ return this._dates;
+ }
singleDateLabel = 'End Date';
showSingleDateField = false;