From 9978b6715bbf37423654dc855520af0162740a3d Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Mon, 26 Jun 2023 08:30:30 -0700 Subject: [PATCH 01/11] Small tweak --- package-lock.json | 4 ++-- package.json | 2 +- src/mixins/filing-template-mixin.ts | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6dcb0183..51f54f3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-edit-ui", - "version": "4.4.6", + "version": "4.4.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "business-edit-ui", - "version": "4.4.6", + "version": "4.4.7", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/action-chip": "1.1.5", diff --git a/package.json b/package.json index 38fdd507..9d91ff2e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-edit-ui", - "version": "4.4.6", + "version": "4.4.7", "private": true, "appName": "Edit UI", "sbcName": "SBC Common Components", diff --git a/src/mixins/filing-template-mixin.ts b/src/mixins/filing-template-mixin.ts index 2fd1431f..7781fd73 100644 --- a/src/mixins/filing-template-mixin.ts +++ b/src/mixins/filing-template-mixin.ts @@ -766,7 +766,12 @@ export default class FilingTemplateMixin extends DateMixin { if (this.isCoopCorrectionFiling) { this.storeSpecialResolutionRulesAndMemorandum(filing.correction, entitySnapshot) - const specialResolution = this.getLatestResolutionForBusiness + let specialResolution: SpecialResolutionIF = {} + if (filing.correction.resolution) { + specialResolution = filing.correction + } else { + specialResolution = this.getLatestResolutionForBusiness + } this.setSpecialResolution(cloneDeep(specialResolution)) } From e528397b201278104e7b66e17b101a089c05c26b Mon Sep 17 00:00:00 2001 From: Jia Xu Date: Mon, 26 Jun 2023 09:44:02 -0700 Subject: [PATCH 02/11] test permission --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3cec0dd5..5759cf8c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## Project setup ``` -npm install +npm install ``` ### Compiles and hot-reloads for development From 41169d40bd4ec83b4f597b2e7d920111293c984f Mon Sep 17 00:00:00 2001 From: Jia Xu Date: Mon, 26 Jun 2023 18:20:49 -0700 Subject: [PATCH 03/11] revert last commit, which for permission test --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5759cf8c..3cec0dd5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## Project setup ``` -npm install +npm install ``` ### Compiles and hot-reloads for development From 24d91ce7d84d751ec683a6c8e9180ee092e86b24 Mon Sep 17 00:00:00 2001 From: Jia Xu Date: Mon, 26 Jun 2023 21:22:01 -0700 Subject: [PATCH 04/11] add a unit test to get rid of codecov issue --- tests/unit/filing-template-mixin.spec.ts | 115 ++++++++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/tests/unit/filing-template-mixin.spec.ts b/tests/unit/filing-template-mixin.spec.ts index ee350bba..b09030a2 100644 --- a/tests/unit/filing-template-mixin.spec.ts +++ b/tests/unit/filing-template-mixin.spec.ts @@ -7,8 +7,121 @@ import { CorpTypeCd, FilingTypes } from '@/enums' setActivePinia(createPinia()) const store = useStore() -// FUTURE describe('Correction Filing', () => { + let wrapper: any + + beforeEach(() => { + wrapper = shallowMount(MixinTester) + }) + + afterEach(() => { + wrapper.destroy() + }) + + it('correctly builds a special resolution filing', () => { + store.stateModel.tombstone.businessId = 'CP1234567' + store.stateModel.tombstone.filingType = FilingTypes.SPECIAL_RESOLUTION + store.stateModel.tombstone.entityType = CorpTypeCd.COOP + store.stateModel.specialResolution.resolution = '

xxxx

' + store.stateModel.specialResolution.resolutionConfirmed = true + store.stateModel.specialResolution.signatory = { + familyName: 'SGSG', + givenName: 'GSG' + } + store.stateModel.completingParty = { + firstName: 'First', + lastName: 'Last', + middleName: 'Middle', + mailingAddress: { + streetAddress: '123 Completing Ave', + addressCity: 'Party', + addressRegion: 'BC', + postalCode: 'V0V 0V0', + addressCountry: 'CA' + } + } + store.stateModel.entitySnapshot = { + businessInfo: { + foundingDate: 'Jan 01, 2000', + legalType: CorpTypeCd.COOP, + identifier: 'CP1234567', + legalName: 'SomeMockBusiness' + }, + addresses: { + businessOffice: { + mailingAddress: { + addressCity: 'Charlie', + addressCountry: 'CA', + addressRegion: 'BC', + deliveryInstructions: 'Mailing address', + postalCode: 'V2V 2V2', + streetAddress: '222 Second St', + streetAddressAdditional: 'Suite 2' + }, + deliveryAddress: { + addressCity: 'Alpha', + addressCountry: 'CA', + addressRegion: 'BC', + deliveryInstructions: 'Delivery address', + postalCode: 'V1V 1V1', + streetAddress: '111 First St', + streetAddressAdditional: 'Suite 1' + } + } + } + } as any + + const filing = wrapper.vm.buildSpecialResolutionFiling(true) + + // FUTURE: check filing data... + expect(filing).toEqual( + expect.objectContaining({ + business: { + foundingDate: 'Jan 01, 2000', + identifier: 'CP1234567', + legalName: 'SomeMockBusiness', + legalType: 'CP', + nrNumber: undefined + }, + specialResolution: { + resolution: '

xxxx

', + resolutionConfirmed: true, + signatory: { + familyName: 'SGSG', + givenName: 'GSG' + } + }, + alteration: { + business: { + identifier: 'CP1234567', + legalType: 'CP' + }, + contactPoint: { + email: '', + phone: '' + }, + cooperativeAssociationType: null, + rulesFileKey: undefined, + rulesFileName: undefined, + rulesUploadedOn: undefined + }, + changeOfName: { + legalName: null, + nameRequest: { + legalName: null, + legalType: null, + nrNumber: null + } + }, + header: { + certifiedBy: '', + date: '', + folioNumber: '', + name: 'specialResolution' + } + }) + ) + }) }) // FUTURE From 6186321d016318ea8058e23534ab1391d76d890d Mon Sep 17 00:00:00 2001 From: Jia Xu Date: Tue, 27 Jun 2023 07:54:26 -0700 Subject: [PATCH 05/11] add unit test to fix codecov issue --- tests/unit/filing-template-mixin.spec.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unit/filing-template-mixin.spec.ts b/tests/unit/filing-template-mixin.spec.ts index b09030a2..3346dd4e 100644 --- a/tests/unit/filing-template-mixin.spec.ts +++ b/tests/unit/filing-template-mixin.spec.ts @@ -24,6 +24,10 @@ describe('Correction Filing', () => { store.stateModel.tombstone.entityType = CorpTypeCd.COOP store.stateModel.specialResolution.resolution = '

xxxx

' store.stateModel.specialResolution.resolutionConfirmed = true + store.stateModel.rules = store.stateModel.rules || {} + store.stateModel.memorandum = store.stateModel.memorandum || {} + store.stateModel.rules.includedInResolution = true + store.stateModel.memorandum.includedInResolution = true store.stateModel.specialResolution.signatory = { familyName: 'SGSG', givenName: 'GSG' @@ -103,7 +107,9 @@ describe('Correction Filing', () => { cooperativeAssociationType: null, rulesFileKey: undefined, rulesFileName: undefined, - rulesUploadedOn: undefined + rulesUploadedOn: undefined, + rulesInResolution: true, + memorandumInResolution: true }, changeOfName: { legalName: null, From 7b2087779d26f03e492d3ba6784d4951372c918e Mon Sep 17 00:00:00 2001 From: Jia Xu Date: Fri, 30 Jun 2023 15:54:52 -0700 Subject: [PATCH 06/11] rules styling fix --- src/components/SpecialResolution/Rules.vue | 15 +++++++++------ src/mixins/filing-template-mixin.ts | 7 ++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/SpecialResolution/Rules.vue b/src/components/SpecialResolution/Rules.vue index f4b92fe5..0fcef133 100644 --- a/src/components/SpecialResolution/Rules.vue +++ b/src/components/SpecialResolution/Rules.vue @@ -89,14 +89,14 @@
You can update the rules of association in one of the following ways:
- +
- +
- + diff --git a/src/mixins/filing-template-mixin.ts b/src/mixins/filing-template-mixin.ts index 7781fd73..643d1c2a 100644 --- a/src/mixins/filing-template-mixin.ts +++ b/src/mixins/filing-template-mixin.ts @@ -768,7 +768,12 @@ export default class FilingTemplateMixin extends DateMixin { this.storeSpecialResolutionRulesAndMemorandum(filing.correction, entitySnapshot) let specialResolution: SpecialResolutionIF = {} if (filing.correction.resolution) { - specialResolution = filing.correction + specialResolution = { + resolution: filing.correction?.resolution, + resolutionDate: filing.correction?.resolutionDate, + signingDate: filing.correction?.signingDate, + signatory: filing.correction?.signatory + } } else { specialResolution = this.getLatestResolutionForBusiness } From 311af0a27272ea92604b12290684e3f5ca20b480 Mon Sep 17 00:00:00 2001 From: Jia Xu Date: Tue, 4 Jul 2023 10:49:09 -0700 Subject: [PATCH 07/11] rules section button styling --- src/components/SpecialResolution/Resolution.vue | 3 +-- src/components/SpecialResolution/Rules.vue | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/SpecialResolution/Resolution.vue b/src/components/SpecialResolution/Resolution.vue index 063ed95f..f67910a9 100644 --- a/src/components/SpecialResolution/Resolution.vue +++ b/src/components/SpecialResolution/Resolution.vue @@ -102,13 +102,12 @@ v-if="isEditing" id="resolution-confirmation-buttons" no-gutters - class="justify-end pr-8 pb-8 mt-8 d-flex" + class="justify-end pb-8 mt-8 d-flex" > Done diff --git a/src/components/SpecialResolution/Rules.vue b/src/components/SpecialResolution/Rules.vue index 0fcef133..93b4b3c5 100644 --- a/src/components/SpecialResolution/Rules.vue +++ b/src/components/SpecialResolution/Rules.vue @@ -519,7 +519,7 @@ header { } .black-bold-font { - color: black !important; + color: $gray9 !important; font-weight: bold !important } From 8d8360fbc2497c73d2bc437671b3e1b2015c76b4 Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Tue, 4 Jul 2023 12:21:43 -0700 Subject: [PATCH 08/11] Minor tweak for correction payload. --- src/mixins/filing-template-mixin.ts | 53 ++++++++++++++++------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/mixins/filing-template-mixin.ts b/src/mixins/filing-template-mixin.ts index 643d1c2a..66c4afe7 100644 --- a/src/mixins/filing-template-mixin.ts +++ b/src/mixins/filing-template-mixin.ts @@ -219,31 +219,38 @@ export default class FilingTemplateMixin extends DateMixin { } } - if ( - this.hasAssociationTypeChanged || - this.hasSpecialResolutionMemorandumChanged || - this.hasSpecialResolutionRulesChanged - ) { - filing.correction = { - ...filing.correction, - cooperativeAssociationType: this.getAssociationType, - rulesFileKey: this.getSpecialResolutionRules?.key, - rulesFileName: this.getSpecialResolutionRules?.name, - rulesUploadedOn: this.getSpecialResolutionRules?.uploaded, - memorandumFileKey: this.getSpecialResolutionMemorandum?.key, - memorandumFileName: this.getSpecialResolutionMemorandum?.name + // Business rules are a bit different for corrections. + if (this.hasAssociationTypeChanged) { + filing.correction.cooperativeAssociationType = this.getAssociationType + } + + if (this.hasSpecialResolutionMemorandumChanged) { + if (this.getSpecialResolutionMemorandum?.includedInResolution) { + filing.correction = { + ...filing.correction, + memorandumInResolution: true + } + } else { + filing.correction = { + ...filing.correction, + memorandumFileKey: this.getSpecialResolutionMemorandum?.key, + memorandumFileName: this.getSpecialResolutionMemorandum?.name + } } - // Ensures a key isn't passed when including the rules or memorandum in the resolution. + } + + if (this.hasSpecialResolutionRulesChanged) { if (this.getSpecialResolutionRules?.includedInResolution) { - delete filing.correction.rulesFileKey - delete filing.correction.rulesFileName - delete filing.correction.rulesUploadedOn - filing.correction.rulesInResolution = true - } - if (this.getSpecialResolutionMemorandum?.includedInResolution) { - delete filing.correction.memorandumFileKey - delete filing.correction.memorandumFileName - filing.correction.memorandumInResolution = true + filing.correction = { + ...filing.correction, + rulesInResolution: true + } + } else { + filing.correction = { + ...filing.correction, + rulesFileKey: this.getSpecialResolutionRules?.key, + rulesFileName: this.getSpecialResolutionRules?.name + } } } } From 36a86638a0a0ccf2b7edcb9050bdaac9bd9c4b72 Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Wed, 5 Jul 2023 11:20:44 -0700 Subject: [PATCH 09/11] Minor UX fixes + changes to correction payload. --- .../SpecialResolution/Resolution.vue | 4 +- .../SpecialResolution/ResolutionEditor.vue | 9 ++-- .../SpecialResolution/SigningParty.vue | 9 ++-- src/components/common/Actions.vue | 4 ++ src/mixins/filing-template-mixin.ts | 41 ++++++++++--------- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/src/components/SpecialResolution/Resolution.vue b/src/components/SpecialResolution/Resolution.vue index f67910a9..e0da64b4 100644 --- a/src/components/SpecialResolution/Resolution.vue +++ b/src/components/SpecialResolution/Resolution.vue @@ -180,8 +180,8 @@ export default class Resolution extends Vue { /** For ok button, stores using setSpecialResolution. */ async updateSpecialResolutionStore (): Promise { - await this.$refs.resolutionEditor.onValidate() - await this.$refs.signingParty.onValidate() + await this.$refs.resolutionEditor.onValidate(false) + await this.$refs.signingParty.onValidate(false) if (this.getSpecialResolutionFormValid) { this.isEditing = false this.hasChanged = true diff --git a/src/components/SpecialResolution/ResolutionEditor.vue b/src/components/SpecialResolution/ResolutionEditor.vue index 41fcffff..4cffa44d 100644 --- a/src/components/SpecialResolution/ResolutionEditor.vue +++ b/src/components/SpecialResolution/ResolutionEditor.vue @@ -319,15 +319,12 @@ export default class ResolutionEditor extends Vue { /** Used to trigger validate from outside of component. */ @Watch('getComponentValidate') - async onValidate (): Promise { - if (!this.isEditing) { - this.setSpecialResolutionValid(true) - return - } + async onValidate (includeIsEditing = true): Promise { const hasData = !!this.resolutionDateText && !!this.resolution && this.resolution !== '

' this.$refs.resolutionDatePickerRef.validateForm() const isResolutionDateValid = this.$refs.resolutionDatePickerRef.isDateValid() - this.setSpecialResolutionValid(hasData && isResolutionDateValid) + const isValid = hasData && isResolutionDateValid && (!includeIsEditing || !this.isEditing) + this.setSpecialResolutionValid(isValid) } } diff --git a/src/components/SpecialResolution/SigningParty.vue b/src/components/SpecialResolution/SigningParty.vue index d19950da..a1c7568f 100644 --- a/src/components/SpecialResolution/SigningParty.vue +++ b/src/components/SpecialResolution/SigningParty.vue @@ -272,15 +272,12 @@ export default class SigningParty extends Vue { /** Used to trigger validate from outside of component. */ @Watch('getComponentValidate') - async onValidate (): Promise { - if (!this.isEditing) { - await this.setSpecialResolutionSignatureValid(true) - return - } + async onValidate (includeIsEditing = true): Promise { const hasSigningData = !!this.signingDate && !!this.signatory.givenName && !!this.signatory.familyName this.$refs.signatureDatePickerRef.validateForm() const isSignatureDateValid = this.$refs.signatureDatePickerRef.isDateValid() - await this.setSpecialResolutionSignatureValid(hasSigningData && isSignatureDateValid) + const isValid = hasSigningData && isSignatureDateValid && (!includeIsEditing || !this.isEditing) + await this.setSpecialResolutionSignatureValid(isValid) } } diff --git a/src/components/common/Actions.vue b/src/components/common/Actions.vue index 307316bd..f4d79630 100644 --- a/src/components/common/Actions.vue +++ b/src/components/common/Actions.vue @@ -10,6 +10,8 @@ Date: Wed, 5 Jul 2023 11:48:32 -0700 Subject: [PATCH 10/11] Minor unit test fixes --- tests/unit/Resolution.spec.ts | 3 +++ tests/unit/ResolutionEditor.spec.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/tests/unit/Resolution.spec.ts b/tests/unit/Resolution.spec.ts index e21ffd5e..cc3ff62f 100644 --- a/tests/unit/Resolution.spec.ts +++ b/tests/unit/Resolution.spec.ts @@ -100,6 +100,8 @@ describe('Special Resolution Form component', () => { }) it('validation - signatory date should be after or on resolution date', async () => { + wrapper.vm.isEditing = false + await Vue.nextTick() store.stateModel.validationFlags.componentValidate = true await Vue.nextTick() expect(store.stateModel.validationFlags.flagsCompanyInfo.isValidSpecialResolutionSignature).toBe(true) @@ -111,6 +113,7 @@ describe('Special Resolution Form component', () => { } await Vue.nextTick() wrapper = mount(Resolution, { vuetify }) + wrapper.vm.isEditing = false store.stateModel.validationFlags.componentValidate = true await flushPromises() diff --git a/tests/unit/ResolutionEditor.spec.ts b/tests/unit/ResolutionEditor.spec.ts index 2f1abf4b..d44bfad3 100644 --- a/tests/unit/ResolutionEditor.spec.ts +++ b/tests/unit/ResolutionEditor.spec.ts @@ -44,16 +44,20 @@ describe('ResolutionEditor', () => { expect(store.getValidationFlags.flagsCompanyInfo.isValidSpecialResolution).toBe(true) await wrapper.findComponent(DatePickerShared).setData({ dateText: '2023-05-08' }) await wrapper.setData({ resolutionDateText: '2023-05-08', resolution: '

' }) + await wrapper.setProps({ isEditing: false }) store.setComponentValidate(true) await Vue.nextTick() expect(store.getValidationFlags.flagsCompanyInfo.isValidSpecialResolution).toBe(false) await wrapper.findComponent(DatePickerShared).setData({ dateText: '' }) await wrapper.setData({ resolutionDateText: '', resolution: '

Resolution text

' }) + await wrapper.setProps({ isEditing: false }) store.setComponentValidate(true) await Vue.nextTick() expect(store.getValidationFlags.flagsCompanyInfo.isValidSpecialResolution).toBe(false) await wrapper.findComponent(DatePickerShared).setData({ dateText: '2020-03-01' }) await wrapper.setData({ resolutionDateText: '2020-03-01', resolution: '

Resolution tex

' }) + await wrapper.setProps({ isEditing: false }) + await Vue.nextTick() store.setComponentValidate(true) await Vue.nextTick() expect(store.getValidationFlags.flagsCompanyInfo.isValidSpecialResolution).toBe(true) From 84b7d74652ac0397989869c45066a8931fd25595 Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Wed, 5 Jul 2023 15:44:00 -0700 Subject: [PATCH 11/11] Make rules or memorandum addable by themselves. --- src/mixins/filing-template-mixin.ts | 31 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/mixins/filing-template-mixin.ts b/src/mixins/filing-template-mixin.ts index 66c5ac43..e525aa07 100644 --- a/src/mixins/filing-template-mixin.ts +++ b/src/mixins/filing-template-mixin.ts @@ -477,27 +477,36 @@ export default class FilingTemplateMixin extends DateMixin { legalType: this.getEntityType }, contactPoint: this.getContactPoint, - cooperativeAssociationType: this.getAssociationType, - rulesFileKey: this.getSpecialResolutionRules?.key, - rulesFileName: this.getSpecialResolutionRules?.name, - rulesUploadedOn: this.getSpecialResolutionRules?.uploaded, - memorandumFileKey: this.getSpecialResolutionMemorandum?.key, - memorandumFileName: this.getSpecialResolutionMemorandum?.name + cooperativeAssociationType: this.getAssociationType } + } + + if (this.hasSpecialResolutionRulesChanged) { /* Ensures a key isn't passed when including the rules or memorandum in the resolution. See validator here: https://github.com/bcgov/lear/blob/main/legal-api/src/legal_api/services/filings/validations/alteration.py#L177 */ if (this.getSpecialResolutionRules?.includedInResolution) { - delete filing.alteration.rulesFileKey - delete filing.alteration.rulesFileName - delete filing.alteration.rulesUploadedOn filing.alteration.rulesInResolution = true + } else { + filing.alteration = { + ...filing.alteration, + rulesFileKey: this.getSpecialResolutionRules?.key, + rulesFileName: this.getSpecialResolutionRules?.name, + rulesUploadedOn: this.getSpecialResolutionRules?.uploaded + } } + } + + if (this.hasSpecialResolutionMemorandumChanged) { if (this.getSpecialResolutionMemorandum?.includedInResolution) { - delete filing.alteration.memorandumFileKey - delete filing.alteration.memorandumFileName filing.alteration.memorandumInResolution = true + } else { + filing.alteration = { + ...filing.alteration, + memorandumFileKey: this.getSpecialResolutionMemorandum?.key, + memorandumFileName: this.getSpecialResolutionMemorandum?.name + } } }