From 8a4ce4ece025e6fcb80f193bf22688bb1edcce12 Mon Sep 17 00:00:00 2001 From: KKAYFISH Date: Wed, 22 Nov 2023 08:37:48 -0800 Subject: [PATCH] EMBCESSMOD-4754 - Adding frontend warning for food-groceries & food-restaurant as duplicate supports. --- .../support-details.component.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/responders/src/UI/embc-responder/src/app/feature-components/wizard/support-components/support-details/support-details.component.ts b/responders/src/UI/embc-responder/src/app/feature-components/wizard/support-components/support-details/support-details.component.ts index 373e0a877..ee24f666b 100644 --- a/responders/src/UI/embc-responder/src/app/feature-components/wizard/support-components/support-details/support-details.component.ts +++ b/responders/src/UI/embc-responder/src/app/feature-components/wizard/support-components/support-details/support-details.component.ts @@ -404,11 +404,18 @@ export class SupportDetailsComponent implements OnInit, OnDestroy { thisSupport.toTime ); const overlappingSupports = existingSupports.filter( - (s) => - this.generateSupportType(s) === - this.stepSupportsService.supportTypeToAdd.description && - moment(to).isSameOrAfter(moment(s.from)) && - moment(from).isSameOrBefore(moment(s.to)) + (s) => { + if (this.stepSupportsService.supportTypeToAdd.description === SupportSubCategory.Food_Groceries || this.stepSupportsService.supportTypeToAdd.description === SupportSubCategory.Food_Restaurant) { + this.generateSupportType(s) === SupportSubCategory.Food_Groceries || this.generateSupportType(s) === SupportSubCategory.Food_Restaurant && + moment(to).isSameOrAfter(moment(s.from)) && + moment(from).isSameOrBefore(moment(s.to)) + } else { + this.generateSupportType(s) === + this.stepSupportsService.supportTypeToAdd.description && + moment(to).isSameOrAfter(moment(s.from)) && + moment(from).isSameOrBefore(moment(s.to)) + } + } ); hasConflict = overlappingSupports.length > 0;