Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15951 - Special Resolution Correction - QA / UX fixes #509

Merged
merged 11 commits into from
Jul 6, 2023
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 3 additions & 4 deletions src/components/SpecialResolution/Resolution.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
<v-btn
id="btn-resolution-done"
large
color="primary"
class="mr-2"
@click="updateSpecialResolutionStore()"
>
<span>Done</span>
Expand Down Expand Up @@ -181,8 +180,8 @@ export default class Resolution extends Vue {

/** For ok button, stores using setSpecialResolution. */
async updateSpecialResolutionStore (): Promise<void> {
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
Expand Down
9 changes: 3 additions & 6 deletions src/components/SpecialResolution/ResolutionEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,12 @@ export default class ResolutionEditor extends Vue {

/** Used to trigger validate from outside of component. */
@Watch('getComponentValidate')
async onValidate (): Promise<void> {
if (!this.isEditing) {
this.setSpecialResolutionValid(true)
return
}
async onValidate (includeIsEditing = true): Promise<void> {
const hasData = !!this.resolutionDateText && !!this.resolution && this.resolution !== '<p></p>'
this.$refs.resolutionDatePickerRef.validateForm()
const isResolutionDateValid = this.$refs.resolutionDatePickerRef.isDateValid()
this.setSpecialResolutionValid(hasData && isResolutionDateValid)
const isValid = hasData && isResolutionDateValid && (!includeIsEditing || !this.isEditing)
this.setSpecialResolutionValid(isValid)
}
}
</script>
Expand Down
17 changes: 10 additions & 7 deletions src/components/SpecialResolution/Rules.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@
</div>
<div v-else>
<div
class="px-4 pt-0 section-container info-text"
class="pt-0 instructional-text section-container"
:class="{'error-text': rulesEditingInvalid}"
>
You can update the rules of association in one of the following ways:
</div>
<v-divider class="mx-4" />
<v-divider class="mx-8" />
<section
class="px-4 py-4 section-container"
class="py-4 section-container"
>
<v-btn
id="btn-describe-rules"
Expand Down Expand Up @@ -128,9 +128,9 @@
</template>
</v-checkbox>
</section>
<v-divider class="mx-4" />
<v-divider class="mx-8" />
<section
class="pa-4 section-container"
class="section-container"
>
<v-btn
id="btn-upload-rules"
Expand Down Expand Up @@ -189,7 +189,7 @@
</header>
</v-expand-transition>
</section>
<v-divider class="mx-4" />
<v-divider class="mx-8" />

<v-row
id="rules-confirmation-buttons"
Expand Down Expand Up @@ -519,7 +519,7 @@ header {
}

.black-bold-font {
color: black !important;
color: $gray9 !important;
font-weight: bold !important
}

Expand Down Expand Up @@ -575,5 +575,8 @@ a {
:deep(.v-label) {
font-weight: normal;
}
.instructional-text {
color: $gray7;
}

</style>
9 changes: 3 additions & 6 deletions src/components/SpecialResolution/SigningParty.vue
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,12 @@ export default class SigningParty extends Vue {

/** Used to trigger validate from outside of component. */
@Watch('getComponentValidate')
async onValidate (): Promise<void> {
if (!this.isEditing) {
await this.setSpecialResolutionSignatureValid(true)
return
}
async onValidate (includeIsEditing = true): Promise<void> {
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)
}
}
</script>
Expand Down
4 changes: 4 additions & 0 deletions src/components/common/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<v-btn
id="save-btn"
large
outlined
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

color="primary"
:disabled="isSaveButtonDisabled"
:loading="isSaving"
@click="onClickSave()"
Expand All @@ -20,6 +22,8 @@
<v-btn
id="save-resume-btn"
large
outlined
color="primary"
:disabled="isSaveResumeButtonDisabled"
:loading="isSavingResuming"
@click="onClickSaveResume()"
Expand Down
115 changes: 72 additions & 43 deletions src/mixins/filing-template-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default class FilingTemplateMixin extends DateMixin {
@Getter(useStore) getSpecialResolutionRules!: RulesMemorandumIF
@Getter(useStore) isCoopCorrectionFiling!: boolean
@Getter(useStore) getLatestResolutionForBusiness!: SpecialResolutionIF
@Getter(useStore) hasSpecialResolutionResolutionChanged!: boolean

// Global actions
@Action(useStore) setBusinessContact!: ActionBindingIF
Expand Down Expand Up @@ -199,16 +200,8 @@ export default class FilingTemplateMixin extends DateMixin {
}

if (this.isCoopCorrectionFiling) {
// Parties and offices aren't required for Coop corrections.
delete filing.correction.parties
// Offices aren't required for Coop corrections.
delete filing.correction.offices
filing.correction = {
...filing.correction,
resolution: this.getSpecialResolution.resolution,
resolutionDate: this.getSpecialResolution.resolutionDate,
signingDate: this.getSpecialResolution.signingDate,
signatory: this.getSpecialResolution.signatory
}

// Apply Court Order ONLY when it is required and applied
if (this.getHasPlanOfArrangement || this.getFileNumber) {
Expand All @@ -219,31 +212,48 @@ 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
}
// Ensures a key isn't passed when including the rules or memorandum in the resolution.
// Business rules are a bit different for corrections.
if (this.hasAssociationTypeChanged) {
filing.correction.cooperativeAssociationType = this.getAssociationType
}

if (this.hasSpecialResolutionRulesChanged) {
if (this.getSpecialResolutionRules?.includedInResolution) {
delete filing.correction.rulesFileKey
delete filing.correction.rulesFileName
delete filing.correction.rulesUploadedOn
filing.correction.rulesInResolution = true
filing.correction = {
...filing.correction,
rulesInResolution: true
}
} else {
filing.correction = {
...filing.correction,
rulesFileKey: this.getSpecialResolutionRules?.key,
rulesFileName: this.getSpecialResolutionRules?.name
}
}
}

if (this.hasSpecialResolutionMemorandumChanged) {
if (this.getSpecialResolutionMemorandum?.includedInResolution) {
delete filing.correction.memorandumFileKey
delete filing.correction.memorandumFileName
filing.correction.memorandumInResolution = true
filing.correction = {
...filing.correction,
memorandumInResolution: true
}
} else {
filing.correction = {
...filing.correction,
memorandumFileKey: this.getSpecialResolutionMemorandum?.key,
memorandumFileName: this.getSpecialResolutionMemorandum?.name
}
}
}

if (this.hasSpecialResolutionResolutionChanged) {
filing.correction = {
...filing.correction,
resolution: this.getSpecialResolution.resolution,
resolutionDate: this.getSpecialResolution.resolutionDate,
signingDate: this.getSpecialResolution.signingDate,
signatory: this.getSpecialResolution.signatory
}
}
}
Expand Down Expand Up @@ -467,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
}
}
}

Expand Down Expand Up @@ -766,7 +785,17 @@ 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 = {
resolution: filing.correction?.resolution,
resolutionDate: filing.correction?.resolutionDate,
signingDate: filing.correction?.signingDate,
signatory: filing.correction?.signatory
}
} else {
specialResolution = this.getLatestResolutionForBusiness
}
this.setSpecialResolution(cloneDeep(specialResolution))
}

Expand Down
3 changes: 3 additions & 0 deletions tests/unit/Resolution.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()

Expand Down
4 changes: 4 additions & 0 deletions tests/unit/ResolutionEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '<p></p>' })
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: '<p>Resolution text</p>' })
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: '<p> Resolution tex </p>' })
await wrapper.setProps({ isEditing: false })
await Vue.nextTick()
store.setComponentValidate(true)
await Vue.nextTick()
expect(store.getValidationFlags.flagsCompanyInfo.isValidSpecialResolution).toBe(true)
Expand Down
Loading