Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMBCESSMOD-4909: Shelter allowance needs changes in responders portal #2007

Merged
merged 10 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions ess/src/API/EMBC.ESS/Resources/Evacuations/Mappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ public Mappings()
.ForMember(d => d.era_needsassessmenttype, opts => opts.MapFrom(s => (int?)Enum.Parse<NeedsAssessmentTypeOptionSet>(s.Type.ToString())))
.ForMember(d => d.era_canevacueeprovidefood, opts => opts.MapFrom(s => s.Needs.Contains(IdentifiedNeed.Food) ? (int)NeedTrueFalse.False : (int)NeedTrueFalse.True))
.ForMember(d => d.era_canevacueeprovideclothing, opts => opts.MapFrom(s => s.Needs.Contains(IdentifiedNeed.Clothing) ? (int)NeedTrueFalse.False : (int)NeedTrueFalse.True))
.ForMember(d => d.era_canevacueeprovideincidentals, opts => opts.MapFrom(s => s.Needs.Contains(IdentifiedNeed.Clothing) ? (int)NeedTrueFalse.False : (int)NeedTrueFalse.True))
.ForMember(d => d.era_canevacueeprovidelodging, opts => opts.MapFrom(s => s.Needs.Contains(IdentifiedNeed.ShelterReferral) ? (int)NeedTrueFalse.False : (int)NeedTrueFalse.True))
.ForMember(d => d.era_canevacueeprovideincidentals, opts => opts.MapFrom(s => s.Needs.Contains(IdentifiedNeed.Incidentals) ? (int)NeedTrueFalse.False : (int)NeedTrueFalse.True))
.ForMember(d => d.era_canevacueeprovidetransportation, opts => opts.MapFrom(s => s.Needs.Contains(IdentifiedNeed.Transportation) ? (int)NeedTrueFalse.False : (int)NeedTrueFalse.True))
.ForMember(d => d.era_insurancecoverage, opts => opts.MapFrom(s => (int?)Enum.Parse<InsuranceOptionOptionSet>(s.Insurance.ToString())))
.ForMember(d => d.era_addressline1, opts => opts.MapFrom(s => s.EvacuatedFrom.AddressLine1))
Expand All @@ -80,6 +79,17 @@ public Mappings()
.ForMember(d => d._era_jurisdictionid_value, opts => opts.MapFrom(s => s.EvacuatedFrom.CommunityCode))
.ForMember(d => d.era_era_householdmember_era_needassessment, opts => opts.MapFrom(s => s.HouseholdMembers))
.ForPath(d => d.era_registrationlocation, opts => opts.Ignore())
.AfterMap((s, d) =>
{
if (s.Needs.Contains(IdentifiedNeed.ShelterReferral))
{
d.era_shelteroptions = (int)ShelterOptionSet.Referral;
}
else if (s.Needs.Contains(IdentifiedNeed.ShelterAllowance))
{
d.era_shelteroptions = (int)ShelterOptionSet.Allowance;
}
})
;

CreateMap<era_needassessment, EvacuationAddress>()
Expand Down Expand Up @@ -108,8 +118,9 @@ public Mappings()
if (s.era_canevacueeprovideclothing.GetValueOrDefault(0) == (int)NeedTrueFalse.False) needs.Add(IdentifiedNeed.Clothing);
if (s.era_canevacueeprovidefood.GetValueOrDefault(0) == (int)NeedTrueFalse.False) needs.Add(IdentifiedNeed.Food);
if (s.era_canevacueeprovideincidentals.GetValueOrDefault(0) == (int)NeedTrueFalse.False) needs.Add(IdentifiedNeed.Incidentals);
if (s.era_canevacueeprovidelodging.GetValueOrDefault(0) == (int)NeedTrueFalse.False) needs.Add(IdentifiedNeed.ShelterReferral);
if (s.era_canevacueeprovidetransportation.GetValueOrDefault(0) == (int)NeedTrueFalse.False) needs.Add(IdentifiedNeed.Transportation);
if (s.era_shelteroptions.GetValueOrDefault(0) == (int)ShelterOptionSet.Allowance) needs.Add(IdentifiedNeed.ShelterAllowance);
if (s.era_shelteroptions.GetValueOrDefault(0) == (int)ShelterOptionSet.Referral) needs.Add(IdentifiedNeed.ShelterReferral);
d.Needs = needs;
})
;
Expand Down Expand Up @@ -206,6 +217,12 @@ public enum NeedTrueFalse
False = 174360001
}

public enum ShelterOptionSet
{
Allowance = 174360000,
Referral = 174360001
}

#pragma warning restore CA1008 // Enums should have zero value

public class SecurityPhraseConverter : IValueConverter<string, string>
Expand Down
48 changes: 36 additions & 12 deletions responders/src/UI/embc-responder/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
{
"root": true,
"ignorePatterns": ["projects/**/*"],
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": ["*.ts"],
"files": [
"*.ts"
],
"parserOptions": {
"project": ["tsconfig.json", "e2e/tsconfig.json"],
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
Expand All @@ -14,11 +21,12 @@
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:prettier/recommended"
],
"plugins": ["deprecation"],
"plugins": [
"deprecation"
],
"rules": {
"no-shadow": "off",
"deprecation/deprecation": "error",
"@typescript-eslint/no-shadow": ["error"],
"@angular-eslint/component-selector": [
"error",
{
Expand All @@ -34,21 +42,37 @@
"prefix": "app",
"style": "camelCase"
}
]
],
"max-len": "off"
}
},
{
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
},
{
"files": ["*.html"],
"excludedFiles": ["*inline-template-*.component.html"],
"extends": ["plugin:prettier/recommended"],
"files": [
"*.html"
],
"excludedFiles": [
"*inline-template-*.component.html"
],
"extends": [
"plugin:prettier/recommended"
],
"rules": {
// NOTE: WE ARE OVERRIDING THE DEFAULT CONFIG TO ALWAYS SET THE PARSER TO ANGULAR (SEE BELOW)
"prettier/prettier": ["error", { "parser": "angular" }]
"prettier/prettier": [
"error",
{
"parser": "angular"
}
]
}
}
]
Expand Down
9 changes: 5 additions & 4 deletions responders/src/UI/embc-responder/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"singleQuote": true,
"trailingComma": "none",
"endOfLine": "auto"
}
"singleQuote": true,
"trailingComma": "none",
"endOfLine": "auto",
"printWidth": 180
}
4 changes: 2 additions & 2 deletions responders/src/UI/embc-responder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"gen-api": "ng-openapi-gen -i https://era-responders-dev.apps.silver.devops.gov.bc.ca/api/openapi/v1/openapi.json -o ./src/app/core/api --ignoreUnusedModels false",
"gen-api": "ng-openapi-gen -i https://dev-era-responders.apps.silver.devops.gov.bc.ca/api/openapi/v1/openapi.json -o ./src/app/core/api --ignoreUnusedModels false",
"gen-api-local": "ng-openapi-gen -i http://localhost:6020/api/openapi/v1/openapi.json -o ./src/app/core/api --ignoreUnusedModels false"
},
"private": true,
Expand Down Expand Up @@ -70,4 +70,4 @@
"ts-node": "~8.3.0",
"typescript": "~4.7.4"
}
}
}
2 changes: 1 addition & 1 deletion responders/src/UI/embc-responder/proxy.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},

"/env/info.json": {
"target": "https://era-responders-dev.apps.silver.devops.gov.bc.ca",
"target": "https://dev-era-responders.apps.silver.devops.gov.bc.ca",
"secure": false,
"changeOrigin": true,
"logLevel": "debug"
Expand Down
6 changes: 3 additions & 3 deletions responders/src/UI/embc-responder/proxy.dev.conf.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"/api": {
"target": "https://era-responders-dev.apps.silver.devops.gov.bc.ca",
"target": "https://dev-era-responders.apps.silver.devops.gov.bc.ca",
"secure": false,
"changeOrigin": true,
"logLevel": "debug"
},

"/env/info.json": {
"target": "https://era-responders-dev.apps.silver.devops.gov.bc.ca",
"target": "https://dev-era-responders.apps.silver.devops.gov.bc.ca",
"secure": false,
"changeOrigin": true,
"logLevel": "debug"
},
"/version": {
"target": "https://era-responders-dev.apps.silver.devops.gov.bc.ca",
"target": "https://dev-era-responders.apps.silver.devops.gov.bc.ca",
"secure": false,
"changeOrigin": true,
"logLevel": "debug"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Injectable } from '@angular/core';
providedIn: 'root',
})
export class ApiConfiguration {
rootUrl: string = 'http://localhost:6020';
rootUrl: string = 'https://dev-era-responders.apps.silver.devops.gov.bc.ca';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export { EvacuationFileHouseholdMember } from './models/evacuation-file-househol
export { HouseholdMemberType } from './models/household-member-type';
export { Pet } from './models/pet';
export { NeedsAssessmentType } from './models/needs-assessment-type';
export { IdentifiedNeed } from './models/identified-need';
export { Note } from './models/note';
export { Support } from './models/support';
export { SupportStatus } from './models/support-status';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* tslint:disable */
/* eslint-disable */
export enum IdentifiedNeed {
ShelterReferral = 'ShelterReferral',
ShelterAllowance = 'ShelterAllowance',
Tranportation = 'Tranportation',
Food = 'Food',
Incidentals = 'Incidentals',
Clothing = 'Clothing'
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* tslint:disable */
/* eslint-disable */
import { EvacuationFileHouseholdMember } from './evacuation-file-household-member';
import { IdentifiedNeed } from './identified-need';
import { InsuranceOption } from './insurance-option';
import { NeedsAssessmentType } from './needs-assessment-type';
import { Pet } from './pet';
Expand All @@ -9,16 +10,12 @@ import { Pet } from './pet';
* Needs assessment form
*/
export interface NeedsAssessment {
canProvideClothing?: null | boolean;
canProvideFood?: null | boolean;
canProvideIncidentals?: null | boolean;
canProvideLodging?: null | boolean;
canProvideTransportation?: null | boolean;
createdOn?: null | string;
householdMembers: Array<EvacuationFileHouseholdMember>;
id?: null | string;
insurance: InsuranceOption;
modifiedOn?: null | string;
needs?: Array<IdentifiedNeed>;
pets?: Array<Pet>;
reviewingTeamMemberDisplayName?: null | string;
reviewingTeamMemberId?: null | string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum SupportSubCategory {
Lodging_Hotel = 'Lodging_Hotel',
Lodging_Billeting = 'Lodging_Billeting',
Lodging_Group = 'Lodging_Group',
Lodging_Allowance = 'Lodging_Allowance',
Food_Groceries = 'Food_Groceries',
Food_Restaurant = 'Food_Restaurant',
Transportation_Taxi = 'Transportation_Taxi',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {
AbstractControl,
FormGroup,
UntypedFormGroup,
ValidationErrors,
ValidatorFn,
Validators
} from '@angular/forms';
Expand Down Expand Up @@ -388,4 +390,20 @@ export class CustomValidationService {
}
};
}

public needsValidator(): ValidatorFn {
return (group: FormGroup): ValidationErrors | null => {
const anyNeedsIdentified = group.controls['requiresShelterType'].value ||
group.controls['requiresFood'].value ||
group.controls['requiresClothing'].value ||
group.controls['requiresIncidentals'].value ||
group.controls['requiresTransportation'].value;

const noNeedsIdentified = group.controls['requiresNothing'].value;
if (!anyNeedsIdentified && !noNeedsIdentified) {
return { invalid: true };
};
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ export const insuranceOptions = [
{ name: 'No', value: 'No' },
{ name: "I don't know", value: 'Unknown' }
];
export const needsOptions = [
{ name: 'Yes', value: 'Yes', apiValue: true },
{ name: 'No', value: 'No', apiValue: false },
{ name: "I'm not sure", value: 'Unsure', apiValue: null }
];

export const radioButtonOptions = [
{ name: 'Yes', value: 'Yes', apiValue: true },
{ name: 'No', value: 'No', apiValue: false }
Expand Down Expand Up @@ -579,6 +575,8 @@ export const supportReprintReasonsError =
'Unable to retrieve support reprint reasons at this time. Please try again later';
export const communityTypesError =
'Unable to retrieve community types at this time. Please try again later';
export const identifiedNeedsError =
'Unable to retrieve identified needs at this time. Please try again later';
export const securityPhraseError =
'Unable to retrieve security phrase at this time. Please try again later';
export const verifySecurityPhraseError =
Expand Down Expand Up @@ -675,3 +673,18 @@ export const caseNotesCompleteText: DashboardBanner = {
content:
'Task number end date has expired. Add or Edit Case Notes associated with the Current ESS File.'
};

export const shelterAllowanceNeedDialog: DialogContent = {
title: 'Shelter',
text: 'A shelter allowance of $30 per night based on single occupancy ($10 for each additional adult and youth, and $5 for each child<br/>The shelter allowance can be provided to eligible evacuees via e-Transfer.'
};

export const shelterReferralNeedDialog: DialogContent = {
title: 'Referrals',
text: 'A paper form provided by an ESS responder, directing evacuated individuals to specific suppliers or facilities for essential needs like food, shelter, clothing, or other necessary items during the evacuation.'
};

export const incidentalsNeedDialog: DialogContent = {
title: 'Incidentals',
text: 'Incidentals could include miscellaneous items such as personal hygiene products such as toothpaste, laundry soap and/or pet food.'
};
Loading