diff --git a/src/components/AgmLocationChange/AgmLocation.vue b/src/components/AgmLocationChange/AgmLocation.vue new file mode 100644 index 000000000..28607da49 --- /dev/null +++ b/src/components/AgmLocationChange/AgmLocation.vue @@ -0,0 +1,66 @@ + + + diff --git a/src/components/AgmLocationChange/AgmYear.vue b/src/components/AgmLocationChange/AgmYear.vue index e9c91f115..fd3c63f87 100644 --- a/src/components/AgmLocationChange/AgmYear.vue +++ b/src/components/AgmLocationChange/AgmYear.vue @@ -46,7 +46,7 @@ export default class AgmYear extends Vue { this.emitValid(val) } - /** Validate business name field */ + /** Validate AGM year field */ @Watch('validateForm') validateAgmYear (): void { if (this.validateForm && !this.agmYear) { diff --git a/src/schemas/index.ts b/src/schemas/index.ts index a8065c88e..3f5e9cd0d 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -1,2 +1 @@ export * from './office-address-schema' -export * from './location-address-schema' diff --git a/src/schemas/location-address-schema.ts b/src/schemas/location-address-schema.ts deleted file mode 100644 index 888074e75..000000000 --- a/src/schemas/location-address-schema.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { required, maxLength } from 'vuelidate/lib/validators' - -// The schema containing Vuelidate rules. -// NB: This should match the subject JSON schema. -export const locationAddressSchema = { - streetAddress: { - required, - maxLength: maxLength(50) - }, - streetAddressAdditional: { - maxLength: maxLength(50) - }, - addressCity: { - required, - maxLength: maxLength(40) - }, - addressCountry: { - required - }, - addressRegion: { - maxLength: maxLength(2) - }, - postalCode: { - required, - maxLength: maxLength(15) - }, - deliveryInstructions: { - maxLength: maxLength(80) - } -} diff --git a/src/views/AgmLocationChg.vue b/src/views/AgmLocationChg.vue index fcb320a17..e3bd38031 100644 --- a/src/views/AgmLocationChg.vue +++ b/src/views/AgmLocationChg.vue @@ -61,42 +61,40 @@ - +
-

AGM Location Detail

+

Location Change Detail

- Enter the new AGM location detail including any + Enter the calendar year the AGM is for and AGM location outside B.C.

@@ -117,7 +115,7 @@ AGM Year @@ -126,9 +124,8 @@ sm="4" >
- AGM Location + AGM Location - - - +

+ Enter the AGM location not in B.C. Include the city, province or state equivalent, and country. + E.g. "Red Deer, Alberta, Canada" +

+
@@ -305,7 +306,6 @@ import { Getter } from 'pinia-class' import { StatusCodes } from 'http-status-codes' import { navigate } from '@/utils' import SbcFeeSummary from 'sbc-common-components/src/components/SbcFeeSummary.vue' -import { locationAddressSchema } from '@/schemas' import { Certify, DetailComment } from '@/components/common' import { ConfirmDialog, PaymentErrorDialog, StaffPaymentDialog } from '@/components/dialogs' @@ -314,12 +314,14 @@ import { ExpandableHelp } from '@bcrs-shared-components/expandable-help' import { LegalServices } from '@/services/' import { FilingCodes, FilingTypes, Routes, SaveErrorReasons, StaffPaymentOptions } from '@/enums' -import { AddressIF, ConfirmDialogType, StaffPaymentIF } from '@/interfaces' +import { ConfirmDialogType, StaffPaymentIF } from '@/interfaces' import { useBusinessStore, useConfigurationStore, useRootStore } from '@/stores' +import AgmLocation from '@/components/AgmLocationChange/AgmLocation.vue' import AgmYear from '@/components/AgmLocationChange/AgmYear.vue' @Component({ components: { + AgmLocation, AgmYear, Certify, ConfirmDialog, @@ -334,7 +336,6 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, EnumMixin, FilingMixin, ResourceLookupMixin) { // Refs $refs!: { - agmYearRef: AgmYear, confirm: ConfirmDialogType, certifyRef: Certify } @@ -348,8 +349,8 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, readonly FilingCodes = FilingCodes // variables for main section - agmLocationAddress = {} as AddressIF - agmLocationAddressValid = false + agmLocation = '' + agmLocationValid = false agmYear = '' agmYearValid = false @@ -385,9 +386,6 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, saveErrors = [] saveWarnings = [] - /** The Address schema containing Vuelidate rules. */ - locationAddressSchema = locationAddressSchema - /** True if loading container should be shown, else False. */ get showLoadingContainer (): boolean { // show loading container when data isn't yet loaded and when @@ -402,7 +400,7 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, /** True if page is valid, else False. */ get isPageValid (): boolean { - return (this.agmLocationAddressValid && this.agmYearValid && this.certifyFormValid) + return (this.agmLocationValid && this.agmYearValid && this.certifyFormValid && this.reasonValid) } /** True when saving, saving and resuming, or filing and paying. */ @@ -416,6 +414,14 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, return (this.totalFee > 0) } + /** Array of validations rules for AGM location. */ + get agmLocationRules (): Array<(val) => boolean | string> { + const rules = [] as Array<(val) => boolean | string> + rules.push(val => !!val || 'AGM location is required.') + rules.push(val => (val.length <= 100) || 'Must be 100 characters or less.') + return rules + } + /** Array of validations rules for AGM year. */ get agmYearRules (): Array<(val) => boolean | string> { const rules = [] as Array<(val) => boolean | string> @@ -480,10 +486,6 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, (this.staffPaymentData.option === StaffPaymentOptions.NO_FEE)) } - updateLocationAddress (val: AddressIF): void { - this.agmLocationAddress = val - } - /** * Called when user clicks File and Pay button * or when user retries from Save Error dialog @@ -493,10 +495,6 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, // if there is an invalid component, scroll to it if (!this.isPageValid) { this.showErrors = true - if (!this.agmYearValid) { - // Show error message of agm year if invalid - this.$refs.agmYearRef.$refs.textAreaRef.error = true - } if (!this.certifyFormValid) { // Show error message of legal name text field if invalid this.$refs.certifyRef.$refs.certifyTextfieldRef.error = true @@ -634,7 +632,8 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, const data: any = { [FilingTypes.AGM_LOCATION_CHANGE]: { year: this.agmYear, - newAgmLocation: this.agmLocationAddress + reason: this.reason, + agmLocation: this.agmLocation } } @@ -723,13 +722,13 @@ export default class AgmLocationChg extends Mixins(CommonMixin, DateMixin, // mainSection: this.sectionValid, agmYear: this.agmYearValid, reason: this.reasonValid, - locationAddress: this.agmLocationAddressValid, + location: this.agmLocationValid, certifyForm: this.certifyFormValid } } @Watch('agmYearValid') - @Watch('agmLocationAddressValid') + @Watch('agmLocationValid') @Watch('certifyFormValid') @Watch('resonValid') onHaveChanges (): void { diff --git a/tests/unit/AgmLocationChg.spec.ts b/tests/unit/AgmLocationChg.spec.ts index 9d84eb1ec..11b09d4ba 100644 --- a/tests/unit/AgmLocationChg.spec.ts +++ b/tests/unit/AgmLocationChg.spec.ts @@ -186,27 +186,38 @@ describe('AGM Location Chg view', () => { expect(!!vm.isPayRequired).toBe(true) // verify "validated" - all true - vm.agmLocationAddressValid = true + vm.agmLocationValid = true vm.agmYearValid = true vm.certifyFormValid = true + vm.reasonValid = true expect(!!vm.isPageValid).toBe(true) - // verify "validated" - invalid Location change form - vm.agmLocationAddressValid = false + // verify "validated" - invalid agm year + vm.agmLocationValid = true + vm.agmYearValid = false + vm.certifyFormValid = true + vm.reasonValid = true + expect(!!vm.isPageValid).toBe(false) + + // verify "validated" - invalid reason + vm.agmLocationValid = true vm.agmYearValid = true vm.certifyFormValid = true + vm.reasonValid = false expect(!!vm.isPageValid).toBe(false) - // verify "validated" - invalid agm year - vm.agmLocationAddressValid = true - vm.agmYearValid = false + // verify "validated" - invalid Location change form + vm.agmLocationValid = false + vm.agmYearValid = true vm.certifyFormValid = true + vm.reasonValid = true expect(!!vm.isPageValid).toBe(false) // verify "validated" - invalid Certify form - vm.agmLocationAddressValid = true + vm.agmLocationValid = true vm.agmYearValid = true vm.certifyFormValid = false + vm.reasonValid = true expect(!!vm.isPageValid).toBe(false) }) @@ -217,9 +228,10 @@ describe('AGM Location Chg view', () => { // make sure form is validated await wrapper.setData({ - agmLocationAddressValid: true, + agmLocationValid: true, agmYearValid: true, - certifyFormValid: true + certifyFormValid: true, + reasonValid: true }) await wrapper.setData({ dataLoaded: true })