From 9a1a681f7fe757d168fafb3d534b4e894e4789f5 Mon Sep 17 00:00:00 2001 From: Sam Warren Date: Thu, 24 Oct 2024 19:16:41 -0600 Subject: [PATCH 1/9] DEVOPS-43: Update backend to pass support limits to portal for calculation --- .../API/EMBC.ESS/Resources/Tasks/Contract.cs | 10 +++++++ .../API/EMBC.ESS/Resources/Tasks/Mappings.cs | 20 +++++++++++++ .../Resources/Tasks/TaskRepository.cs | 5 ++++ .../Controllers/TasksController.cs | 23 ++++++++++++++- .../EMBC.ESS.Shared.Contracts/Events/Tasks.cs | 29 +++++++++++++++++++ 5 files changed, 86 insertions(+), 1 deletion(-) diff --git a/ess/src/API/EMBC.ESS/Resources/Tasks/Contract.cs b/ess/src/API/EMBC.ESS/Resources/Tasks/Contract.cs index 58409ae88b..d727d8b700 100644 --- a/ess/src/API/EMBC.ESS/Resources/Tasks/Contract.cs +++ b/ess/src/API/EMBC.ESS/Resources/Tasks/Contract.cs @@ -47,11 +47,21 @@ public record EssTask : Task public bool RemoteExtensionsEnabled { get; set; } public bool SelfServeEnabled { get; set; } public IEnumerable EnabledSupports { get; set; } = []; + public IEnumerable SupportLimits { get; set; } = []; } public record SupportConfiguration { public SupportType SupportType { get; set; } + public DateTime SupportLimitStartDate { get; set; } + public DateTime SupportLimitEndDate { get; set; } + public SupportExtensionAvailable ExtensionAvailable { get; set; } +} + +public enum SupportExtensionAvailable +{ + No = 0, + Yes = 1 } public enum SupportType diff --git a/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs b/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs index e384e6caeb..cbcee21deb 100644 --- a/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs +++ b/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs @@ -20,10 +20,30 @@ public Mappings() .ForMember(d => d.SelfServeEnabled, opts => opts.MapFrom(s => s.era_selfservetoggle)) .ForMember(d => d.AutoApprovedEnabled, opts => opts.Ignore()) .ForMember(d => d.EnabledSupports, opts => opts.MapFrom(s => s.era_era_task_era_selfservesupportlimits_Task.Where(sl => sl.statuscode == 1))) + .ForMember(d => d.SupportLimits, opts => opts.MapFrom(s => s.era_era_task_era_supportlimit_Task.Where(sl => sl.statuscode == 1))) ; CreateMap() .ForMember(d => d.SupportType, opts => opts.MapFrom(s => s.era_supporttypeoption)) ; + + CreateMap() + .ForMember(d => d.SupportType, opts => opts.MapFrom(s => s.era_supporttypeoption)) + .ForMember(d => d.ExtensionAvailable, opts => opts.MapFrom(s => s.era_extensionavailable)) + .ForMember(d => d.SupportLimitStartDate, opts => opts.MapFrom(s => s.era_supportlimitstartdate.HasValue ? s.era_supportlimitstartdate.Value.UtcDateTime : (DateTime?)null)) + .ForMember(d => d.SupportLimitEndDate, opts => opts.MapFrom(s => s.era_supportlimitenddate.HasValue ? s.era_supportlimitenddate.Value.UtcDateTime : (DateTime?)null)) + ; + + CreateMap() + .ForMember(dest => dest.SupportType, opts => opts.MapFrom(src => src.SupportType)) + .ForMember(dest => dest.SupportLimitStartDate, opts => opts.MapFrom(src => src.SupportLimitStartDate)) + .ForMember(dest => dest.SupportLimitEndDate, opts => opts.MapFrom(src => src.SupportLimitEndDate)) + .ForMember(dest => dest.ExtensionAvailable, opts => opts.MapFrom(src => src.ExtensionAvailable)) + ; + + CreateMap() + .ForMember(dest => dest.SupportLimits, opts => opts.MapFrom(src => src.SupportLimits)) + .ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.Status)) + ; } } diff --git a/ess/src/API/EMBC.ESS/Resources/Tasks/TaskRepository.cs b/ess/src/API/EMBC.ESS/Resources/Tasks/TaskRepository.cs index 85ec512ba3..ce2a6b97ae 100644 --- a/ess/src/API/EMBC.ESS/Resources/Tasks/TaskRepository.cs +++ b/ess/src/API/EMBC.ESS/Resources/Tasks/TaskRepository.cs @@ -65,6 +65,7 @@ private async Task> QueryTasks(TaskQuery query, Cancellati essContext.era_tasks .Expand(t => t.era_JurisdictionID) .Expand(t => t.era_era_task_era_selfservesupportlimits_Task) + .Expand(t => t.era_era_task_era_supportlimit_Task) .Where(t => t.era_name == query.ById) .GetAllPagesAsync(ct)).ToList(); @@ -72,6 +73,10 @@ await Parallel.ForEachAsync(tasks, ct, async (t, ct1) => { var selfServeSupports = (await essContext.era_selfservesupportlimitses.Expand(sl => sl.era_SupportType).Where(sl => sl._era_task_value == t.era_taskid).GetAllPagesAsync(ct1)).ToList(); t.era_era_task_era_selfservesupportlimits_Task = new System.Collections.ObjectModel.Collection(selfServeSupports); + + var supportLimits = (await essContext.era_supportlimits.Expand(sl => sl.era_SupportType).Where(sl => sl._era_task_value == t.era_taskid).GetAllPagesAsync(ct1)).ToList(); + t.era_era_task_era_supportlimit_Task = new System.Collections.ObjectModel.Collection(supportLimits); + }); return tasks; diff --git a/responders/src/API/EMBC.Responders.API/Controllers/TasksController.cs b/responders/src/API/EMBC.Responders.API/Controllers/TasksController.cs index 1217755b89..dc7091e7d4 100644 --- a/responders/src/API/EMBC.Responders.API/Controllers/TasksController.cs +++ b/responders/src/API/EMBC.Responders.API/Controllers/TasksController.cs @@ -45,6 +45,7 @@ public async Task> GetTask(string taskId) if (task == null) return NotFound(taskId); var mappedTask = mapper.Map(task); mappedTask.Workflows = GetTaskWorkflows(task); + mappedTask.SupportLimits = GetTaskSupportLimits(task); return Ok(mappedTask); } @@ -60,6 +61,24 @@ private static IEnumerable GetTaskWorkflows(IncidentTask incidentT return workflows; } + private static IEnumerable GetTaskSupportLimits(IncidentTask incidentTask) + { + if (incidentTask.SupportLimits == null || !incidentTask.SupportLimits.Any()) + { + return Enumerable.Empty(); + } + + var supportLimits = incidentTask.SupportLimits.Select(sl => new SupportConfiguration + { + SupportType = sl.SupportType, + SupportLimitStartDate = sl.SupportLimitStartDate, + SupportLimitEndDate = sl.SupportLimitEndDate, + ExtensionAvailable = sl.ExtensionAvailable + }); + + return supportLimits; + } + [HttpGet("{taskId}/suppliers")] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status200OK)] @@ -96,6 +115,7 @@ public class ESSTask public string Description { get; set; } public string Status { get; set; } public IEnumerable Workflows { get; set; } = Array.Empty(); + public IEnumerable SupportLimits { get; set; } = Array.Empty(); } public class TaskWorkflow @@ -125,7 +145,8 @@ public class TaskMapping : Profile public TaskMapping() { CreateMap() - .ForMember(d => d.Workflows, opts => opts.Ignore()); + .ForMember(d => d.Workflows, opts => opts.Ignore()) + .ForMember(d => d.SupportLimits, opts => opts.MapFrom(s => s.SupportLimits)); CreateMap(); } } diff --git a/shared/src/EMBC.ESS.Shared.Contracts/Events/Tasks.cs b/shared/src/EMBC.ESS.Shared.Contracts/Events/Tasks.cs index 791f619bc0..f01d52492b 100644 --- a/shared/src/EMBC.ESS.Shared.Contracts/Events/Tasks.cs +++ b/shared/src/EMBC.ESS.Shared.Contracts/Events/Tasks.cs @@ -39,6 +39,7 @@ public class IncidentTask public IncidentTaskStatus Status { get; set; } public bool RemoteExtensionsEnabled { get; set; } public bool SelfServeEnabled { get; set; } + public IEnumerable SupportLimits { get; set; } } public enum IncidentTaskStatus @@ -46,4 +47,32 @@ public enum IncidentTaskStatus Active, Expired } + + public record SupportLimits + { + public SupportType SupportType { get; set; } + public DateTime SupportLimitStartDate { get; set; } + public DateTime SupportLimitEndDate { get; set; } + public SupportExtensionAvailable ExtensionAvailable { get; set; } + } + + public enum SupportExtensionAvailable + { + No = 0, + Yes = 1 + } + + public enum SupportType + { + FoodGroceries = 174360000, + FoodRestaurant = 174360001, + ShelterHotel = 174360002, + ShelterBilleting = 174360003, + ShelterGroup = 174360004, + Incidentals = 174360005, + Clothing = 174360006, + TransporationTaxi = 174360007, + TransportationOther = 174360008, + ShelterAllowance = 174360009 + } } From a8e8aa63217f1ffa1654b44afe51460fbd3dce39 Mon Sep 17 00:00:00 2001 From: Sam Warren Date: Fri, 25 Oct 2024 11:55:37 -0600 Subject: [PATCH 2/9] DEVOPS-43: Update name of model in controller --- .../EMBC.Responders.API/Controllers/TasksController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/responders/src/API/EMBC.Responders.API/Controllers/TasksController.cs b/responders/src/API/EMBC.Responders.API/Controllers/TasksController.cs index dc7091e7d4..3d6a9e913f 100644 --- a/responders/src/API/EMBC.Responders.API/Controllers/TasksController.cs +++ b/responders/src/API/EMBC.Responders.API/Controllers/TasksController.cs @@ -61,14 +61,14 @@ private static IEnumerable GetTaskWorkflows(IncidentTask incidentT return workflows; } - private static IEnumerable GetTaskSupportLimits(IncidentTask incidentTask) + private static IEnumerable GetTaskSupportLimits(IncidentTask incidentTask) { if (incidentTask.SupportLimits == null || !incidentTask.SupportLimits.Any()) { - return Enumerable.Empty(); + return Enumerable.Empty(); } - var supportLimits = incidentTask.SupportLimits.Select(sl => new SupportConfiguration + var supportLimits = incidentTask.SupportLimits.Select(sl => new SupportLimits { SupportType = sl.SupportType, SupportLimitStartDate = sl.SupportLimitStartDate, @@ -115,7 +115,7 @@ public class ESSTask public string Description { get; set; } public string Status { get; set; } public IEnumerable Workflows { get; set; } = Array.Empty(); - public IEnumerable SupportLimits { get; set; } = Array.Empty(); + public IEnumerable SupportLimits { get; set; } = Array.Empty(); } public class TaskWorkflow From 50f0deea7bde50d79e04b365a5107b7169e068bc Mon Sep 17 00:00:00 2001 From: Sam Warren Date: Fri, 25 Oct 2024 16:13:13 -0600 Subject: [PATCH 3/9] DEVOPS-43: Change ExtensionAvailable to boolean --- ess/src/API/EMBC.ESS/Resources/Tasks/Contract.cs | 8 +------- ess/src/API/EMBC.ESS/Resources/Tasks/TaskRepository.cs | 1 - shared/src/EMBC.ESS.Shared.Contracts/Events/Tasks.cs | 8 +------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/ess/src/API/EMBC.ESS/Resources/Tasks/Contract.cs b/ess/src/API/EMBC.ESS/Resources/Tasks/Contract.cs index d727d8b700..7a985a616e 100644 --- a/ess/src/API/EMBC.ESS/Resources/Tasks/Contract.cs +++ b/ess/src/API/EMBC.ESS/Resources/Tasks/Contract.cs @@ -55,13 +55,7 @@ public record SupportConfiguration public SupportType SupportType { get; set; } public DateTime SupportLimitStartDate { get; set; } public DateTime SupportLimitEndDate { get; set; } - public SupportExtensionAvailable ExtensionAvailable { get; set; } -} - -public enum SupportExtensionAvailable -{ - No = 0, - Yes = 1 + public bool ExtensionAvailable { get; set; } } public enum SupportType diff --git a/ess/src/API/EMBC.ESS/Resources/Tasks/TaskRepository.cs b/ess/src/API/EMBC.ESS/Resources/Tasks/TaskRepository.cs index ce2a6b97ae..553599e45c 100644 --- a/ess/src/API/EMBC.ESS/Resources/Tasks/TaskRepository.cs +++ b/ess/src/API/EMBC.ESS/Resources/Tasks/TaskRepository.cs @@ -76,7 +76,6 @@ await Parallel.ForEachAsync(tasks, ct, async (t, ct1) => var supportLimits = (await essContext.era_supportlimits.Expand(sl => sl.era_SupportType).Where(sl => sl._era_task_value == t.era_taskid).GetAllPagesAsync(ct1)).ToList(); t.era_era_task_era_supportlimit_Task = new System.Collections.ObjectModel.Collection(supportLimits); - }); return tasks; diff --git a/shared/src/EMBC.ESS.Shared.Contracts/Events/Tasks.cs b/shared/src/EMBC.ESS.Shared.Contracts/Events/Tasks.cs index f01d52492b..6f5f83c372 100644 --- a/shared/src/EMBC.ESS.Shared.Contracts/Events/Tasks.cs +++ b/shared/src/EMBC.ESS.Shared.Contracts/Events/Tasks.cs @@ -53,13 +53,7 @@ public record SupportLimits public SupportType SupportType { get; set; } public DateTime SupportLimitStartDate { get; set; } public DateTime SupportLimitEndDate { get; set; } - public SupportExtensionAvailable ExtensionAvailable { get; set; } - } - - public enum SupportExtensionAvailable - { - No = 0, - Yes = 1 + public bool ExtensionAvailable { get; set; } } public enum SupportType From 9a8201731725db70bbadae16fbad32b94d07f470 Mon Sep 17 00:00:00 2001 From: Sam Warren Date: Fri, 25 Oct 2024 16:13:58 -0600 Subject: [PATCH 4/9] DEVOPS-43: Add SupportLimits to ESS Task model --- .../embc-responder/src/app/core/api/models/ess-task.ts | 2 ++ .../src/app/core/api/models/support-limit.ts | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 responders/src/UI/embc-responder/src/app/core/api/models/support-limit.ts diff --git a/responders/src/UI/embc-responder/src/app/core/api/models/ess-task.ts b/responders/src/UI/embc-responder/src/app/core/api/models/ess-task.ts index f7ee7e4a38..b6beb7399f 100644 --- a/responders/src/UI/embc-responder/src/app/core/api/models/ess-task.ts +++ b/responders/src/UI/embc-responder/src/app/core/api/models/ess-task.ts @@ -1,6 +1,7 @@ /* tslint:disable */ /* eslint-disable */ import { TaskWorkflow } from '../models/task-workflow'; +import { SupportLimit } from './support-limit'; export interface EssTask { communityCode?: string | null; description?: string | null; @@ -9,4 +10,5 @@ export interface EssTask { startDate?: string; status?: string | null; workflows?: Array | null; + supportLimits?: Array | null; } diff --git a/responders/src/UI/embc-responder/src/app/core/api/models/support-limit.ts b/responders/src/UI/embc-responder/src/app/core/api/models/support-limit.ts new file mode 100644 index 0000000000..5cebd3e6d0 --- /dev/null +++ b/responders/src/UI/embc-responder/src/app/core/api/models/support-limit.ts @@ -0,0 +1,9 @@ +/* tslint:disable */ +/* eslint-disable */ +import { SupportSubCategory } from './support-sub-category'; +export interface SupportLimit { + supportLimitStartDate: Date; + supportLimitEndDate: Date; + extensionAvailable: boolean; + supportType: SupportSubCategory +} From cd3983a00c7bb3a57b59f3f2532dd38e782653b5 Mon Sep 17 00:00:00 2001 From: Sam Warren Date: Fri, 25 Oct 2024 17:09:20 -0600 Subject: [PATCH 5/9] DEVOPS-43: Update styles, component and template --- .../support-details.component.html | 62 +++++++----- .../support-details.component.ts | 95 ++++++++++++++++++- .../UI/embc-responder/src/styles/styles.scss | 5 + 3 files changed, 133 insertions(+), 29 deletions(-) diff --git a/responders/src/UI/embc-responder/src/app/feature-components/wizard/support-components/support-details/support-details.component.html b/responders/src/UI/embc-responder/src/app/feature-components/wizard/support-components/support-details/support-details.component.html index 51717bcf06..c968abcf25 100644 --- a/responders/src/UI/embc-responder/src/app/feature-components/wizard/support-components/support-details/support-details.component.html +++ b/responders/src/UI/embc-responder/src/app/feature-components/wizard/support-components/support-details/support-details.component.html @@ -377,38 +377,50 @@

- -
-
- All household members -
+
+ +
- @for (member of evacueeSessionService?.evacFile?.needsAssessment?.householdMembers; track member) { +
- {{ member.lastName | uppercase }}, {{ member.firstName | titlecase }}All household members
- } - @if ( - supportDetailsFormControl.members.invalid && - supportDetailsFormControl.members.hasError('noSelection') - ) { - Required - } - + @for (member of evacueeSessionService?.evacFile?.needsAssessment?.householdMembers; track member) { +
+
+ + {{ member.lastName | uppercase }}, {{ member.firstName | titlecase }} + + + @if (!isHouseholdMemberEligibleForSupport(member)) { + + {{ member.firstName | titlecase }} {{ member.lastName | titlecase }} has already received + this support. Extensions for this support are not available at this time. + + } +
+
+ } + @if ( + supportDetailsFormControl.members.invalid && + supportDetailsFormControl.members.hasError('noSelection') + ) { + Required + } +
@switch (stepSupportsService?.supportTypeToAdd?.value) { 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 08f44b8286..42ef83012b 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 @@ -1,5 +1,5 @@ -import { DatePipe, NgStyle, UpperCasePipe, TitleCasePipe } from '@angular/common'; -import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core'; +import { DatePipe, NgStyle, UpperCasePipe, TitleCasePipe, CommonModule } from '@angular/common'; +import { ChangeDetectionStrategy, Component, OnDestroy, OnInit, ChangeDetectorRef } from '@angular/core'; import { AbstractControl, UntypedFormArray, @@ -54,6 +54,7 @@ import { AppLoaderComponent } from '../../../../shared/components/app-loader/app import { MatInput } from '@angular/material/input'; import { MatFormField, MatPrefix, MatError, MatLabel, MatSuffix } from '@angular/material/form-field'; import { MatCard, MatCardContent } from '@angular/material/card'; +import { MatTooltipModule } from '@angular/material/tooltip'; @Component({ selector: 'app-support-details', @@ -80,6 +81,7 @@ import { MatCard, MatCardContent } from '@angular/material/card'; MatSelect, MatOption, MatCheckbox, + MatTooltipModule, ShelterAllowanceGroupComponent, FoodMealsComponent, FoodGroceriesComponent, @@ -93,7 +95,8 @@ import { MatCard, MatCardContent } from '@angular/material/card'; MatButton, UpperCasePipe, TitleCasePipe, - DatePipe + DatePipe, + CommonModule ] }) export class SupportDetailsComponent implements OnInit, OnDestroy { @@ -112,6 +115,8 @@ export class SupportDetailsComponent implements OnInit, OnDestroy { originalSupport: Support; existingSupports: Support[]; supportListSubscription: Subscription; + supportLimits: any; + supportLimitsSubscription: Subscription; constructor( private router: Router, @@ -126,6 +131,7 @@ export class SupportDetailsComponent implements OnInit, OnDestroy { private referralCreationService: ReferralCreationService, private dateConversionService: DateConversionService, private computeState: ComputeRulesService, + private cdr: ChangeDetectorRef, private loadEvacueeListService: LoadEvacueeListService ) { if (this.router.getCurrentNavigation() !== null) { @@ -235,6 +241,22 @@ export class SupportDetailsComponent implements OnInit, OnDestroy { }; ngOnInit(): void { + this.showLoader = true; + this.supportLimitsSubscription = this.stepSupportsService.fetchSupportLimits().subscribe({ + next: (supportLimits) => { + this.supportLimits = supportLimits; + this.showLoader = false; + this.cdr.detectChanges(); + }, + error: (error) => { + this.showLoader = false; + console.error("Error fetching support limits: ", error); + this.alertService.clearAlert(); + this.alertService.setAlert('danger', globalConst.supportListerror); + this.cdr.detectChanges(); + } + }); + this.supportListSubscription = this.stepSupportsService.getExistingSupportList().subscribe({ next: (supports) => { this.existingSupports = supports; @@ -277,8 +299,44 @@ export class SupportDetailsComponent implements OnInit, OnDestroy { ngOnDestroy(): void { this.supportListSubscription.unsubscribe(); + this.supportLimitsSubscription.unsubscribe(); } + isHouseholdMemberEligibleForSupport(member: EvacuationFileHouseholdMember): boolean { + if (!this.supportLimits || this.supportLimits.length === 0) { + return true; + } + const currentSupportType = this.stepSupportsService.supportTypeToAdd.description; + const matchingSupportLimit = this.supportLimits.find( + (limit) => this.mapSupportType(limit.supportType) === currentSupportType + ); + if (!matchingSupportLimit) { + return true; + } + if (matchingSupportLimit.extensionAvailable) { + return true; + } + const supportLimitStartDate = moment(matchingSupportLimit.supportLimitStartDate); + const supportLimitEndDate = moment(matchingSupportLimit.supportLimitEndDate); + const hasReceivedSupport = this.existingSupports.some((support) => { + const supportDate = moment(support.from); + return ( + support.category === currentSupportType && + support.includedHouseholdMembers?.some((m) => m === member.id) && + support.status !== SupportStatus.Cancelled.toString() && + support.status !== SupportStatus.Void.toString() && + supportDate.isBetween(supportLimitStartDate, supportLimitEndDate, 'days', '[]') + ); + }); + return !hasReceivedSupport; + } + + allMembersEligible(): boolean { + return this.evacueeSessionService?.evacFile?.needsAssessment?.householdMembers + .every(member => this.isHouseholdMemberEligibleForSupport(member)); + } + + checkDateRange(): boolean { const selectedFromDate = new Date(this.supportDetailsForm.get('fromDate').value); const updateFromDate = new Date(selectedFromDate.setDate(selectedFromDate.getDate() + 30)); @@ -378,7 +436,9 @@ export class SupportDetailsComponent implements OnInit, OnDestroy { if ($event.checked) { members.clear(); this.evacueeSessionService?.evacFile?.needsAssessment?.householdMembers.forEach((member) => { - members.push(new UntypedFormControl(member)); + if (this.isHouseholdMemberEligibleForSupport(member)) { + members.push(new UntypedFormControl(member)); + } }); } else { members.clear(); @@ -687,6 +747,33 @@ export class SupportDetailsComponent implements OnInit, OnDestroy { return largestToTime; } + private mapSupportType(supportType: number): SupportSubCategory | SupportCategory { + switch (supportType) { + case 174360000: + return SupportSubCategory.Food_Groceries; + case 174360001: + return SupportSubCategory.Food_Restaurant; + case 174360002: + return SupportSubCategory.Lodging_Hotel; + case 174360003: + return SupportSubCategory.Lodging_Billeting; + case 174360004: + return SupportSubCategory.Lodging_Group; + case 174360005: + return SupportCategory.Incidentals; + case 174360006: + return SupportCategory.Clothing; + case 174360007: + return SupportSubCategory.Transportation_Taxi; + case 174360008: + return SupportSubCategory.Transportation_Other; + case 174360009: + return SupportSubCategory.Lodging_Allowance; + default: + return SupportCategory.Unknown; + } + } + private setToTime() { if (this.evacueeSessionService.isPaperBased) { return this.stepSupportsService?.supportDetails?.toTime ? this.stepSupportsService?.supportDetails?.toTime : ''; diff --git a/responders/src/UI/embc-responder/src/styles/styles.scss b/responders/src/UI/embc-responder/src/styles/styles.scss index 7634b27d17..f1e172595d 100644 --- a/responders/src/UI/embc-responder/src/styles/styles.scss +++ b/responders/src/UI/embc-responder/src/styles/styles.scss @@ -371,6 +371,11 @@ mat-form-field { font-size: 75%; } +.custom-mat-info { + font-size: 75%; + color: #000 !important; +} + .mat-mdc-dialog-container { border-radius: 0px !important; } From 6d49811239c1d935e47525ed816ddd2ca7169ad0 Mon Sep 17 00:00:00 2001 From: Sam Warren Date: Fri, 25 Oct 2024 17:11:45 -0600 Subject: [PATCH 6/9] DEVOPS-43: Update service --- .../step-supports/step-supports.service.ts | 75 +++++++++++++------ 1 file changed, 53 insertions(+), 22 deletions(-) diff --git a/responders/src/UI/embc-responder/src/app/feature-components/wizard/step-supports/step-supports.service.ts b/responders/src/UI/embc-responder/src/app/feature-components/wizard/step-supports/step-supports.service.ts index 18a0dc8fe5..a85afb023b 100644 --- a/responders/src/UI/embc-responder/src/app/feature-components/wizard/step-supports/step-supports.service.ts +++ b/responders/src/UI/embc-responder/src/app/feature-components/wizard/step-supports/step-supports.service.ts @@ -31,6 +31,7 @@ import { DateConversionService } from 'src/app/core/services/utility/dateConvers import { ComputeRulesService } from 'src/app/core/services/computeRules.service'; import { AppBaseService } from 'src/app/core/services/helper/appBase.service'; import { EvacueeSessionService } from 'src/app/core/services/evacuee-session.service'; +import { SupportLimit } from 'src/app/core/api/models/support-limit'; @Injectable({ providedIn: 'root' }) export class StepSupportsService { @@ -41,6 +42,8 @@ export class StepSupportsService { private supportDetailsVal: SupportDetailsModel; private supportDeliveryVal: SupportDeliveryModel; private selectedSupportDetailVal: Support; + private supportLimitsVal: BehaviorSubject = new BehaviorSubject([]); + private supportLimitsVal$: Observable = this.supportLimitsVal.asObservable(); constructor( private essFileService: EssFileService, @@ -55,7 +58,7 @@ export class StepSupportsService { private appBaseService: AppBaseService, private computeState: ComputeRulesService, private evacueeSessionService: EvacueeSessionService - ) {} + ) { } set selectedSupportDetail(selectedSupportDetailVal: Support) { this.selectedSupportDetailVal = selectedSupportDetailVal; @@ -89,6 +92,34 @@ export class StepSupportsService { return this.existingSupportListVal$; } + setStoredSupportLimits(supportLimits: SupportLimit[]): void { + this.supportLimitsVal.next(supportLimits); + } + + getStoredSupportLimits(): Observable { + return this.supportLimitsVal$; + } + + fetchSupportLimits(): Observable { + return this.taskService.tasksGetTask({ + taskId: this.userService?.currentProfile?.taskNumber + }).pipe( + map((task) => { + const supportLimits: SupportLimit[] = task.supportLimits.map((supportLimit) => { + return { + supportLimitStartDate: supportLimit.supportLimitStartDate, + supportLimitEndDate: supportLimit.supportLimitEndDate, + extensionAvailable: supportLimit.extensionAvailable, + supportType: supportLimit.supportType + }; + }); + + this.setStoredSupportLimits(supportLimits); + return supportLimits; + }) + ); + } + set supportTypeToAdd(supportTypeToAddVal: Code) { this.supportTypeToAddVal = supportTypeToAddVal; this.cacheService.set('supportType', JSON.stringify(supportTypeToAddVal)); @@ -157,29 +188,29 @@ export class StepSupportsService { const referral: Referral | Interac = method === SupportMethod.Referral ? { - manualReferralId: - this.supportDetails.externalReferenceId !== undefined - ? 'R' + this.supportDetails.externalReferenceId - : '', - issuedToPersonName: - this.supportTypeToAdd.value === SupportSubCategory.Lodging_Allowance - ? this.supportDelivery.details.hostName - : (this.supportDelivery.issuedTo as any) !== 'Someone else' - ? this.supportDelivery.issuedTo.lastName + ', ' + this.supportDelivery.issuedTo.firstName - : this.supportDelivery.name, + manualReferralId: + this.supportDetails.externalReferenceId !== undefined + ? 'R' + this.supportDetails.externalReferenceId + : '', + issuedToPersonName: + this.supportTypeToAdd.value === SupportSubCategory.Lodging_Allowance + ? this.supportDelivery.details.hostName + : (this.supportDelivery.issuedTo as any) !== 'Someone else' + ? this.supportDelivery.issuedTo.lastName + ', ' + this.supportDelivery.issuedTo.firstName + : this.supportDelivery.name, - supplierAddress: this.supportDelivery.supplier.address, - supplierId: this.supportDelivery.supplier.id, - supplierName: this.supportDelivery.supplier.name, - supplierNotes: this.supportDelivery.supplierNote, - method: SupportMethod.Referral - } + supplierAddress: this.supportDelivery.supplier.address, + supplierId: this.supportDelivery.supplier.id, + supplierName: this.supportDelivery.supplier.name, + supplierNotes: this.supportDelivery.supplierNote, + method: SupportMethod.Referral + } : { - method: SupportMethod.ETransfer, - notificationEmail: this.supportDelivery.notificationEmail, - notificationMobile: this.supportDelivery.notificationMobile, - receivingRegistrantId: this.appBaseService?.appModel?.selectedProfile?.selectedEvacueeInContext.id - }; + method: SupportMethod.ETransfer, + notificationEmail: this.supportDelivery.notificationEmail, + notificationMobile: this.supportDelivery.notificationMobile, + receivingRegistrantId: this.appBaseService?.appModel?.selectedProfile?.selectedEvacueeInContext.id + }; const support: Support = { issuedBy: this.supportDetails.issuedBy, issuedOn: this.supportDetails.issuedOn, From 30402089798b314d5080ad6c805ace5cb6a1c6b6 Mon Sep 17 00:00:00 2001 From: Sam Warren Date: Tue, 29 Oct 2024 12:18:33 -0600 Subject: [PATCH 7/9] DEVOPS-43: Lint fix --- .../step-supports/step-supports.service.ts | 78 ++++++++++--------- .../support-details.component.ts | 8 +- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/responders/src/UI/embc-responder/src/app/feature-components/wizard/step-supports/step-supports.service.ts b/responders/src/UI/embc-responder/src/app/feature-components/wizard/step-supports/step-supports.service.ts index a85afb023b..72a59e594b 100644 --- a/responders/src/UI/embc-responder/src/app/feature-components/wizard/step-supports/step-supports.service.ts +++ b/responders/src/UI/embc-responder/src/app/feature-components/wizard/step-supports/step-supports.service.ts @@ -58,7 +58,7 @@ export class StepSupportsService { private appBaseService: AppBaseService, private computeState: ComputeRulesService, private evacueeSessionService: EvacueeSessionService - ) { } + ) {} set selectedSupportDetail(selectedSupportDetailVal: Support) { this.selectedSupportDetailVal = selectedSupportDetailVal; @@ -101,23 +101,25 @@ export class StepSupportsService { } fetchSupportLimits(): Observable { - return this.taskService.tasksGetTask({ - taskId: this.userService?.currentProfile?.taskNumber - }).pipe( - map((task) => { - const supportLimits: SupportLimit[] = task.supportLimits.map((supportLimit) => { - return { - supportLimitStartDate: supportLimit.supportLimitStartDate, - supportLimitEndDate: supportLimit.supportLimitEndDate, - extensionAvailable: supportLimit.extensionAvailable, - supportType: supportLimit.supportType - }; - }); - - this.setStoredSupportLimits(supportLimits); - return supportLimits; + return this.taskService + .tasksGetTask({ + taskId: this.userService?.currentProfile?.taskNumber }) - ); + .pipe( + map((task) => { + const supportLimits: SupportLimit[] = task.supportLimits.map((supportLimit) => { + return { + supportLimitStartDate: supportLimit.supportLimitStartDate, + supportLimitEndDate: supportLimit.supportLimitEndDate, + extensionAvailable: supportLimit.extensionAvailable, + supportType: supportLimit.supportType + }; + }); + + this.setStoredSupportLimits(supportLimits); + return supportLimits; + }) + ); } set supportTypeToAdd(supportTypeToAddVal: Code) { @@ -188,29 +190,29 @@ export class StepSupportsService { const referral: Referral | Interac = method === SupportMethod.Referral ? { - manualReferralId: - this.supportDetails.externalReferenceId !== undefined - ? 'R' + this.supportDetails.externalReferenceId - : '', - issuedToPersonName: - this.supportTypeToAdd.value === SupportSubCategory.Lodging_Allowance - ? this.supportDelivery.details.hostName - : (this.supportDelivery.issuedTo as any) !== 'Someone else' - ? this.supportDelivery.issuedTo.lastName + ', ' + this.supportDelivery.issuedTo.firstName - : this.supportDelivery.name, + manualReferralId: + this.supportDetails.externalReferenceId !== undefined + ? 'R' + this.supportDetails.externalReferenceId + : '', + issuedToPersonName: + this.supportTypeToAdd.value === SupportSubCategory.Lodging_Allowance + ? this.supportDelivery.details.hostName + : (this.supportDelivery.issuedTo as any) !== 'Someone else' + ? this.supportDelivery.issuedTo.lastName + ', ' + this.supportDelivery.issuedTo.firstName + : this.supportDelivery.name, - supplierAddress: this.supportDelivery.supplier.address, - supplierId: this.supportDelivery.supplier.id, - supplierName: this.supportDelivery.supplier.name, - supplierNotes: this.supportDelivery.supplierNote, - method: SupportMethod.Referral - } + supplierAddress: this.supportDelivery.supplier.address, + supplierId: this.supportDelivery.supplier.id, + supplierName: this.supportDelivery.supplier.name, + supplierNotes: this.supportDelivery.supplierNote, + method: SupportMethod.Referral + } : { - method: SupportMethod.ETransfer, - notificationEmail: this.supportDelivery.notificationEmail, - notificationMobile: this.supportDelivery.notificationMobile, - receivingRegistrantId: this.appBaseService?.appModel?.selectedProfile?.selectedEvacueeInContext.id - }; + method: SupportMethod.ETransfer, + notificationEmail: this.supportDelivery.notificationEmail, + notificationMobile: this.supportDelivery.notificationMobile, + receivingRegistrantId: this.appBaseService?.appModel?.selectedProfile?.selectedEvacueeInContext.id + }; const support: Support = { issuedBy: this.supportDetails.issuedBy, issuedOn: this.supportDetails.issuedOn, 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 42ef83012b..0df0273859 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 @@ -250,7 +250,7 @@ export class SupportDetailsComponent implements OnInit, OnDestroy { }, error: (error) => { this.showLoader = false; - console.error("Error fetching support limits: ", error); + console.error('Error fetching support limits: ', error); this.alertService.clearAlert(); this.alertService.setAlert('danger', globalConst.supportListerror); this.cdr.detectChanges(); @@ -332,11 +332,11 @@ export class SupportDetailsComponent implements OnInit, OnDestroy { } allMembersEligible(): boolean { - return this.evacueeSessionService?.evacFile?.needsAssessment?.householdMembers - .every(member => this.isHouseholdMemberEligibleForSupport(member)); + return this.evacueeSessionService?.evacFile?.needsAssessment?.householdMembers.every((member) => + this.isHouseholdMemberEligibleForSupport(member) + ); } - checkDateRange(): boolean { const selectedFromDate = new Date(this.supportDetailsForm.get('fromDate').value); const updateFromDate = new Date(selectedFromDate.setDate(selectedFromDate.getDate() + 30)); From cc44643da0c88c701ea548cf8ec9eae213e4a790 Mon Sep 17 00:00:00 2001 From: Sam Warren Date: Tue, 29 Oct 2024 12:23:32 -0600 Subject: [PATCH 8/9] DEVOPS-43: Remove duplicate mapping --- ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs b/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs index cbcee21deb..4c35dcc258 100644 --- a/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs +++ b/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs @@ -40,10 +40,5 @@ public Mappings() .ForMember(dest => dest.SupportLimitEndDate, opts => opts.MapFrom(src => src.SupportLimitEndDate)) .ForMember(dest => dest.ExtensionAvailable, opts => opts.MapFrom(src => src.ExtensionAvailable)) ; - - CreateMap() - .ForMember(dest => dest.SupportLimits, opts => opts.MapFrom(src => src.SupportLimits)) - .ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.Status)) - ; } } From c1b14ca537696e4df030a2cbcf1338d719eaec98 Mon Sep 17 00:00:00 2001 From: Sam Warren Date: Wed, 30 Oct 2024 11:25:39 -0600 Subject: [PATCH 9/9] DEVOPS-43: Add missing maps to self serve --- ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs b/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs index 4c35dcc258..ce9ebd7d49 100644 --- a/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs +++ b/ess/src/API/EMBC.ESS/Resources/Tasks/Mappings.cs @@ -25,6 +25,9 @@ public Mappings() CreateMap() .ForMember(d => d.SupportType, opts => opts.MapFrom(s => s.era_supporttypeoption)) + .ForMember(d => d.ExtensionAvailable, opts => opts.MapFrom(s => s.era_extensionavailable)) + .ForMember(d => d.SupportLimitStartDate, opts => opts.MapFrom(s => s.era_supportlimitstartdate.HasValue ? s.era_supportlimitstartdate.Value.UtcDateTime : (DateTime?)null)) + .ForMember(d => d.SupportLimitEndDate, opts => opts.MapFrom(s => s.era_supportlimitenddate.HasValue ? s.era_supportlimitenddate.Value.UtcDateTime : (DateTime?)null)) ; CreateMap()