Skip to content

Commit

Permalink
Host - UI: Bug fixes (#425)
Browse files Browse the repository at this point in the history
* remove rental doc from required docs when exempt
* remove rental doc from requried when pr not required
* make sin required
* validate all bc id cards as max 1 document
* remove pr declaration from review step if user exempt
* reset fee widget on variable change
* format fax number the same as phone number
* bump host version
  • Loading branch information
deetz99 authored Dec 31, 2024
1 parent 32771bf commit 0b8cd3b
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 15 deletions.
3 changes: 2 additions & 1 deletion strr-base-web/app/components/form/common/Contact.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defineProps<{
name="fullName"
:placeholder="t('label.fullName')"
/>
<div v-else class="max-w-bcGovInput flex flex-col gap-3 sm:flex-row">
<div v-else class="flex max-w-bcGovInput flex-col gap-3 sm:flex-row">
<ConnectFormFieldGroup
v-if="firstName !== undefined"
:id="idPrefix + '-first-name'"
Expand Down Expand Up @@ -118,6 +118,7 @@ defineProps<{
:aria-label="t('label.faxNumberOpt')"
name="faxNumber"
:placeholder="t('label.faxNumberOpt')"
:mask="phone?.countryCode === '1' ? '(###) ###-####' : '##############'"
/>
<ConnectFormFieldGroup
v-if="emailAddress !== undefined"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ watch(isCompParty, (val) => {
id="host-owner-taxNumber"
v-model="owner.taxNumber"
name="taxNumber"
:placeholder="$t('label.craTaxNumberOpt')"
:placeholder="$t('label.craTaxNumber')"
:help="$t('strr.hint.craTaxNumber')"
mask="### ### ###"
/>
Expand Down Expand Up @@ -197,6 +197,7 @@ watch(isCompParty, (val) => {
:aria-label="$t('label.faxNumberOpt')"
name="faxNumber"
:placeholder="$t('label.faxNumberOpt')"
:mask="owner.phone.countryCode === '1' ? '(###) ###-####' : '##############'"
/>
</ConnectFormSection>
<ConnectFormSection
Expand Down
11 changes: 10 additions & 1 deletion strr-host-pm-web/app/components/form/Review/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const ownerStore = useHostOwnerStore()
const { hasCompParty, hostOwners } = storeToRefs(ownerStore)
const documentsStore = useDocumentStore()
const applicationStore = useHostApplicationStore()
const reqStore = usePropertyReqStore()
const confirmationFormRef = ref<Form<z.output<typeof applicationStore.confirmationSchema>>>()
const sectionErrors = ref<MultiFormValidationResult>([])
Expand Down Expand Up @@ -65,6 +66,14 @@ const getCompPartyName = computed(() => {
}
return `[${t('label.completingParty')}]`
})
const agreedToRentalActListItems = computed(() => {
if (reqStore.hasReqs && (!reqStore.propertyReqs.isPrincipalResidenceRequired || reqStore.prRequirements.prExemptionReason !== undefined)) {
return [{ slot: 'item-1' }, { i18nKey: 'certify.2' }, { i18nKey: 'certify.4' }]
} else {
return [{ slot: 'item-1' }, { i18nKey: 'certify.2' }, { i18nKey: 'certify.3' }, { i18nKey: 'certify.4' }]
}
})
</script>
<template>
<div class="space-y-10" data-testid="strata-review-confirm">
Expand Down Expand Up @@ -125,7 +134,7 @@ const getCompPartyName = computed(() => {
>
<ConnectFormCertify
v-model="applicationStore.userConfirmation.agreedToRentalAct"
:items="[{ slot: 'item-1' }, { i18nKey: 'certify.2' }, { i18nKey: 'certify.3' }, { i18nKey: 'certify.4' }]"
:items="agreedToRentalActListItems"
:checkbox-label="{ key: 'certify.confirm', props: { name: getCompPartyName } }"
:has-error="isComplete && hasFormErrors(confirmationFormRef, ['agreedToRentalAct'])"
name="agreedToRentalAct"
Expand Down
7 changes: 4 additions & 3 deletions strr-host-pm-web/app/pages/application.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const setFeeBasedOnProperty = () => {
return
}
if (propertyTypeFeeTriggers.value.isEntireHomeAndPrincipalResidence) {
hostFee3.value.quantity = 1
removeFee(StrrFeeCode.STR_HOST_2)
addReplaceFee(hostFee1.value)
} else if (propertyTypeFeeTriggers.value.isEntireHomeAndNotPrincipalResidence) {
Expand All @@ -62,15 +63,15 @@ const setFeeBasedOnProperty = () => {
removeFee(StrrFeeCode.STR_HOST_1)
removeFee(StrrFeeCode.STR_HOST_2)
hostFee3.value.quantity = unitDetails.value.numberOfRoomsForRent || 1
hostFee3.value.quantityDesc = hostFee3.value.quantity > 1
? t('strr.word.room', hostFee3.value.quantity)
: undefined
addReplaceFee(hostFee3.value)
} else {
// set placeholder
removeFee(StrrFeeCode.STR_HOST_1)
removeFee(StrrFeeCode.STR_HOST_2)
}
hostFee3.value.quantityDesc = hostFee3.value.quantity !== undefined && hostFee3.value.quantity > 1
? t('strr.word.room', hostFee3.value.quantity)
: undefined
}
// manage fees only when typeofspace and rentalUnitSetupType change
Expand Down
20 changes: 15 additions & 5 deletions strr-host-pm-web/app/stores/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const useDocumentStore = defineStore('host/document', () => {
})
}

if (propStore.unitDetails.ownershipType === OwnershipType.RENT) {
if (propStore.unitDetails.ownershipType === OwnershipType.RENT && reqs.isPrincipalResidenceRequired && exemptionReason === undefined) {
const isRentValid = apiDocuments.value.some(
item => [DocumentUploadType.TENANCY_AGREEMENT, DocumentUploadType.RENT_RECEIPT_OR_BANK_STATEMENT]
.includes(item.documentType)
Expand Down Expand Up @@ -255,11 +255,15 @@ export const useDocumentStore = defineStore('host/document', () => {
}

function validatePrincipalResidenceDocuments (): boolean {
// either 2 unique docs from this list are required
const uniqueColumnADocs = [
// bc id cards only count as 1 document
const bcIdDocs = [
DocumentUploadType.BC_DRIVERS_LICENSE,
DocumentUploadType.BCSC,
DocumentUploadType.COMBINED_BCSC_LICENSE,
DocumentUploadType.COMBINED_BCSC_LICENSE
]

// either 2 unique docs from this list are required
const uniqueColumnADocs = [
DocumentUploadType.PROPERTY_ASSESSMENT_NOTICE,
DocumentUploadType.SPEC_TAX_CONFIRMATION,
DocumentUploadType.HOG_DECLARATION
Expand Down Expand Up @@ -299,8 +303,14 @@ export const useDocumentStore = defineStore('host/document', () => {

// get non-unique column b docs
const columnBFilteredNonUnique = apiDocuments.value.filter(item => nonUniqueColumnBDocs.includes(item.documentType))

// get bc id docs
const bcIdDocsExist = apiDocuments.value.some((doc) => bcIdDocs.includes(doc.documentType))
// only count bcid docs as 1 document
const bcIdDocCount = bcIdDocsExist ? 1 : 0

// get doc count
const columnACount = columnAFilteredUnique.length
const columnACount = columnAFilteredUnique.length + bcIdDocCount
const columnBCount = columnBFilteredUnique.length + columnBFilteredNonUnique.length

// validate at least 2 of column a docs OR validate at least 1 of column a and 2 of column b
Expand Down
4 changes: 3 additions & 1 deletion strr-host-pm-web/app/stores/hostOwner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export const useHostOwnerStore = defineStore('host/owner', () => {
dateOfBirth: type === OwnerType.INDIVIDUAL && role === OwnerRole.HOST
? getRequiredNonEmptyString(t('validation.dateOfBirth'))
: optionalOrEmptyString,
taxNumber: getOptionalSin(t('validation.sin'))
taxNumber: type === OwnerType.INDIVIDUAL && role === OwnerRole.HOST
? getRequiredSin(t('validation.sin'))
: optionalOrEmptyString
})
}

Expand Down
2 changes: 1 addition & 1 deletion strr-host-pm-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-host-pm-web",
"private": true,
"type": "module",
"version": "0.0.21",
"version": "0.0.22",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down
2 changes: 1 addition & 1 deletion strr-platform-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-platform-web",
"private": true,
"type": "module",
"version": "0.0.31",
"version": "0.0.32",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down
2 changes: 1 addition & 1 deletion strr-strata-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-strata-web",
"private": true,
"type": "module",
"version": "0.0.31",
"version": "0.0.32",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down

0 comments on commit 0b8cd3b

Please sign in to comment.