Skip to content

Commit

Permalink
19750 Fixed error handling (bcgov#657)
Browse files Browse the repository at this point in the history
* - app version = 5.9.2
- fixed error handling bug (missing await)
- removed unneeded code in buildAmalgamationFiling()
- updated some comments

* - refactored ListPeopleAndRoles to retain original index for actions

---------

Co-authored-by: Severin Beauvais <severin.beauvais@gov.bc.ca>
  • Loading branch information
2 people authored and JazzarKarim committed Feb 23, 2024
1 parent 1b5b76c commit 8fcab9d
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 159 deletions.
2 changes: 1 addition & 1 deletion src/components/Amalgamation/AmalgamatingBusinesses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co
// fetch the new holding/primary business' data and update the prepopulated data
// this will overwrite office addresses, directors, share structure and contact info
this.updatePrepopulatedData(business, true)
await this.updatePrepopulatedData(business, true)
} catch (error) {
// eslint-disable-next-line no-console
console.log('Error setting new holding/primary business =', error)
Expand Down
277 changes: 134 additions & 143 deletions src/components/common/ListPeopleAndRoles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,146 +88,148 @@
</v-row>

<!-- List Content -->
<v-row
v-for="(orgPerson, index1) in filteredPersonList"
:key="index1"
class="people-roles-content"
no-gutters
>
<v-col class="name-column d-flex text-break">
<div class="pr-2">
<v-icon
v-if="isPerson(orgPerson)"
color="gray9"
>
mdi-account
</v-icon>
<v-icon
v-if="isOrg(orgPerson)"
color="gray9"
>
mdi-domain
</v-icon>
</div>
<div>
<span
class="name"
:class="{'text-uppercase':isOrg(orgPerson)}"
>{{ formatName(orgPerson) }}</span>

<template v-if="isRegistrationFiling">
<div v-if="officerEmail(orgPerson)">
<p class="email">
{{ officerEmail(orgPerson) }}
</p>
</div>

<div
v-if="officerBusinessNumber(orgPerson)"
class="mt-2 business-number"
<template v-for="(orgPerson, index1) in personList">
<v-row
v-if="!isDirector(orgPerson) || showDirectors"
:key="index1"
class="people-roles-content"
no-gutters
>
<v-col class="name-column d-flex text-break">
<div class="pr-2">
<v-icon
v-if="isPerson(orgPerson)"
color="gray9"
>
mdi-account
</v-icon>
<v-icon
v-if="isOrg(orgPerson)"
color="gray9"
>
<p>Business Number:</p>
<p>{{ officerBusinessNumber(orgPerson) }}</p>
</div>
mdi-domain
</v-icon>
</div>
<div>
<span
class="name"
:class="{'text-uppercase':isOrg(orgPerson)}"
>{{ formatName(orgPerson) }}</span>

<template v-if="isRegistrationFiling">
<div v-if="officerEmail(orgPerson)">
<p class="email">
{{ officerEmail(orgPerson) }}
</p>
</div>

<div
v-if="officerBusinessNumber(orgPerson)"
class="mt-2 business-number"
>
<p>Business Number:</p>
<p>{{ officerBusinessNumber(orgPerson) }}</p>
</div>
</template>
</div>
</v-col>

<v-col class="mailing-address-column">
<MailingAddress :address="orgPerson.mailingAddress" />
</v-col>

<v-col
v-if="showDeliveryAddressColumn"
class="delivery-address-column"
>
<template v-if="isDirector(orgPerson) || isProprietor(orgPerson) || isPartner(orgPerson)">
<p v-if="isSame(orgPerson.mailingAddress, orgPerson.deliveryAddress)">
Same as Mailing Address
</p>
<DeliveryAddress
v-else
:address="orgPerson.deliveryAddress"
/>
</template>
</div>
</v-col>
</v-col>

<v-col class="mailing-address-column">
<MailingAddress :address="orgPerson.mailingAddress" />
</v-col>

<v-col
v-if="showDeliveryAddressColumn"
class="delivery-address-column"
>
<template v-if="isDirector(orgPerson) || isProprietor(orgPerson) || isPartner(orgPerson)">
<p v-if="isSame(orgPerson.mailingAddress, orgPerson.deliveryAddress)">
Same as Mailing Address
<v-col
v-if="showRolesColumn"
class="roles-column"
>
<p
v-for="(role, index2) in orgPerson.roles"
:key="index2"
>
{{ role.roleType }}
</p>
<DeliveryAddress
v-else
:address="orgPerson.deliveryAddress"
/>
</template>
</v-col>
</v-col>

<v-col
v-if="showRolesColumn"
class="roles-column"
>
<p
v-for="(role, index2) in orgPerson.roles"
:key="index2"
<v-col
v-if="showEmailColumn"
class="email-column"
>
{{ role.roleType }}
</p>
</v-col>
<p>{{ orgPerson.officer.email }}</p>
</v-col>

<v-col
v-if="showEmailColumn"
class="email-column"
>
<p>{{ orgPerson.officer.email }}</p>
</v-col>

<!-- conditional empty alignment column -->
<v-col v-if="showAlignmentColumn" />
<!-- conditional empty alignment column -->
<v-col v-if="showAlignmentColumn" />

<v-col
v-if="!isSummary"
class="actions-column"
:class="{'disabled':disabled}"
>
<div class="float-right">
<span class="edit-action">
<v-btn
:id="`officer-${index1}-change-btn`"
text
color="primary"
:tabindex="disabled ? -1 : 0"
@click="disabled ? null : emitPersonInfo(index1)"
>
<v-icon small>mdi-pencil</v-icon>
<span>Edit</span>
</v-btn>
</span>

<!-- More Actions menu -->
<span>
<v-menu
offset-y
left
:disabled="disabled"
>
<template #activator="{ on }">
<v-btn
text
small
color="primary"
class="more-actions-btn"
:tabindex="disabled ? -1 : 0"
v-on="on"
>
<v-icon>mdi-menu-down</v-icon>
</v-btn>
</template>
<v-list class="more-actions-list">
<v-list-item @click="emitRemovePerson(index1)">
<v-list-item-title>
<v-icon
small
color="primary"
>mdi-delete</v-icon>
<span class="ml-2">Remove</span>
</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</span>
</div>
</v-col>
</v-row>
<v-col
v-if="!isSummary"
class="actions-column"
:class="{'disabled':disabled}"
>
<div class="float-right">
<span class="edit-action">
<v-btn
:id="`officer-${index1}-change-btn`"
text
color="primary"
:tabindex="disabled ? -1 : 0"
@click="disabled ? null : emitPersonInfo(index1)"
>
<v-icon small>mdi-pencil</v-icon>
<span>Edit</span>
</v-btn>
</span>

<!-- More Actions menu -->
<span>
<v-menu
offset-y
left
:disabled="disabled"
>
<template #activator="{ on }">
<v-btn
text
small
color="primary"
class="more-actions-btn"
:tabindex="disabled ? -1 : 0"
v-on="on"
>
<v-icon>mdi-menu-down</v-icon>
</v-btn>
</template>
<v-list class="more-actions-list">
<v-list-item @click="emitRemovePerson(index1)">
<v-list-item-title>
<v-icon
small
color="primary"
>mdi-delete</v-icon>
<span class="ml-2">Remove</span>
</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</span>
</div>
</v-col>
</v-row>
</template>
</div>
</section>
</div>
Expand Down Expand Up @@ -277,17 +279,6 @@ export default class ListPeopleAndRoles extends Mixins(CommonMixin) {
// Local properties
protected activeIndex: number // is NaN for new org/person
/**
* PersonList is filtered by RoleType.
*/
get filteredPersonList (): Array<OrgPersonIF> {
if (!this.showDirectors) {
return this.personList.filter(person => !this.isDirector(person))
} else {
return this.personList
}
}
get tableHeaders (): Array<string> {
const headers = ['Name', 'Mailing Address']
if (this.showDeliveryAddressColumn) headers.push('Delivery Address')
Expand Down
22 changes: 7 additions & 15 deletions src/mixins/filing-template-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM
amalgamatingBusinesses: this.getAmalgamatingBusinesses,
type: this.getAmalgamationType,
nameRequest: {
legalType: this.getEntityType,
correctNameOption: this.getCorrectNameOption
legalType: this.getEntityType
},
nameTranslations: this.getNameTranslations,
offices: this.getDefineCompanyStep.officeAddresses,
Expand Down Expand Up @@ -258,7 +257,6 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM

// restore business name data
const nameRequest = draftFiling.amalgamationApplication.nameRequest as NameRequestFilingIF

switch (nameRequest?.correctNameOption) {
case CorrectNameOptions.CORRECT_AML_ADOPT:
this.setCorrectNameOption(CorrectNameOptions.CORRECT_AML_ADOPT)
Expand All @@ -267,16 +265,14 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM
break
case CorrectNameOptions.CORRECT_NEW_NR:
this.setCorrectNameOption(CorrectNameOptions.CORRECT_NEW_NR)
// NB: do not restore Name Request data
// it will be reloaded from NR endpoint in App.vue
// NB: do not restore Name Request data - it will be reloaded from NR endpoint in App.vue
break
case CorrectNameOptions.CORRECT_AML_NUMBERED:
this.setCorrectNameOption(CorrectNameOptions.CORRECT_AML_NUMBERED)
break
default:
// fallback for draft created without Correct Name Option
// NB: do not restore Name Request data
// it will be reloaded from NR endpoint in App.vue
// NB: do not restore Name Request data - it will be reloaded from NR endpoint in App.vue
if (nameRequest.nrNumber) {
this.setCorrectNameOption(CorrectNameOptions.CORRECT_NEW_NR)
}
Expand Down Expand Up @@ -440,16 +436,14 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM
break
case CorrectNameOptions.CORRECT_NEW_NR:
this.setCorrectNameOption(CorrectNameOptions.CORRECT_NEW_NR)
// NB: do not restore Name Request data
// it will be reloaded from NR endpoint in App.vue
// NB: do not restore Name Request data - it will be reloaded from NR endpoint in App.vue
break
case CorrectNameOptions.CORRECT_AML_NUMBERED:
this.setCorrectNameOption(CorrectNameOptions.CORRECT_AML_NUMBERED)
break
default:
// fallback for draft created without Correct Name Option
// NB: do not restore Name Request data
// it will be reloaded from NR endpoint in App.vue
// NB: do not restore Name Request data - it will be reloaded from NR endpoint in App.vue
if (nameRequest.nrNumber) {
this.setCorrectNameOption(CorrectNameOptions.CORRECT_NEW_NR)
}
Expand Down Expand Up @@ -931,8 +925,7 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM
// restore Business Type Confirm
this.setRegistrationBusinessTypeConfirm(draftFiling.registration.businessTypeConfirm || false)

// NB: do not restore Name Request data
// it will be reloaded from NR endpoint in App.vue
// NB: do not restore Name Request data - it will be reloaded from NR endpoint in App.vue

// restore Entity Type
this.setEntityType(draftFiling.registration.nameRequest.legalType)
Expand Down Expand Up @@ -1018,8 +1011,7 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM
break
case CorrectNameOptions.CORRECT_NEW_NR:
this.setCorrectNameOption(CorrectNameOptions.CORRECT_NEW_NR)
// NB: do not restore Name Request data
// it will be reloaded from NR endpoint in App.vue
// NB: do not restore Name Request data - it will be reloaded from NR endpoint in App.vue
break
}

Expand Down

0 comments on commit 8fcab9d

Please sign in to comment.