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-4901, EMBCESSMOD-4909: needs assessment UI changes #1980

Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export interface NeedsAssessment {
canEvacueeProvideFood?: null | boolean;
canEvacueeProvideIncidentals?: null | boolean;
canEvacueeProvideLodging?: null | boolean;
shelterOption?: null | string;
canEvacueeProvideTransportation?: null | boolean;
doesEvacueeNotRequireAssistance?: null | boolean;
householdMembers?: Array<HouseholdMember>;
id?: null | string;
insurance: InsuranceOption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,39 +168,45 @@ export class IdentifyNeeds {
canEvacueeProvideFood: boolean;
canEvacueeProvideIncidentals: boolean;
canEvacueeProvideLodging: boolean;
shelterOptions: boolean;
canEvacueeProvideTransportation: boolean;
doesEvacueeNotRequireAssistance: boolean;
}

export class IdentifyNeedsForm {
canEvacueeProvideClothing = new UntypedFormControl();
canEvacueeProvideFood = new UntypedFormControl();
canEvacueeProvideIncidentals = new UntypedFormControl();
canEvacueeProvideLodging = new UntypedFormControl();
shelterOptions = new UntypedFormControl();
doesEvacueeNotRequireAssistance = new UntypedFormControl();
canEvacueeProvideTransportation = new UntypedFormControl();

constructor(identifyNeeds: IdentifyNeeds) {
this.canEvacueeProvideClothing.setValue(
identifyNeeds.canEvacueeProvideClothing
);
identifyNeeds.canEvacueeProvideClothing?? false);
this.canEvacueeProvideClothing.setValidators([Validators.required]);
this.canEvacueeProvideIncidentals.setErrors({ 'error': true });

this.canEvacueeProvideFood.setValue(identifyNeeds.canEvacueeProvideFood);
this.canEvacueeProvideFood.setValidators([Validators.required]);
this.canEvacueeProvideFood.setValue(
identifyNeeds.canEvacueeProvideFood ?? false);
this.canEvacueeProvideFood.setValidators([Validators.required]);
this.canEvacueeProvideIncidentals.setErrors({ 'error': true });

this.canEvacueeProvideIncidentals.setValue(
identifyNeeds.canEvacueeProvideIncidentals
);
identifyNeeds.canEvacueeProvideIncidentals ?? false);
this.canEvacueeProvideIncidentals.setValidators([Validators.required]);
this.canEvacueeProvideIncidentals.setErrors({ 'error': true });

this.canEvacueeProvideLodging.setValue(
identifyNeeds.canEvacueeProvideLodging
);
this.canEvacueeProvideLodging.setValidators([Validators.required]);

this.canEvacueeProvideTransportation.setValue(
identifyNeeds.canEvacueeProvideTransportation
);
this.canEvacueeProvideTransportation.setValidators([Validators.required]);
identifyNeeds.canEvacueeProvideLodging ?? false);
this.canEvacueeProvideLodging.setValidators([Validators.required]);
this.canEvacueeProvideIncidentals.setErrors({ 'error': true });

this.shelterOptions.setValue(identifyNeeds.shelterOptions);

this.doesEvacueeNotRequireAssistance.setValue(null);
this.doesEvacueeNotRequireAssistance.setValidators([Validators.required]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const usDefaultObject = {
export const zipCodePattern = '^([0-9]{5}-[0-9]{4}|[0-9]{5})$';
export const petsQuantityPattern = '^([1-9][0-9]{0,2})$';

export const radioButton1 = [
export const booleanOptions = [
{ name: 'Yes', value: true },
{ name: 'No', value: false }
];
Expand All @@ -27,12 +27,6 @@ export const insuranceOptions = [
{ name: 'Unknown', value: "I don't know" }
];

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 gender = [
{ name: 'Male', value: 'Male' },
{ name: 'Female', value: 'Female' },
Expand Down Expand Up @@ -63,6 +57,22 @@ export const successfulBcscInvite: DialogContent = {
cancelButton: 'Close'
};


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

export const needsShelterReferralMessage: DialogContent = {
title: 'Referrals',
text: '<p>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.</p>',
};

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

export const securityQuesError =
'An error occurred while loading the security questions. Please try again later';
export const systemError =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,30 +116,29 @@ export class NeedsAssessmentMappingService {
canEvacueeProvideLodging: boolean,
canEvacueeProvideTransportation: boolean
): void {
this.needsAssessmentService.canEvacueeProvideFood =
globalConst.needsOptions.find(
(ins) => ins.apiValue === canEvacueeProvideFood
)?.value;

this.needsAssessmentService.canEvacueeProvideLodging =
globalConst.needsOptions.find(
(ins) => ins.apiValue === canEvacueeProvideLodging
)?.value;

this.needsAssessmentService.canEvacueeProvideClothing =
globalConst.needsOptions.find(
(ins) => ins.apiValue === canEvacueeProvideClothing
)?.value;

this.needsAssessmentService.canEvacueeProvideTransportation =
globalConst.needsOptions.find(
(ins) => ins.apiValue === canEvacueeProvideTransportation
)?.value;

this.needsAssessmentService.canEvacueeProvideIncidentals =
globalConst.needsOptions.find(
(ins) => ins.apiValue === canEvacueeProvideIncidentals
)?.value;
globalConst.booleanOptions.find(
(ins) => ins.value === canEvacueeProvideFood
)?.name;

this.needsAssessmentService.canEvacueeProvideLodging =
globalConst.booleanOptions.find(
(ins) => ins.value === canEvacueeProvideLodging
)?.name;

this.needsAssessmentService.canEvacueeProvideClothing =
globalConst.booleanOptions.find(
(ins) => ins.value === canEvacueeProvideClothing
)?.name;

this.needsAssessmentService.canEvacueeProvideTransportation =
globalConst.booleanOptions.find(
(ins) => ins.value === canEvacueeProvideTransportation
)?.name;

this.needsAssessmentService.canEvacueeProvideIncidentals =
globalConst.booleanOptions.find(
(ins) => ins.value === canEvacueeProvideIncidentals
)?.name;

this.formCreationService
.getIndentifyNeedsForm()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ export class NeedsAssessmentService {
private insuranceOption: InsuranceOption;
private householdMember: Array<HouseholdMember> = [];
private pet: Array<Pet> = [];
private canEvacueesProvideLodging: string;
private shelterOptions: string;
private canEvacueesProvideClothing: string;
private canEvacueesProvideFood: string;
private canEvacueesProvideIncidentals: string;
private canEvacueesProvideLodging: string;
private canEvacueesProvideTransportation: string;
private doEvacueesNotRequireAssistance: string;
private mainHouseholdMembers: HouseholdMember;
private registrationResult: RegistrationResult;
private verifiedRegistrationResult: string;
Expand All @@ -43,6 +45,30 @@ export class NeedsAssessmentService {
this.insuranceOption = value;
}

public get canEvacueeProvideLodging(): string {
return this.canEvacueesProvideLodging;
}

public set canEvacueeProvideLodging(value: string) {
this.canEvacueesProvideLodging = value;
}

public get shelterOption(): string {
return this.shelterOptions;
}

public set shelterOption(value: string) {
this.shelterOptions= value;
}

public get doesEvacueeNotRequireAssistance(): string {
return this.doEvacueesNotRequireAssistance;
}

public set doesEvacueeNotRequireAssistance(value: string) {
this.doEvacueesNotRequireAssistance = value;
}

public get canEvacueeProvideClothing(): string {
return this.canEvacueesProvideClothing;
}
Expand All @@ -67,14 +93,6 @@ export class NeedsAssessmentService {
this.canEvacueesProvideIncidentals = value;
}

public get canEvacueeProvideLodging(): string {
return this.canEvacueesProvideLodging;
}

public set canEvacueeProvideLodging(value: string) {
this.canEvacueesProvideLodging = value;
}

public get canEvacueeProvideTransportation(): string {
return this.canEvacueesProvideTransportation;
}
Expand All @@ -91,7 +109,6 @@ export class NeedsAssessmentService {
this.pet = value;
}


public get householdMembers(): Array<HouseholdMember> {
return this.householdMember;
}
Expand Down Expand Up @@ -122,70 +139,66 @@ export class NeedsAssessmentService {
}

public setNeedsDetails(formGroup: UntypedFormGroup): void {
this.canEvacueeProvideLodging = formGroup.get(
'canEvacueeProvideLodging'
)?.value;
this.shelterOptions = formGroup.get(
'shelterOptions'
)?.value;
this.canEvacueeProvideClothing = formGroup.get(
'canEvacueeProvideClothing'
).value;
this.canEvacueeProvideFood = formGroup.get('canEvacueeProvideFood').value;
)?.value;
this.canEvacueeProvideFood = formGroup.get(
'canEvacueeProvideFood'
)?.value;
this.canEvacueeProvideIncidentals = formGroup.get(
'canEvacueeProvideIncidentals'
).value;
this.canEvacueeProvideLodging = formGroup.get(
'canEvacueeProvideLodging'
).value;
)?.value;
this.canEvacueeProvideTransportation = formGroup.get(
'canEvacueeProvideTransportation'
).value;

// this.canEvacueeProvideClothing =
// formGroup.get('canEvacueeProvideClothing').value === 'null'
// ? null
// : formGroup.get('canEvacueeProvideClothing').value;
// this.canEvacueeProvideFood =
// formGroup.get('canEvacueeProvideFood').value === 'null'
// ? null
// : formGroup.get('canEvacueeProvideFood').value;
// this.canEvacueeProvideIncidentals =
// formGroup.get('canEvacueeProvideIncidentals').value === 'null'
// ? null
// : formGroup.get('canEvacueeProvideIncidentals').value;
// this.canEvacueeProvideLodging =
// formGroup.get('canEvacueeProvideLodging').value === 'null'
// ? null
// : formGroup.get('canEvacueeProvideLodging').value;
// this.canEvacueeProvideTransportation =
// formGroup.get('canEvacueeProvideTransportation').value === 'null'
// ? null
// : formGroup.get('canEvacueeProvideTransportation').value;
)?.value;
this.doesEvacueeNotRequireAssistance = formGroup.get(
'doesEvacueeNotRequireAssistance'
)?.value;
}

public createNeedsAssessmentDTO(): NeedsAssessment {
// Get correct API values for Needs Assessment selections
const needsClothingDTO = globalConst.needsOptions.find(
(ins) => ins.value === this.canEvacueeProvideClothing
)?.apiValue;
const needsLodgingDTO = globalConst.booleanOptions.find(
(ins) => ins.name === this.canEvacueeProvideLodging
)?.value;

const shelterOptionsDTO = this.shelterOptions;

const needsFoodDTO = globalConst.needsOptions.find(
(ins) => ins.value === this.canEvacueeProvideFood
)?.apiValue;
const needsClothingDTO = globalConst.booleanOptions.find(
(ins) => ins.name === this.canEvacueeProvideClothing
)?.value;

const needsIncidentalsDTO = globalConst.needsOptions.find(
(ins) => ins.value === this.canEvacueeProvideIncidentals
)?.apiValue;
const needsFoodDTO = globalConst.booleanOptions.find(
(ins) => ins.name === this.canEvacueeProvideFood
)?.value;

const needsLodgingDTO = globalConst.needsOptions.find(
(ins) => ins.value === this.canEvacueeProvideLodging
)?.apiValue;
const needsIncidentalsDTO = globalConst.booleanOptions.find(
(ins) => ins.name === this.canEvacueeProvideIncidentals
)?.value;

const needsTransportationDTO = globalConst.booleanOptions.find(
(ins) => ins.name === this.canEvacueeProvideTransportation
)?.value;

const doesEvacueeNotRequireAssistanceDTO = globalConst.booleanOptions.find(
(ins) => ins.name === this.doesEvacueeNotRequireAssistance
)?.value;

const needsTransportationDTO = globalConst.needsOptions.find(
(ins) => ins.value === this.canEvacueeProvideTransportation
)?.apiValue;
return {
id: this.id,
canEvacueeProvideLodging: needsLodgingDTO,
shelterOption: shelterOptionsDTO,
canEvacueeProvideClothing: needsClothingDTO,
canEvacueeProvideFood: needsFoodDTO,
canEvacueeProvideIncidentals: needsIncidentalsDTO,
canEvacueeProvideLodging: needsLodgingDTO,
canEvacueeProvideTransportation: needsTransportationDTO,
doesEvacueeNotRequireAssistance: doesEvacueeNotRequireAssistanceDTO,
householdMembers: this.addPrimaryApplicantToHousehold(),
insurance: this.insurance,
pets: this.pets,
Expand Down Expand Up @@ -219,11 +232,13 @@ export class NeedsAssessmentService {
public clearNeedsAssessmentData(): void {
this.id = undefined;
this.insurance = undefined;
this.canEvacueeProvideLodging = undefined;
this.shelterOptions = undefined;
this.canEvacueeProvideClothing = undefined;
this.canEvacueeProvideFood = undefined;
this.canEvacueeProvideIncidentals = undefined;
this.canEvacueeProvideLodging = undefined;
this.canEvacueeProvideTransportation = undefined;
this.doesEvacueeNotRequireAssistance = undefined;
this.pets = undefined;
this.householdMembers = undefined;
}
Expand All @@ -237,7 +252,7 @@ export class NeedsAssessmentService {
return [...this.householdMembers, primaryMember];
} else if (
!this.householdMembers.find(
(member) => member.details.isPrimaryRegistrant === true
(member) => member.isPrimaryRegistrant === true
)
) {
return [...this.householdMembers, primaryMember];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { InformationDialogComponent } from 'src/app/core/components/dialog-compo
})
export default class FamilyInformationComponent implements OnInit {
householdMemberForm: UntypedFormGroup;
radioOption = globalConst.radioButton1;
booleanOptions = globalConst.booleanOptions;
formBuilder: UntypedFormBuilder;
householdMemberForm$: Subscription;
formCreationService: FormCreationService;
Expand Down
Loading
Loading