Skip to content

Commit

Permalink
24856 hosts permit bl mapping (#375)
Browse files Browse the repository at this point in the history
* UI - hosts permit dash bl mapping

Signed-off-by: Kial Jinnah <[email protected]>

* cleanup

Signed-off-by: Kial Jinnah <[email protected]>

* cleanup

Signed-off-by: Kial Jinnah <[email protected]>

* remove download cert from permit dash

Signed-off-by: Kial Jinnah <[email protected]>

* UI - Application, step 2 validation tweaks

Signed-off-by: Kial Jinnah <[email protected]>

---------

Signed-off-by: Kial Jinnah <[email protected]>
  • Loading branch information
kialj876 authored Dec 11, 2024
1 parent d0533fb commit 2f51ab4
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
19 changes: 10 additions & 9 deletions strr-host-pm-web/app/components/form/AddOwners/input/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ const owner = ref<HostOwner>(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<Form<z.output<typeof ownerSchema.value>>>()
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: '',
Expand All @@ -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<Form<z.output<typeof ownerSchema.value>>>()
const saveOwner = async () => {
const errors = await validateForm(ownerFormRef.value, true)
if (!errors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
</script>

Expand Down
3 changes: 2 additions & 1 deletion strr-host-pm-web/app/locales/en-CA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
3 changes: 1 addition & 2 deletions strr-host-pm-web/app/pages/dashboard/[applicationId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ onMounted(async () => {
setHeaderDetails(
registration.value.status,
undefined,
permitStore.downloadApplicationReceipt,
permitStore.downloadRegistrationCert)
permitStore.downloadApplicationReceipt)
}
// host right side details
Expand Down
2 changes: 1 addition & 1 deletion strr-host-pm-web/app/stores/hostApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions strr-host-pm-web/app/stores/hostOwner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
})
}

Expand All @@ -57,7 +57,7 @@ export const useHostOwnerStore = defineStore('host/owner', () => {
taxNumber: ''
})

const activeOwner = ref<HostOwner| undefined>(undefined)
const activeOwner = ref<HostOwner | undefined>(undefined)
const activeOwnerEditIndex = ref(-1)
const hostOwners = ref<HostOwner[]>([])

Expand Down
5 changes: 3 additions & 2 deletions strr-host-pm-web/app/stores/hostPermit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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<UiDocument>(val => ({
file: {} as File,
Expand Down

0 comments on commit 2f51ab4

Please sign in to comment.