diff --git a/registrants/src/UI/embc-registrant/src/app/feature-components/self-serve-support/self-serve-support-details-form/self-serve-support-details-form.component.ts b/registrants/src/UI/embc-registrant/src/app/feature-components/self-serve-support/self-serve-support-details-form/self-serve-support-details-form.component.ts
index 18cfccc65..7bc8a9de5 100644
--- a/registrants/src/UI/embc-registrant/src/app/feature-components/self-serve-support/self-serve-support-details-form/self-serve-support-details-form.component.ts
+++ b/registrants/src/UI/embc-registrant/src/app/feature-components/self-serve-support/self-serve-support-details-form/self-serve-support-details-form.component.ts
@@ -69,6 +69,26 @@ export class SelfServeSupportDetailsFormComponent {
@Input()
set draftSupports(draftSupports: DraftSupports) {
+ this.supportEligibilityStateSettings[SelfServeSupportType.ShelterAllowance] = this.getEligibilityState(
+ SelfServeSupportType.ShelterAllowance
+ );
+
+ this.supportEligibilityStateSettings[SelfServeSupportType.FoodGroceries] = this.getEligibilityState(
+ SelfServeSupportType.FoodGroceries
+ );
+
+ this.supportEligibilityStateSettings[SelfServeSupportType.FoodRestaurant] = this.getEligibilityState(
+ SelfServeSupportType.FoodRestaurant
+ );
+
+ this.supportEligibilityStateSettings[SelfServeSupportType.Clothing] = this.getEligibilityState(
+ SelfServeSupportType.Clothing
+ );
+
+ this.supportEligibilityStateSettings[SelfServeSupportType.Incidentals] = this.getEligibilityState(
+ SelfServeSupportType.Incidentals
+ );
+
draftSupports.items.forEach((support) => {
switch (support.type) {
case SelfServeSupportType.ShelterAllowance:
@@ -124,15 +144,11 @@ export class SelfServeSupportDetailsFormComponent {
selfServeSupportFormGroup.controls.totalAmount.setValue(selfServeSupport.totalAmount ?? 0);
- this.supportEligibilityStateSettings[SelfServeSupportType.ShelterAllowance] = this.getEligibilityState(
- SelfServeSupportType.ShelterAllowance
- );
-
this.showSelfServeShelterAllowanceSupport = true;
}
getEligibilityState(type: SelfServeSupportType) {
- return this.evacuationFileDataService.selfServeEligibilityCheck.supportSettings.find((s) => s.type === type).state;
+ return this.evacuationFileDataService.selfServeEligibilityCheck.supportSettings.find((s) => s.type === type)?.state;
}
private createSelfServeFoodGroceriesSupportForm(
@@ -148,10 +164,6 @@ export class SelfServeSupportDetailsFormComponent {
selfServeSupportFormGroup.controls.totalAmount.setValue(selfServeSupport.totalAmount ?? 0);
- this.supportEligibilityStateSettings[SelfServeSupportType.FoodGroceries] = this.getEligibilityState(
- SelfServeSupportType.FoodGroceries
- );
-
this.showSelfServeFoodSupport = true;
this.hasSelfServeFoodGroceriesSupport = true;
@@ -298,10 +310,6 @@ export class SelfServeSupportDetailsFormComponent {
this.foodRestaurantDates = [...dates];
- this.supportEligibilityStateSettings[SelfServeSupportType.FoodRestaurant] = this.getEligibilityState(
- SelfServeSupportType.FoodRestaurant
- );
-
this.showSelfServeFoodSupport = true;
this.hasSelfServiceFoodRestaurantSupport = true;
@@ -323,10 +331,6 @@ export class SelfServeSupportDetailsFormComponent {
selfServeSupportFormGroup.controls.totalAmount.setValue(selfServeSupport.totalAmount ?? 0);
- this.supportEligibilityStateSettings[SelfServeSupportType.Clothing] = this.getEligibilityState(
- SelfServeSupportType.Clothing
- );
-
this.showSelfServeClothingSupport = true;
}
@@ -340,10 +344,6 @@ export class SelfServeSupportDetailsFormComponent {
selfServeSupportFormGroup.controls.totalAmount.setValue(selfServeSupport.totalAmount ?? 0);
- this.supportEligibilityStateSettings[SelfServeSupportType.Incidentals] = this.getEligibilityState(
- SelfServeSupportType.Incidentals
- );
-
this.showSelfServeIncidentsSupport = true;
}
diff --git a/registrants/src/UI/embc-registrant/src/app/sharedModules/components/evacuation-file/evacuation-file-data.service.ts b/registrants/src/UI/embc-registrant/src/app/sharedModules/components/evacuation-file/evacuation-file-data.service.ts
index b0f2ceb50..17b608ebd 100644
--- a/registrants/src/UI/embc-registrant/src/app/sharedModules/components/evacuation-file/evacuation-file-data.service.ts
+++ b/registrants/src/UI/embc-registrant/src/app/sharedModules/components/evacuation-file/evacuation-file-data.service.ts
@@ -7,7 +7,8 @@ import {
EvacuationFileStatus,
NeedsAssessment,
Support,
- SupportMethod
+ SupportMethod,
+ SupportStatus
} from 'src/app/core/api/models';
import { EvacuationsService, ProfileService, SupportsService } from 'src/app/core/api/services';
import { RegAddress } from 'src/app/core/model/address';
@@ -130,7 +131,9 @@ export class EvacuationFileDataService {
hasActiveSupports(supports?: Array
): boolean {
// if at least one support has support.to date time greater than now, then hasActiveSupports is true
- return supports.some((s) => moment(s.to).diff(moment()) > 0);
+ return supports.some(
+ (s) => ![SupportStatus.Void, SupportStatus.Cancelled].includes(s.status) && moment(s.to).diff(moment()) > 0
+ );
}
hasNoSupports(supports: Array): boolean {