Skip to content

Commit

Permalink
Merge pull request #228 from bcgov/bug/intake-assistance
Browse files Browse the repository at this point in the history
Resolve assistance tab disappearing
  • Loading branch information
kyle1morel authored Dec 20, 2024
2 parents 8ee81ae + 409f6b9 commit 481a786
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 37 deletions.
64 changes: 28 additions & 36 deletions frontend/src/components/housing/submission/SubmissionIntakeForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ async function onLatLongInputClick() {
async function onInvalidSubmit() {
switch (validationErrors.value[0]) {
case IntakeFormCategory.CONTACTS:
case IntakeFormCategory.BASIC:
activeStep.value = 0;
break;
Expand All @@ -276,11 +277,6 @@ async function onInvalidSubmit() {
case IntakeFormCategory.INVESTIGATE_PERMIS:
activeStep.value = 3;
break;
// Catches contacts as they arent in a category currently
default:
activeStep.value = 0;
break;
}
await nextTick();
Expand Down Expand Up @@ -344,23 +340,16 @@ async function onSubmit(data: any) {
...data,
contacts: [
{
firstName: data.contactFirstName,
lastName: data.contactLastName,
phoneNumber: data.contactPhoneNumber,
email: data.contactEmail,
contactApplicantRelationship: data.contactApplicantRelationship,
contactPreference: data.contactPreference
firstName: data.contacts.contactFirstName,
lastName: data.contacts.contactLastName,
phoneNumber: data.contacts.contactPhoneNumber,
email: data.contacts.contactEmail,
contactApplicantRelationship: data.contacts.contactApplicantRelationship,
contactPreference: data.contacts.contactPreference
}
]
},
[
'contactFirstName',
'contactLastName',
'contactPhoneNumber',
'contactEmail',
'contactApplicantRelationship',
'contactPreference'
]
['contacts']
);
// Remove empty investigate permit objects
Expand Down Expand Up @@ -463,10 +452,11 @@ onBeforeMount(async () => {
initialFormValues.value = {
...response.data,
activityId: response.activityId,
appliedPermits: response.data.appliedPermits.map((x: Partial<Permit>) => ({
...x,
submittedDate: x.submittedDate ? new Date(x.submittedDate) : undefined
}))
appliedPermits:
response.data.appliedPermits?.map((x: Partial<Permit>) => ({
...x,
submittedDate: x.submittedDate ? new Date(x.submittedDate) : undefined
})) ?? []
};
if (response.activityId) {
Expand All @@ -484,12 +474,14 @@ onBeforeMount(async () => {
initialFormValues.value = {
activityId: response?.activityId,
submissionId: response?.submissionId,
contactFirstName: response?.contacts[0].firstName,
contactLastName: response?.contacts[0].lastName,
contactPhoneNumber: response?.contacts[0].phoneNumber,
contactEmail: response?.contacts[0].email,
contactApplicantRelationship: response?.contacts[0].contactApplicantRelationship,
contactPreference: response?.contacts[0].contactPreference,
contacts: {
contactFirstName: response?.contacts[0].firstName,
contactLastName: response?.contacts[0].lastName,
contactPhoneNumber: response?.contacts[0].phoneNumber,
contactEmail: response?.contacts[0].email,
contactApplicantRelationship: response?.contacts[0].contactApplicantRelationship,
contactPreference: response?.contacts[0].contactPreference
},
basic: {
consentToFeedback: response?.consentToFeedback,
isDevelopedByCompanyOrOrg: response?.isDevelopedByCompanyOrOrg,
Expand Down Expand Up @@ -547,7 +539,7 @@ onBeforeMount(async () => {
// Move map pin
onLatLongInputClick();
} catch {
} catch (e) {
router.replace({ name: RouteName.HOUSING_SUBMISSION_INTAKE });
}
});
Expand Down Expand Up @@ -641,44 +633,44 @@ onBeforeMount(async () => {
<div class="formgrid grid">
<InputText
class="col-6"
:name="`contactFirstName`"
:name="`contacts.contactFirstName`"
label="First name"
:bold="false"
:disabled="!editable"
/>
<InputText
class="col-6"
:name="`contactLastName`"
:name="`contacts.contactLastName`"
label="Last name"
:bold="false"
:disabled="!editable"
/>
<InputMask
class="col-6"
:name="`contactPhoneNumber`"
:name="`contacts.contactPhoneNumber`"
mask="(999) 999-9999"
label="Phone number"
:bold="false"
:disabled="!editable"
/>
<InputText
class="col-6"
:name="`contactEmail`"
:name="`contacts.contactEmail`"
label="Email"
:bold="false"
:disabled="!editable"
/>
<Dropdown
class="col-6"
:name="`contactApplicantRelationship`"
:name="`contacts.contactApplicantRelationship`"
label="Relationship to project"
:bold="false"
:disabled="!editable"
:options="PROJECT_RELATIONSHIP_LIST"
/>
<Dropdown
class="col-6"
:name="`contactPreference`"
:name="`contacts.contactPreference`"
label="Preferred contact method"
:bold="false"
:disabled="!editable"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const YesNoUnsureSchema = string().required().oneOf(YES_NO_UNSURE_LIST);
const stringRequiredSchema = string().required().max(255);

export const submissionIntakeSchema = object({
...contactValidator,
[IntakeFormCategory.CONTACTS]: object(contactValidator),
[IntakeFormCategory.BASIC]: object({
consentToFeedback: boolean().notRequired().nullable().label('Consent to feedback'),
isDevelopedByCompanyOrOrg: string().required().oneOf(YES_NO_LIST).label('Project developed'),
Expand Down

0 comments on commit 481a786

Please sign in to comment.