Skip to content

Commit

Permalink
second q
Browse files Browse the repository at this point in the history
  • Loading branch information
avni-work committed Oct 25, 2024
1 parent 8c2624e commit db3e095
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
23 changes: 21 additions & 2 deletions strr-web/components/bcros/form-section/property/Details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@
/>
</UFormGroup>
</div>
<div class="flex flex-row justify-between w-full mb-[40px] mobile:mb-[16px]">
<UFormGroup name="isUnitOnPrincipalResidenceProperty" class="d:pr-[16px] flex-grow">
<USelect
v-model="isUnitOnPrincipalResidenceProperty"
aria-label="Is unit on principal residence property"
:placeholder="t('createAccount.propertyForm.isUnitOnPrincipalResidenceProperty')"
:options="principalResidenceOptions"
option-attribute="label"
class="w-full"
style="color: #1a202c; /* text-gray-900 */ dark:text-white; /* Override with dark mode text color */"
@blur="emit('validateIsUnitOnPrincipalResidenceProperty')"
@change="emit('validateIsUnitOnPrincipalResidenceProperty')"
/>
</UFormGroup>
</div>
</BcrosFormSection>
</div>
</template>
Expand All @@ -119,6 +134,7 @@ const businessLicense = defineModel<string>('businessLicense')
const parcelIdentifier = defineModel<string>('parcelIdentifier')
const businessLicenseExpiryDate = defineModel<string>('businessLicenseExpiryDate')
const rentalUnitSpaceType = defineModel<string>('rentalUnitSpaceType')
const isUnitOnPrincipalResidenceProperty = defineModel<boolean>('isUnitOnPrincipalResidenceProperty')
watch(businessLicense, (): void => {
if (!businessLicense.value) {
Expand All @@ -131,21 +147,24 @@ const emit = defineEmits([
'validateOwnership',
'validateProperty',
'validateBusinessLicenseExpiryDate',
'validateRentalUnitSpaceType'
'validateRentalUnitSpaceType',
'validateIsUnitOnPrincipalResidenceProperty'
])
const {
propertyTypes,
ownershipTypes,
ownershipTypeError,
propertyTypeError,
rentalUnitSpaceTypeOptions
rentalUnitSpaceTypeOptions,
principalResidenceOptions
} = defineProps<{
propertyTypes: string[],
ownershipTypes: string[],
ownershipTypeError: string,
propertyTypeError: string,
rentalUnitSpaceTypeOptions: string[],
rentalUnitSpaceTypeError: string,
principalResidenceOptions: { value: boolean, label: string }[]
}>()
</script>
8 changes: 8 additions & 0 deletions strr-web/components/bcros/form-section/property/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
v-model:parcel-identifier="formState.propertyDetails.parcelIdentifier"
v-model:business-license-expiry-date="formState.propertyDetails.businessLicenseExpiryDate"
v-model:rental-unit-space-type="formState.propertyDetails.rentalUnitSpaceType"
v-model:is-unit-on-principal-residence-property="formState.propertyDetails.isUnitOnPrincipalResidenceProperty"
:property-types="propertyTypes"
:ownership-types="ownershipTypes"
:rental-unit-space-type-options="rentalUnitSpaceTypeOptions"
:principal-residence-options="principalResidenceOptions"
:ownership-type-error="ownershipTypeError"
:property-type-error="propertyTypeError"
:rental-unit-space-type-error="rentalUnitSpaceTypeError"
Expand Down Expand Up @@ -179,6 +181,12 @@ const rentalUnitSpaceTypeOptions = [
t('createAccount.propertyForm.entireHome'),
t('createAccount.propertyForm.sharedAccommodation')
]
const principalResidenceOptions = [
{ value: true, label: t('createAccount.propertyForm.yes') },
{ value: false, label: t('createAccount.propertyForm.no') }
]
const propertyTypeError = ref('')
const ownershipTypeError = ref('')
const businessLicenseExpiryDate = ref('')
Expand Down
5 changes: 4 additions & 1 deletion strr-web/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,10 @@
"floatHome": "Float home",
"rent": "Rent",
"own": "Own",
"coOwn": "Co-own"
"coOwn": "Co-own",
"isUnitOnPrincipalResidenceProperty": "Is the rental unit on the same property as the principal residence?",
"yes": "Yes",
"no": "No"
},
"principalResidence": {
"property": "Property",
Expand Down
4 changes: 3 additions & 1 deletion strr-web/utils/formStateToApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export const formStateToApi = (
parcelIdentifier,
businessLicense,
businessLicenseExpiryDate,
rentalUnitSpaceType
rentalUnitSpaceType,
isUnitOnPrincipalResidenceProperty
} = formState.propertyDetails

formData.registration.unitDetails = {
Expand All @@ -77,6 +78,7 @@ export const formStateToApi = (
ownershipType,
businessLicense,
rentalUnitSpaceType,
isUnitOnPrincipalResidenceProperty,
...(businessLicense ? { businessLicenseExpiryDate } : {}) // include exp date only if business license exists
}
}
Expand Down

0 comments on commit db3e095

Please sign in to comment.