From ec7f5ca4d805588504e26aa87c6c7b63c2f2a8db Mon Sep 17 00:00:00 2001 From: JazzarKarim Date: Mon, 4 Dec 2023 16:16:24 -0800 Subject: [PATCH] Setup AmalgamatingBusinesses validity --- src/components/Amalgamation/AmalgamatingBusinesses.vue | 6 ++++++ .../state-interfaces/amalgamation-state-interface.ts | 1 + src/store/state/state-model.ts | 1 + src/store/store.ts | 8 ++++++++ 4 files changed, 16 insertions(+) diff --git a/src/components/Amalgamation/AmalgamatingBusinesses.vue b/src/components/Amalgamation/AmalgamatingBusinesses.vue index e156621d5..df87530b3 100644 --- a/src/components/Amalgamation/AmalgamatingBusinesses.vue +++ b/src/components/Amalgamation/AmalgamatingBusinesses.vue @@ -155,11 +155,13 @@ import BusinessTable from '@/components/Amalgamation/BusinessTable.vue' }) export default class AmalgamatingBusinesses extends Mixins(CommonMixin) { @Getter(useStore) getAmalgamatingBusinesses!: AmalgamatingBusinessIF[] + @Getter(useStore) getAmalgamatingBusinessesValid!: boolean @Getter(useStore) getShowErrors!: boolean @Getter(useStore) isAmalgamationFilingHorizontal!: boolean @Getter(useStore) isRoleStaff!: boolean @Action(useStore) setAmalgamatingBusinesses!: (x: Array) => void + @Action(useStore) setAmalgamatingBusinessesValid!: (x: boolean) => void // Local properties amalgamatingBusinessesValid = false @@ -176,18 +178,21 @@ export default class AmalgamatingBusinesses extends Mixins(CommonMixin) { // Cancel button in "Add an Amalgamating Business" is pressed. addAmalgamatingBusinessCancel (): void { this.isAddingAmalgamatingBusiness = false + this.setAmalgamatingBusinessesValid(true) } // "Add an Amalgamating Business" button is pressed. onAddBusinessClick (): void { this.isAddingAmalgamatingBusiness = true this.isAddingAmalgamatingForeignBusiness = false + this.setAmalgamatingBusinessesValid(false) } // "Add an Amalgamating Foreign Business" button is pressed. onAddForeignBusinessClick (): void { this.isAddingAmalgamatingBusiness = false this.isAddingAmalgamatingForeignBusiness = true + this.setAmalgamatingBusinessesValid(false) } async saveAmalgamatingBusiness (businessLookup: BusinessLookupIF): Promise { @@ -226,6 +231,7 @@ export default class AmalgamatingBusinesses extends Mixins(CommonMixin) { this.setAmalgamatingBusinesses(this.amalgamatingBusinesses) // Close the "Add an Amalgamating Business" Panel. this.addAmalgamatingBusinessCancel() + this.setAmalgamatingBusinessesValid(true) } } diff --git a/src/interfaces/store-interfaces/state-interfaces/amalgamation-state-interface.ts b/src/interfaces/store-interfaces/state-interfaces/amalgamation-state-interface.ts index 4f9ddde57..3611d651f 100644 --- a/src/interfaces/store-interfaces/state-interfaces/amalgamation-state-interface.ts +++ b/src/interfaces/store-interfaces/state-interfaces/amalgamation-state-interface.ts @@ -43,5 +43,6 @@ export type AmalgamatingBusinessIF = AmalgamatingLearIF | AmalgamatingForeignIF export interface AmalgamationStateIF { amalgamatingBusinesses: Array courtApproval: boolean + amalgamatingBusinessesValid: boolean type: AmalgamationTypes } diff --git a/src/store/state/state-model.ts b/src/store/state/state-model.ts index 452ef8dd6..45d575d02 100644 --- a/src/store/state/state-model.ts +++ b/src/store/state/state-model.ts @@ -317,6 +317,7 @@ export const stateModel: StateModelIF = { }, amalgamation: { amalgamatingBusinesses: cloneDeep(AMALGAMATING_BUSINESSES), + amalgamatingBusinessesValid: false, courtApproval: null, type: null }, diff --git a/src/store/store.ts b/src/store/store.ts index 005ae8adb..0b3db8446 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -746,6 +746,11 @@ export const useStore = defineStore('store', { return this.stateModel.amalgamation.amalgamatingBusinesses }, + /** The amalgamating businesses validity. */ + getAmalgamatingBusinessesValid (): boolean { + return this.stateModel.amalgamation.amalgamatingBusinessesValid + }, + // // Dissolution getters // @@ -1224,6 +1229,9 @@ export const useStore = defineStore('store', { setAmalgamatingBusinesses (amalgamatingBusinesses: Array) { this.stateModel.amalgamation.amalgamatingBusinesses = amalgamatingBusinesses }, + setAmalgamatingBusinessesValid (valid: boolean) { + this.stateModel.amalgamation.amalgamatingBusinessesValid = valid + }, setAmalgamationType (type: AmalgamationTypes) { this.stateModel.amalgamation.type = type },