From 7fa2c325f42a76b9c84ab82da63a960d979b6dbf Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Wed, 19 Jul 2023 15:28:53 -0700 Subject: [PATCH 1/7] ongoing country update --- .../HomeLocation/HomeCivicAddress.vue | 19 +++++++++++++++++++ .../factories/countries-provinces-factory.ts | 10 ++++++---- ppr-ui/src/schemas/civic-address.ts | 2 ++ ppr-ui/src/utils/feature-flags.ts | 8 ++++---- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue b/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue index 6de33aa01..14925ae21 100644 --- a/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue +++ b/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue @@ -7,6 +7,24 @@
+
+ + + +
+ => { + const getCountries = (naOnly = false): Array => { let countries = [] countries.push({ code: 'CA', name: 'Canada' }) countries.push({ code: 'US', name: 'United States of America' }) - // name is set this way to ensure the divider is there in the search when CA/US are not the only options - countries.push({ code: '0', name: 'Can.nada. United States .Of.America', divider: true }) - countries = countries.concat(window['countries']) + if (!naOnly) { + // name is set this way to ensure the divider is there in the search when CA/US are not the only options + countries.push({ code: '0', name: 'Can.nada. United States .Of.America', divider: true }) + countries = countries.concat(window['countries']) + } return countries } /** diff --git a/ppr-ui/src/schemas/civic-address.ts b/ppr-ui/src/schemas/civic-address.ts index 2bae5e8a5..63f101ad7 100644 --- a/ppr-ui/src/schemas/civic-address.ts +++ b/ppr-ui/src/schemas/civic-address.ts @@ -18,6 +18,8 @@ export const CivicAddressSchema = { ...spaceRules ], country: [ + baseRules[ValidationRule.REQUIRED], + ...spaceRules ], region: [ baseRules[ValidationRule.REQUIRED], diff --git a/ppr-ui/src/utils/feature-flags.ts b/ppr-ui/src/utils/feature-flags.ts index 3d5bcd2f7..e748fc1a3 100644 --- a/ppr-ui/src/utils/feature-flags.ts +++ b/ppr-ui/src/utils/feature-flags.ts @@ -9,10 +9,10 @@ export const defaultFlagSet: LDFlagSet = { 'bcregistry-ui-mhr-enabled': false, 'search-registration-number': false, 'search-serial-number': false, - 'mhr-ui-enabled': false, // Enables MHR search options - 'mhr-registration-enabled': false, // Enables MHR table tab - 'mhr-transfer-enabled': false, // Enables changes to base MHR Home Owners within the MHR Information flow - 'assets-tiptap-enabled': false, // Enables new TipTap wysiwyg editor + 'mhr-ui-enabled': true, // Enables MHR search options + 'mhr-registration-enabled': true, // Enables MHR table tab + 'mhr-transfer-enabled': true, // Enables changes to base MHR Home Owners within the MHR Information flow + 'assets-tiptap-enabled': true, // Enables new TipTap wysiwyg editor 'mhr-exemption-enabled': false, 'mhr-transport-permit-enabled': '', 'sentry-enable': false, // by default, no sentry logs From 18720d381b1b5b2196267d1b9f39c41f3852182d Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Thu, 20 Jul 2023 11:26:12 -0700 Subject: [PATCH 2/7] Implements Civic Address Country and Regions --- .../HomeLocation/HomeCivicAddress.vue | 65 ++++++++++++------- .../ReviewConfirm/HomeLocationReview.vue | 8 ++- .../factories/countries-provinces-factory.ts | 2 +- ppr-ui/src/schemas/civic-address.ts | 1 - ppr-ui/tests/unit/MhrCivicAddress.spec.ts | 6 ++ 5 files changed, 55 insertions(+), 27 deletions(-) diff --git a/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue b/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue index 14925ae21..43ef74921 100644 --- a/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue +++ b/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue @@ -9,17 +9,18 @@
@@ -58,11 +59,10 @@ { + switch (addressLocal.value.country) { + case 'CA': + return 'Province' + case 'US': + return 'State' + default: + return 'Province/State' + } + }), provinceOptions: computed((): Array => { - return countryProvincesHelpers.getCountryRegions('CA', true).map((region: any) => { + return countryProvincesHelpers.getCountryRegions(addressLocal.value.country, true).map((region: any) => { return { name: region.name, value: region.short @@ -152,19 +162,25 @@ export default defineComponent({ } /** Apply local model updates to store. **/ - watch(() => addressLocal.value.street, async () => { - // Set civic address data to store - await setCivicAddress({ key: 'street', value: addressLocal.value.street }) + watch(() => addressLocal.value.country, async (country: string) => { + // Clear fields when country changes + addressLocal.value.street = '' + addressLocal.value.city = '' + addressLocal.value.region = '' + + await setCivicAddress({ key: 'country', value: country }) }) - watch(() => addressLocal.value.city, async () => { - // Set civic address data to store - await setCivicAddress({ key: 'city', value: addressLocal.value.city }) + watch(() => addressLocal.value.street, async (street: string) => { + await setCivicAddress({ key: 'street', value: street }) }) - watch(() => addressLocal.value.region, async () => { - // Set civic address data to store - await setCivicAddress({ key: 'region', value: addressLocal.value.region }) + watch(() => addressLocal.value.city, async (city: string) => { + await setCivicAddress({ key: 'city', value: city }) + }) + + watch(() => addressLocal.value.region, async (region: string) => { + await setCivicAddress({ key: 'region', value: region }) }) watch(() => localState.isValidCivicAddress, async (val: boolean) => { @@ -204,5 +220,8 @@ export default defineComponent({ .v-text-field.v-text-field--enclosed .v-text-field__details { margin-bottom: 0; } + .v-list .v-list-item--active { + background-color: $blueSelected!important; + } } diff --git a/ppr-ui/src/components/mhrRegistration/ReviewConfirm/HomeLocationReview.vue b/ppr-ui/src/components/mhrRegistration/ReviewConfirm/HomeLocationReview.vue index c24a115c8..242f20927 100644 --- a/ppr-ui/src/components/mhrRegistration/ReviewConfirm/HomeLocationReview.vue +++ b/ppr-ui/src/components/mhrRegistration/ReviewConfirm/HomeLocationReview.vue @@ -216,7 +216,9 @@ {{getMhrRegistrationLocation.address.streetAdditional}}
- {{ getMhrRegistrationLocation.address.city }} {{ 'BC' }} + {{ getMhrRegistrationLocation.address.city }} + {{ getMhrRegistrationLocation.address.region }} +
{{ getCountryName(getMhrRegistrationLocation.address.country) }}

{{ '(Not Entered)' }} @@ -258,10 +260,10 @@ import { HomeLocationTypes, RouteNames } from '@/enums' import { useStore } from '@/store/store' import { useMhrValidations } from '@/composables' import { storeToRefs } from 'pinia' +import { useCountriesProvinces } from '@/composables/address/factories' export default defineComponent({ name: 'HomeLocationReview', - components: {}, props: { isTransferReview: { type: Boolean, @@ -281,6 +283,7 @@ export default defineComponent({ MhrSectVal, getStepValidation } = useMhrValidations(toRefs(getMhrRegistrationValidationModel.value)) + const countryProvincesHelpers = useCountriesProvinces() const localState = reactive({ includesPid: computed((): boolean => { @@ -342,6 +345,7 @@ export default defineComponent({ getMhrRegistrationLocation, getIsManualLocation, isMhrManufacturerRegistration, + ...countryProvincesHelpers, ...toRefs(localState) } } diff --git a/ppr-ui/src/composables/address/factories/countries-provinces-factory.ts b/ppr-ui/src/composables/address/factories/countries-provinces-factory.ts index ec64b2d8e..332532376 100644 --- a/ppr-ui/src/composables/address/factories/countries-provinces-factory.ts +++ b/ppr-ui/src/composables/address/factories/countries-provinces-factory.ts @@ -23,7 +23,7 @@ export function useCountriesProvinces () { const getCountries = (naOnly = false): Array => { let countries = [] countries.push({ code: 'CA', name: 'Canada' }) - countries.push({ code: 'US', name: 'United States of America' }) + countries.push({ code: 'US', name: 'United States' }) if (!naOnly) { // name is set this way to ensure the divider is there in the search when CA/US are not the only options countries.push({ code: '0', name: 'Can.nada. United States .Of.America', divider: true }) diff --git a/ppr-ui/src/schemas/civic-address.ts b/ppr-ui/src/schemas/civic-address.ts index 63f101ad7..2ad4fe42e 100644 --- a/ppr-ui/src/schemas/civic-address.ts +++ b/ppr-ui/src/schemas/civic-address.ts @@ -23,7 +23,6 @@ export const CivicAddressSchema = { ], region: [ baseRules[ValidationRule.REQUIRED], - baseRules[ValidationRule.BC], ...spaceRules ], /* NOTE: Canada/US postal code and zip code regex rules diff --git a/ppr-ui/tests/unit/MhrCivicAddress.spec.ts b/ppr-ui/tests/unit/MhrCivicAddress.spec.ts index c4f9c46f4..0e09f2350 100644 --- a/ppr-ui/tests/unit/MhrCivicAddress.spec.ts +++ b/ppr-ui/tests/unit/MhrCivicAddress.spec.ts @@ -59,6 +59,12 @@ describe('mhr home civic address', () => { await nextTick() expect(civicAddressSection.findAll(ERROR_MSG).length).toBe(0) + const country = civicAddressSection.find('#country') + country.setValue('Canada') + await nextTick() + await nextTick() + expect(civicAddressSection.findAll(ERROR_MSG).length).toBe(0) + const city = civicAddressSection.find('#city') city.setValue('Vancouver') await nextTick() From e9cf1d62b6f81863cf5a227776bd86814d70023d Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Thu, 20 Jul 2023 11:29:58 -0700 Subject: [PATCH 3/7] Reverted FF's --- ppr-ui/src/utils/feature-flags.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ppr-ui/src/utils/feature-flags.ts b/ppr-ui/src/utils/feature-flags.ts index e748fc1a3..3d5bcd2f7 100644 --- a/ppr-ui/src/utils/feature-flags.ts +++ b/ppr-ui/src/utils/feature-flags.ts @@ -9,10 +9,10 @@ export const defaultFlagSet: LDFlagSet = { 'bcregistry-ui-mhr-enabled': false, 'search-registration-number': false, 'search-serial-number': false, - 'mhr-ui-enabled': true, // Enables MHR search options - 'mhr-registration-enabled': true, // Enables MHR table tab - 'mhr-transfer-enabled': true, // Enables changes to base MHR Home Owners within the MHR Information flow - 'assets-tiptap-enabled': true, // Enables new TipTap wysiwyg editor + 'mhr-ui-enabled': false, // Enables MHR search options + 'mhr-registration-enabled': false, // Enables MHR table tab + 'mhr-transfer-enabled': false, // Enables changes to base MHR Home Owners within the MHR Information flow + 'assets-tiptap-enabled': false, // Enables new TipTap wysiwyg editor 'mhr-exemption-enabled': false, 'mhr-transport-permit-enabled': '', 'sentry-enable': false, // by default, no sentry logs From 320ca139a10d01c8a8c082339aafb900e25d40ea Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Fri, 21 Jul 2023 08:29:44 -0700 Subject: [PATCH 4/7] Civic UX --- ppr-ui/src/views/newMhrRegistration/HomeLocation.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppr-ui/src/views/newMhrRegistration/HomeLocation.vue b/ppr-ui/src/views/newMhrRegistration/HomeLocation.vue index d1b7057f1..407ebe34b 100644 --- a/ppr-ui/src/views/newMhrRegistration/HomeLocation.vue +++ b/ppr-ui/src/views/newMhrRegistration/HomeLocation.vue @@ -16,7 +16,7 @@

Civic Address of the Home

Enter the Street Address (Number and Name) and City of the location of the home. Street Address must be entered - if there is one. The home must be located in B.C. + if there is one.

Date: Fri, 21 Jul 2023 09:47:29 -0700 Subject: [PATCH 5/7] Wys Fix --- .../generalCollateral/GenColAmend.vue | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ppr-ui/src/components/collateral/generalCollateral/GenColAmend.vue b/ppr-ui/src/components/collateral/generalCollateral/GenColAmend.vue index 546581e17..d1d790759 100644 --- a/ppr-ui/src/components/collateral/generalCollateral/GenColAmend.vue +++ b/ppr-ui/src/components/collateral/generalCollateral/GenColAmend.vue @@ -106,8 +106,8 @@ import { defineComponent, reactive, toRefs, - onMounted, - computed + computed, + watch } from 'vue-demi' import { useStore } from '@/store/store' // import the component and the necessary extensions @@ -180,8 +180,8 @@ export default defineComponent({ ] const localState = reactive({ - delDesc: (getGeneralCollateral?.value && getGeneralCollateral.value[1]?.descriptionDelete) || '', - addDesc: (getGeneralCollateral?.value && getGeneralCollateral.value[1]?.descriptionAdd) || '', + delDesc: '', + addDesc: '', generalCollateral: computed((): GeneralCollateralIF[] => { return (getGeneralCollateral.value as GeneralCollateralIF[]) || [] }), @@ -247,15 +247,15 @@ export default defineComponent({ emit('closeGenColAmend', true) } - onMounted(() => { - const gc = localState.generalCollateral + /** Called when general collateral updates */ + watch(() => localState.generalCollateral, async (gc: GeneralCollateralIF[]) => { if (gc.length > 0) { if (gc[gc.length - 1].addedDateTime === undefined) { - localState.addDesc = gc[gc.length - 1].descriptionAdd - localState.delDesc = gc[gc.length - 1].descriptionDelete + localState.addDesc = gc[gc.length - 1].descriptionAdd || '' + localState.delDesc = gc[gc.length - 1].descriptionDelete || '' } } - }) + }, { deep: true, immediate: true }) return { isTiptapEnabled, From 1f6f6035ea3df8a0cdb43ae3eeaee0a33b1941f7 Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Fri, 21 Jul 2023 10:11:59 -0700 Subject: [PATCH 6/7] Make/Model bug fix --- .../mhrRegistration/YourHome/ManufacturerMakeModel.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ppr-ui/src/components/mhrRegistration/YourHome/ManufacturerMakeModel.vue b/ppr-ui/src/components/mhrRegistration/YourHome/ManufacturerMakeModel.vue index 98b9e85b6..524f47199 100644 --- a/ppr-ui/src/components/mhrRegistration/YourHome/ManufacturerMakeModel.vue +++ b/ppr-ui/src/components/mhrRegistration/YourHome/ManufacturerMakeModel.vue @@ -164,8 +164,8 @@ export default defineComponent({ const localState = reactive({ makeModelValid: false, manufacturerName: getMhrRegistrationManufacturerName.value, - make: getMhrRegistrationHomeMake.value, - model: getMhrRegistrationHomeModel.value + make: getMhrRegistrationHomeMake.value || '', + model: getMhrRegistrationHomeModel.value || '' }) watch(() => localState.manufacturerName, (val: string) => { From 27e179c4a143efccec00ce46dfecf8f77c425568 Mon Sep 17 00:00:00 2001 From: Cameron Bowler Date: Fri, 21 Jul 2023 10:42:12 -0700 Subject: [PATCH 7/7] update submission --- .../mhrRegistration/HomeLocation/HomeCivicAddress.vue | 2 +- .../src/composables/mhrRegistration/useNewMhrRegistration.ts | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue b/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue index 43ef74921..36197cc55 100644 --- a/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue +++ b/ppr-ui/src/components/mhrRegistration/HomeLocation/HomeCivicAddress.vue @@ -103,7 +103,7 @@ export default defineComponent({ default: () => ({ street: '', city: '', - region: 'BC', + region: '', postalCode: '', country: '', deliveryInstructions: '' diff --git a/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts b/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts index 9fb505546..424d16fc5 100644 --- a/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts +++ b/ppr-ui/src/composables/mhrRegistration/useNewMhrRegistration.ts @@ -251,9 +251,6 @@ export const useNewMhrRegistration = () => { const parseLocation = (): MhrRegistrationHomeLocationIF => { const location: MhrRegistrationHomeLocationIF = cleanEmpty(getMhrRegistrationLocation.value) - // location is always in BC - location.address.country = 'CA' - location.address.region = 'BC' // Work around require to satisfy schema validations. Currently, not collected by UI. if (!location.address.postalCode) location.address.postalCode = 'A1A 1A1'