From 2f51ab40f033e08cf750cc1c181f4fe2b4583e36 Mon Sep 17 00:00:00 2001 From: Kial Date: Wed, 11 Dec 2024 12:48:53 -0500 Subject: [PATCH] 24856 hosts permit bl mapping (#375) * UI - hosts permit dash bl mapping Signed-off-by: Kial Jinnah * cleanup Signed-off-by: Kial Jinnah * cleanup Signed-off-by: Kial Jinnah * remove download cert from permit dash Signed-off-by: Kial Jinnah * UI - Application, step 2 validation tweaks Signed-off-by: Kial Jinnah --------- Signed-off-by: Kial Jinnah --- .../components/form/AddOwners/input/Index.vue | 19 ++++++++++--------- .../form/AddOwners/input/Person.vue | 1 + strr-host-pm-web/app/locales/en-CA.ts | 3 ++- .../app/pages/dashboard/[applicationId].vue | 3 +-- .../app/stores/hostApplication.ts | 2 +- strr-host-pm-web/app/stores/hostOwner.ts | 4 ++-- strr-host-pm-web/app/stores/hostPermit.ts | 5 +++-- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/strr-host-pm-web/app/components/form/AddOwners/input/Index.vue b/strr-host-pm-web/app/components/form/AddOwners/input/Index.vue index ab3aa8f4..ed4e57f4 100644 --- a/strr-host-pm-web/app/components/form/AddOwners/input/Index.vue +++ b/strr-host-pm-web/app/components/form/AddOwners/input/Index.vue @@ -26,15 +26,15 @@ const owner = ref(props.setOwner ? JSON.parse(JSON.stringify(props.setOwner)) : getNewHostOwner(false, props.ownerType)) +const ownerSchema = computed(() => getHostOwnerSchema(owner.value.ownerType, owner.value.role)) +const ownerFormRef = ref>>() + watch(owner, (val) => { activeOwner.value = val }, { immediate: true }) -watch(() => owner.value.role, (newVal, oldVal) => { - // clear fields that change depending on the role - if (newVal === OwnerRole.CO_HOST) { - owner.value.businessLegalName = '' - owner.value.businessNumber = '' +watch(() => owner.value.role, async (newVal, oldVal) => { + // clear fields that change meaning depending on if the entity is a host + if ([newVal, oldVal].includes(OwnerRole.HOST)) { owner.value.taxNumber = '' owner.value.dateOfBirth = '' - } else if (oldVal !== OwnerRole.CO_HOST) { owner.value.mailingAddress = { street: '', streetAdditional: '', @@ -44,12 +44,13 @@ watch(() => owner.value.role, (newVal, oldVal) => { postalCode: '', locationDescription: '' } + // Needs to trigger validate so that form registers the 'clear' + await ownerFormRef.value?.validate(['mailingAddress.postalCode', 'taxNumber'], { silent: true }) + ownerFormRef.value?.clear('mailingAddress.postalCode') + ownerFormRef.value?.clear('taxNumber') } }) -const ownerSchema = computed(() => getHostOwnerSchema(owner.value.ownerType, owner.value.role)) -const ownerFormRef = ref>>() - const saveOwner = async () => { const errors = await validateForm(ownerFormRef.value, true) if (!errors) { diff --git a/strr-host-pm-web/app/components/form/AddOwners/input/Person.vue b/strr-host-pm-web/app/components/form/AddOwners/input/Person.vue index 0f8d3982..4bf9fe89 100644 --- a/strr-host-pm-web/app/components/form/AddOwners/input/Person.vue +++ b/strr-host-pm-web/app/components/form/AddOwners/input/Person.vue @@ -29,6 +29,7 @@ watch(isCompParty, (val) => { // set owner isCompParty and update the name with user creds owner.value.isCompParty = val ownerStore.SetOwnerNameWithUserCreds(owner) + ownerFormRef.value?.clear('firstName') }) diff --git a/strr-host-pm-web/app/locales/en-CA.ts b/strr-host-pm-web/app/locales/en-CA.ts index f7c12f83..de13aebb 100644 --- a/strr-host-pm-web/app/locales/en-CA.ts +++ b/strr-host-pm-web/app/locales/en-CA.ts @@ -412,7 +412,8 @@ export default { missingReqDocs: 'Missing required documents. Please see above for details.', blExpiryDate: 'The expiry date must be greater than today and in less than 1 year.', residentialAddressRequired: 'Residential address is required', - addressIncompleteDropdown: 'The address provided is not complete. Please select one from the dropdown list.' + addressIncompleteDropdown: 'The address provided is not complete. Please select one from the dropdown list.', + sin: 'Please enter a valid 9-digit SIN, TTN, or ITN' }, requirements: { busLicense: { diff --git a/strr-host-pm-web/app/pages/dashboard/[applicationId].vue b/strr-host-pm-web/app/pages/dashboard/[applicationId].vue index 98f5e7bb..e30ccc60 100644 --- a/strr-host-pm-web/app/pages/dashboard/[applicationId].vue +++ b/strr-host-pm-web/app/pages/dashboard/[applicationId].vue @@ -49,8 +49,7 @@ onMounted(async () => { setHeaderDetails( registration.value.status, undefined, - permitStore.downloadApplicationReceipt, - permitStore.downloadRegistrationCert) + permitStore.downloadApplicationReceipt) } // host right side details diff --git a/strr-host-pm-web/app/stores/hostApplication.ts b/strr-host-pm-web/app/stores/hostApplication.ts index 77dec936..aaa749a0 100644 --- a/strr-host-pm-web/app/stores/hostApplication.ts +++ b/strr-host-pm-web/app/stores/hostApplication.ts @@ -53,7 +53,7 @@ export const useHostApplicationStore = defineStore('host/application', () => { principalResidence: { // TODO: confirm mapping - assuming this is if PR is required or not? isPrincipalResidence: !reqStore.prRequirements.isPropertyPrExempt, - nonPrincipalOption: reqStore.prRequirements.prExemptionReason || '', + nonPrincipalOption: reqStore.prRequirements.prExemptionReason, agreedToRentalAct: userConfirmation.value.agreedToRentalAct, agreedToSubmit: userConfirmation.value.agreedToSubmit, // TODO: Not in new design - remove once it is no longer required to pass API validation diff --git a/strr-host-pm-web/app/stores/hostOwner.ts b/strr-host-pm-web/app/stores/hostOwner.ts index 58e0ecf1..31f5f258 100644 --- a/strr-host-pm-web/app/stores/hostOwner.ts +++ b/strr-host-pm-web/app/stores/hostOwner.ts @@ -32,7 +32,7 @@ export const useHostOwnerStore = defineStore('host/owner', () => { dateOfBirth: type === OwnerType.INDIVIDUAL && role === OwnerRole.HOST ? getRequiredNonEmptyString(t('validation.dateOfBirth')) : optionalOrEmptyString, - taxNumber: optionalOrEmptyString + taxNumber: getOptionalSin(t('validation.sin')) }) } @@ -57,7 +57,7 @@ export const useHostOwnerStore = defineStore('host/owner', () => { taxNumber: '' }) - const activeOwner = ref(undefined) + const activeOwner = ref(undefined) const activeOwnerEditIndex = ref(-1) const hostOwners = ref([]) diff --git a/strr-host-pm-web/app/stores/hostPermit.ts b/strr-host-pm-web/app/stores/hostPermit.ts index a7b5b9df..062f2ba1 100644 --- a/strr-host-pm-web/app/stores/hostPermit.ts +++ b/strr-host-pm-web/app/stores/hostPermit.ts @@ -10,7 +10,7 @@ export const useHostPermitStore = defineStore('host/permit', () => { const propertyReqStore = usePropertyReqStore() const documentStore = useDocumentStore() const { hostOwners } = storeToRefs(ownerStore) - const { unitAddress, unitDetails } = storeToRefs(propertyStore) + const { blInfo, unitAddress, unitDetails } = storeToRefs(propertyStore) const { prRequirements } = storeToRefs(propertyReqStore) const { storedDocuments } = storeToRefs(documentStore) @@ -41,8 +41,9 @@ export const useHostPermitStore = defineStore('host/permit', () => { hostOwners.value.push(formatOwnerPropertyManagerUI(permitDetails.value.propertyManager)) } unitDetails.value = formatHostUnitDetailsUI(permitDetails.value.unitDetails) + blInfo.value = formatHostUnitDetailsBlInfoUI(permitDetails.value.unitDetails) unitAddress.value = { address: formatHostUnitAddressUI(permitDetails.value.unitAddress) } - prRequirements.value.isPropertyPrExempt = permitDetails.value.principalResidence.isPrincipalResidence || false + prRequirements.value.isPropertyPrExempt = !permitDetails.value.principalResidence.isPrincipalResidence prRequirements.value.prExemptionReason = permitDetails.value.principalResidence.nonPrincipalOption storedDocuments.value = permitDetails.value.documents?.map(val => ({ file: {} as File,