Skip to content

Commit

Permalink
Merge pull request #1844 from KyleKayfish/EMBCESSMOD-4754
Browse files Browse the repository at this point in the history
EMBCESSMOD-4754 - Adding frontend warning for food-groceries & food-r…
  • Loading branch information
KyleKayfish authored Nov 30, 2023
2 parents 08a6722 + 60c2acc commit d7b88d5
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d7b88d5

Please sign in to comment.