Skip to content

Commit

Permalink
Setup AmalgamatingBusinesses validity
Browse files Browse the repository at this point in the history
  • Loading branch information
JazzarKarim committed Dec 5, 2023
1 parent 8bad1e6 commit ec7f5ca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/Amalgamation/AmalgamatingBusinesses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>) => void
@Action(useStore) setAmalgamatingBusinessesValid!: (x: boolean) => void
// Local properties
amalgamatingBusinessesValid = false
Expand All @@ -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<void> {
Expand Down Expand Up @@ -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)
}
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ export type AmalgamatingBusinessIF = AmalgamatingLearIF | AmalgamatingForeignIF
export interface AmalgamationStateIF {
amalgamatingBusinesses: Array<AmalgamatingBusinessIF>
courtApproval: boolean
amalgamatingBusinessesValid: boolean
type: AmalgamationTypes
}
1 change: 1 addition & 0 deletions src/store/state/state-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export const stateModel: StateModelIF = {
},
amalgamation: {
amalgamatingBusinesses: cloneDeep(AMALGAMATING_BUSINESSES),
amalgamatingBusinessesValid: false,
courtApproval: null,
type: null
},
Expand Down
8 changes: 8 additions & 0 deletions src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -1224,6 +1229,9 @@ export const useStore = defineStore('store', {
setAmalgamatingBusinesses (amalgamatingBusinesses: Array<AmalgamatingBusinessIF>) {
this.stateModel.amalgamation.amalgamatingBusinesses = amalgamatingBusinesses
},
setAmalgamatingBusinessesValid (valid: boolean) {
this.stateModel.amalgamation.amalgamatingBusinessesValid = valid
},
setAmalgamationType (type: AmalgamationTypes) {
this.stateModel.amalgamation.type = type
},
Expand Down

0 comments on commit ec7f5ca

Please sign in to comment.