Skip to content

Commit

Permalink
- changed snapshot references to existing store getters
Browse files Browse the repository at this point in the history
- removed some visibilty modifiers to fix template warnings
- fixed some typings
- sorted misc getters/actions
- added store getters for some objects and used them instead of objects properties
  • Loading branch information
severinbeauvais committed Oct 11, 2023
1 parent 707b397 commit 33cdb7a
Show file tree
Hide file tree
Showing 20 changed files with 433 additions and 351 deletions.
8 changes: 2 additions & 6 deletions src/components/Alteration/summary/BusinessType.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<v-col cols="8">
<span class="info-text">
Changing from a {{ GetCorpFullDescription(originalLegalType) }} to a
Changing from a {{ GetCorpFullDescription(getOriginalLegalType) }} to a
{{ GetCorpFullDescription(getEntityType) }}
</span>

Expand Down Expand Up @@ -38,17 +38,13 @@
<script lang="ts">
import { FilingTemplateMixin } from '@/mixins'
import { Component, Mixins } from 'vue-property-decorator'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { ResourceUtilities } from '@/utils/resource-utils'
@Component({})
export default class BusinessType extends Mixins(FilingTemplateMixin) {
readonly GetCorpFullDescription = GetCorpFullDescription // for template
get originalLegalType (): CorpTypeCd {
return this.getEntitySnapshot?.businessInfo?.legalType
}
get articleInfo (): string {
return ResourceUtilities.articleInfo(this.getEntityType)
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/SpecialResolution/Memorandum.vue
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
<script lang="ts">
import Vue from 'vue'
import { HelpSection } from '@/components/common/'
import { EntitySnapshotIF, RulesMemorandumIF } from '@/interfaces'
import { RulesMemorandumIF } from '@/interfaces'
import DateUtilities from '@/services/date-utilities'
import { FormIF } from '@bcrs-shared-components/interfaces'
import { Component, Watch } from 'vue-property-decorator'
Expand All @@ -272,7 +272,6 @@ export default class Memorandum extends Vue {
@Getter(useStore) getComponentValidate!: boolean
@Getter(useStore) getEditedLabel!: string
@Getter(useStore) getEditLabel!: string
@Getter(useStore) getEntitySnapshot!: EntitySnapshotIF
@Getter(useStore) getSpecialResolutionMemorandum!: RulesMemorandumIF
@Getter(useStore) hasSpecialResolutionMemorandumChanged!: boolean
Expand Down
8 changes: 4 additions & 4 deletions src/components/SpecialResolution/ResolutionSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
<script lang="ts">
import { Component, Mixins, Watch } from 'vue-property-decorator'
import { Action, Getter } from 'pinia-class'
import { FormIF, EntitySnapshotIF } from '@/interfaces/'
import { FormIF } from '@/interfaces/'
import { CommonMixin, DateMixin } from '@/mixins/'
import { HelpSection } from '@/components/common/'
import { DatePicker as DatePickerShared } from '@bcrs-shared-components/date-picker/'
Expand All @@ -163,10 +163,10 @@ import { useStore } from '@/store/store'
}
})
export default class ResolutionSummary extends Mixins(CommonMixin, DateMixin) {
@Getter(useStore) getSpecialResolution!: SpecialResolutionIF
@Getter(useStore) getAppValidate!: boolean
@Getter(useStore) getOriginalLegalName!: string
@Getter(useStore) getSpecialResolution!: SpecialResolutionIF
@Getter(useStore) getSpecialResolutionConfirmValid!: boolean
@Getter(useStore) getEntitySnapshot!: EntitySnapshotIF
@Action(useStore) setSpecialResolution!: (x: SpecialResolutionIF) => void
@Action(useStore) setSpecialResolutionConfirmStateValidity!: (x: boolean) => void
Expand Down Expand Up @@ -226,7 +226,7 @@ export default class ResolutionSummary extends Mixins(CommonMixin, DateMixin) {
/** The company name. */
get companyName (): string {
// old company name need show even they change it
return this.getEntitySnapshot?.businessInfo?.legalName || ''
return this.getOriginalLegalName || ''
}
/** Set validate on file and pay click. */
Expand Down
16 changes: 8 additions & 8 deletions src/components/SpecialResolution/Rules.vue
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
<script lang="ts">
import Vue from 'vue'
import { HelpSection } from '@/components/common/'
import { EntitySnapshotIF, RulesMemorandumIF } from '@/interfaces'
import { BusinessDocumentsIF, RulesMemorandumIF } from '@/interfaces'
import DateUtilities from '@/services/date-utilities'
import { FormIF } from '@bcrs-shared-components/interfaces'
import { Component, Watch } from 'vue-property-decorator'
Expand All @@ -350,14 +350,14 @@ import { LegalServices } from '@/services'
})
export default class Rules extends Vue {
@Getter(useStore) getComponentValidate!: boolean
@Getter(useStore) getSpecialResolutionRules!: RulesMemorandumIF
@Getter(useStore) getEntitySnapshot!: EntitySnapshotIF
@Getter(useStore) getEditLabel!: string
@Getter(useStore) getEditedLabel!: string
@Getter(useStore) getNameRequestLegalName!: string
@Getter(useStore) getOriginalBusinessDocuments!: BusinessDocumentsIF
@Getter(useStore) getUserFirstName!: string
@Getter(useStore) getUserLastName!: string
@Getter(useStore) getEditedLabel!: string
@Getter(useStore) getEditLabel!: string
@Getter(useStore) getSpecialResolutionRules!: RulesMemorandumIF
@Getter(useStore) getSpecialResolutionRulesValid!: boolean
@Getter(useStore) getNameRequestLegalName!: string
@Getter(useStore) hasSpecialResolutionRulesChanged!: boolean
@Action(useStore) setEditingRules!: (x: boolean) => void
Expand Down Expand Up @@ -423,8 +423,8 @@ export default class Rules extends Vue {
/** Initial rules for the business, this is loaded in when undo or cancel is pressed. */
initialRules (): RulesMemorandumIF {
const documentsInfo = this.getEntitySnapshot?.businessDocuments?.documentsInfo
const documents = this.getEntitySnapshot?.businessDocuments?.documents
const documentsInfo = this.getOriginalBusinessDocuments?.documentsInfo
const documents = this.getOriginalBusinessDocuments?.documents
return {
includedInResolution: false,
key: documentsInfo?.certifiedRules?.key || null,
Expand Down
4 changes: 2 additions & 2 deletions src/components/SpecialResolution/SpecialResolutionSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ export default class SpecialResolutionSummary extends Mixins(DateMixin, FeeMixin
/** The legal type before changes. */
get originalLegalType (): string {
return this.getEntitySnapshot?.businessInfo?.legalType
return this.getOriginalLegalType
}
/** The association type before changes. */
get originalAssociationType (): string {
return this.getEntitySnapshot?.businessInfo?.associationType
return this.getOriginalBusinessInfo?.associationType
}
/** Calculates the sum of special resolution fees. */
Expand Down
13 changes: 7 additions & 6 deletions src/components/common/EntityInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,26 @@
import { Component, Mixins } from 'vue-property-decorator'
import { Getter } from 'pinia-class'
import { CommonMixin } from '@/mixins/'
import { BusinessInformationIF, EntitySnapshotIF } from '@/interfaces/'
import { BusinessInformationIF } from '@/interfaces/'
import { ContactPointIF } from '@bcrs-shared-components/interfaces/'
import { GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { useStore } from '@/store/store'
@Component({})
export default class EntityInfo extends Mixins(CommonMixin) {
// Global getters
@Getter(useStore) getBusinessContact!: ContactPointIF
@Getter(useStore) getBusinessId!: string
@Getter(useStore) getBusinessInformation!: BusinessInformationIF
@Getter(useStore) getOriginalBusinessInfo!: BusinessInformationIF
@Getter(useStore) getOriginalLegalName!: string
@Getter(useStore) getBusinessContact!: ContactPointIF
@Getter(useStore) getEntitySnapshot!: EntitySnapshotIF
@Getter(useStore) getOriginalLegalType!: CorpTypeCd
/** The original entity type. */
get originalEntityType (): string {
if (this.getEntitySnapshot?.businessInfo) {
return GetCorpFullDescription(this.getEntitySnapshot.businessInfo.legalType)
if (this.getOriginalBusinessInfo) {
return GetCorpFullDescription(this.getOriginalLegalType)
} else {
return 'Unknown'
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/common/PeopleAndRoles/PeopleAndRoles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ import { Component, Mixins, Watch } from 'vue-property-decorator'
import { Action, Getter } from 'pinia-class'
import { cloneDeep, isEmpty } from 'lodash'
import { IsSame } from '@/utils/'
import { ActionKvIF, EmptyOrgPerson, EntitySnapshotIF, HelpSectionIF, OrgPersonIF, ResourceIF,
RoleIF } from '@/interfaces/'
import { ActionKvIF, EmptyOrgPerson, HelpSectionIF, OrgPersonIF, ResourceIF, RoleIF }
from '@/interfaces/'
import { ActionTypes, CompareModes, PartyTypes, RoleTypes } from '@/enums/'
import { HelpSection } from '@/components/common/'
import { ListPeopleAndRoles } from './'
Expand All @@ -312,8 +312,8 @@ export default class PeopleAndRoles extends Mixins(CommonMixin, DateMixin, OrgPe
// Global getters
@Getter(useStore) getCurrentJsDate!: Date
@Getter(useStore) getEntitySnapshot!: EntitySnapshotIF
@Getter(useStore) getOrgPeople!: OrgPersonIF[]
@Getter(useStore) getOriginalOrgPersons!: OrgPersonIF[]
@Getter(useStore) getResource!: ResourceIF
@Getter(useStore) getComponentValidate!: boolean
@Getter(useStore) isAlterationFiling!: boolean
Expand Down Expand Up @@ -347,7 +347,7 @@ export default class PeopleAndRoles extends Mixins(CommonMixin, DateMixin, OrgPe
/** The list of original parties. */
get originalParties (): OrgPersonIF[] {
return this.getEntitySnapshot?.orgPersons || []
return this.getOriginalOrgPersons || []
}
/** True when the required proprietor count is met. */
Expand Down
20 changes: 5 additions & 15 deletions src/components/common/ShareStructure/ShareStructures.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ShareStructureShared
:isEditMode="isEditMode"
:shareClasses="getShareClasses"
:originalShareStructure="originalShareStructure"
:originalShareStructure="getOriginalShareStructure"
:resolutionRequired="resolutionsRequired"
:editLabel="getEditLabel"
:editedLabel="getEditedLabel"
Expand All @@ -25,18 +25,12 @@
</template>

<script lang="ts">
// Libraries
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
import { Action, Getter } from 'pinia-class'
// Components
import { ShareStructure as ShareStructureShared } from '@bcrs-shared-components/share-structure/'
import { ResolutionDateDialog } from '@/dialogs/'
import { CommonMixin } from '@/mixins/'
import { ActionKvIF, EntitySnapshotIF, ShareClassIF, ShareStructureIF, FlagsCompanyInfoIF }
from '@/interfaces/'
import { ActionKvIF, ShareClassIF, ShareStructureIF, FlagsCompanyInfoIF } from '@/interfaces/'
import { useStore } from '@/store/store'
@Component({
Expand All @@ -53,10 +47,10 @@ export default class ShareStructures extends Mixins(CommonMixin) {
@Getter(useStore) getComponentValidate!: boolean
@Getter(useStore) getEditLabel!: string
@Getter(useStore) getEditedLabel!: string
@Getter(useStore) getEntitySnapshot!: EntitySnapshotIF
@Getter(useStore) getFlagsCompanyInfo!: FlagsCompanyInfoIF
@Getter(useStore) getNewResolutionDates!: string[]
@Getter(useStore) getHasRightsOrRestrictions!: boolean
@Getter(useStore) getOriginalShareStructure!: ShareStructureIF
@Getter(useStore) getShareClasses!: ShareClassIF[]
@Getter(useStore) hasMinimumShareClass!: boolean
@Getter(useStore) isAlterationFiling!: boolean
Expand All @@ -69,18 +63,14 @@ export default class ShareStructures extends Mixins(CommonMixin) {
@Action(useStore) setValidComponent!: (x: ActionKvIF) => void
// Local propertiues
protected isEditing = false
protected showResolutionDateDialog = false
isEditing = false
showResolutionDateDialog = false
/** Whether share section is invalid, only when prompted by app. */
get invalidShareSection (): boolean {
return (this.getComponentValidate && !this.getFlagsCompanyInfo.isValidShareStructure)
}
get originalShareStructure (): ShareStructureIF {
return this.getEntitySnapshot?.shareStructure
}
/** True if changes to share structure rights will require a resolution date. */
get resolutionsRequired (): boolean {
return (this.getNewResolutionDates.length === 0) && this.isAlterationFiling
Expand Down
6 changes: 3 additions & 3 deletions src/components/common/YourCompany/AssociationType.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ import { Component, Mixins, Watch } from 'vue-property-decorator'
import { Action, Getter } from 'pinia-class'
import { CoopTypes } from '@/enums'
import { CommonMixin } from '@/mixins'
import { ActionKvIF, BusinessInformationIF, EntitySnapshotIF } from '@/interfaces'
import { ActionKvIF, BusinessInformationIF } from '@/interfaces'
import { VuetifyRuleFunction } from '@/types'
import { CoopTypeToDescription } from '@/utils'
import { useStore } from '@/store/store'
Expand All @@ -180,7 +180,7 @@ export default class AssociationType extends Mixins(CommonMixin) {
@Getter(useStore) getComponentValidate!: boolean
@Getter(useStore) getEditLabel!: string
@Getter(useStore) getEditedLabel!: string
@Getter(useStore) getEntitySnapshot!: EntitySnapshotIF
@Getter(useStore) getOriginalBusinessInfo!: BusinessInformationIF
@Getter(useStore) hasAssociationTypeChanged!: boolean
/** Global actions */
Expand Down Expand Up @@ -235,7 +235,7 @@ export default class AssociationType extends Mixins(CommonMixin) {
/** Reset association type value to original */
resetAssociationType () {
this.setBusinessInformation(this.getEntitySnapshot.businessInfo)
this.setBusinessInformation(this.getOriginalBusinessInfo)
this.isEditingAssociationType = false
}
Expand Down
12 changes: 6 additions & 6 deletions src/components/common/YourCompany/BusinessContactInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Action, Getter } from 'pinia-class'
import { ContactInfo as ContactInfoShared } from '@bcrs-shared-components/contact-info/'
import { AuthServices } from '@/services/'
import { CommonMixin } from '@/mixins/'
import { ActionKvIF, ResourceIF, EntitySnapshotIF, FlagsCompanyInfoIF } from '@/interfaces/'
import { ActionKvIF, AuthInformationIF, ResourceIF, FlagsCompanyInfoIF } from '@/interfaces/'
import { ContactPointIF } from '@bcrs-shared-components/interfaces/'
import { isEqual } from 'lodash'
import { useStore } from '@/store/store'
Expand All @@ -43,7 +43,7 @@ export default class BusinessContactInfo extends Mixins(CommonMixin) {
@Getter(useStore) getComponentValidate!: boolean
@Getter(useStore) getEditLabel!: string
@Getter(useStore) getEditSavedLabel!: string
@Getter(useStore) getEntitySnapshot!: EntitySnapshotIF
@Getter(useStore) getOriginalAuthInfo!: AuthInformationIF
@Getter(useStore) getFlagsCompanyInfo!: FlagsCompanyInfoIF
@Getter(useStore) getResource!: ResourceIF
@Getter(useStore) isAlterationFiling!: boolean
Expand All @@ -54,7 +54,7 @@ export default class BusinessContactInfo extends Mixins(CommonMixin) {
@Action(useStore) setValidComponent!: (x: ActionKvIF) => void
// Local variable
protected isEditingContact = false
isEditingContact = false
/** The section validity state (when prompted by app). */
get invalidSection (): boolean {
Expand All @@ -66,7 +66,7 @@ export default class BusinessContactInfo extends Mixins(CommonMixin) {
/** The original Contact data. */
get originalContact (): ContactPointIF {
return this.getEntitySnapshot?.authInfo?.contact
return this.getOriginalAuthInfo?.contact || null
}
/** True if there are changes between current Contact and original Contact Info. */
Expand All @@ -77,7 +77,7 @@ export default class BusinessContactInfo extends Mixins(CommonMixin) {
}
/** On Contact Info Change event, updates auth db and store. */
protected async onContactInfoChange (contactInfo: ContactPointIF): Promise<void> {
async onContactInfoChange (contactInfo: ContactPointIF): Promise<void> {
// do nothing if contact info was not changed
if (isEqual(contactInfo, this.getBusinessContact)) return
Expand All @@ -90,7 +90,7 @@ export default class BusinessContactInfo extends Mixins(CommonMixin) {
// reset business contact to previous value
const prev = this.getBusinessContact
// toggle for reactivity
this.setBusinessContact({})
this.setBusinessContact({} as ContactPointIF)
this.$nextTick(() => this.setBusinessContact(prev))
}
}
Expand Down
Loading

0 comments on commit 33cdb7a

Please sign in to comment.