Skip to content

Commit

Permalink
- display person email/IN/BN in reg only (#368)
Browse files Browse the repository at this point in the history
- enabled component rules only after user clicks Done
- updated P&R list icon colors
- updated unit tests
- app version = 3.5.9
  • Loading branch information
severinbeauvais authored Apr 1, 2022
1 parent 7e62f3c commit 9458d5d
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 40 deletions.
2 changes: 1 addition & 1 deletion 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-create-ui",
"version": "3.5.8",
"version": "3.5.9",
"private": true,
"appName": "Create UI",
"sbcName": "SBC Common Components",
Expand Down
30 changes: 18 additions & 12 deletions src/components/Registration/RegAddEditOrgPerson.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
label="First Name"
id="person__first-name"
v-model.trim="orgPerson.officer.firstName"
:rules="Rules.FirstNameRules"
:rules="enableRules ? Rules.FirstNameRules : []"
:readonly="isCompletingParty && !isRoleStaff"
/>
<v-text-field
Expand All @@ -73,7 +73,7 @@
label="Middle Name"
id="person__middle-name"
v-model.trim="orgPerson.officer.middleName"
:rules="Rules.MiddleNameRules"
:rules="enableRules ? Rules.MiddleNameRules : []"
:readonly="isCompletingParty && !isRoleStaff"
/>
<v-text-field
Expand All @@ -82,7 +82,7 @@
label="Last Name"
id="person__last-name"
v-model.trim="orgPerson.officer.lastName"
:rules="Rules.LastNameRules"
:rules="enableRules ? Rules.LastNameRules : []"
:readonly="isCompletingParty && !isRoleStaff"
/>
</div>
Expand All @@ -108,7 +108,7 @@
class="confirm-checkbox mt-8"
hide-details
v-model="orgPerson.confirmBusiness"
:rules="[(v) => !!v]"
:rules="enableRules ? [(v) => !!v] : []"
>
<template slot="label">
I confirm that the business proprietor being added is not legally required to
Expand All @@ -123,7 +123,7 @@
label="Business or Corporation Name"
id="firm-name"
v-model.trim="orgPerson.officer.organizationName"
:rules="OrgNameRules"
:rules="enableRules ? OrgNameRules : []"
/>

<!-- Business Number -->
Expand All @@ -135,7 +135,7 @@
id="person__business-number"
hint="First 9 digits of the CRA Business Number"
v-model.trim="orgPerson.officer.businessNumber"
:rules="BusinessNumberRules"
:rules="enableRules ? BusinessNumberRules : []"
/>

<v-divider class="mt-8" />
Expand Down Expand Up @@ -199,7 +199,7 @@
id="person__business-number"
hint="First 9 digits of the CRA Business Number"
v-model.trim="orgPerson.officer.businessNumber"
:rules="BusinessNumberRules"
:rules="enableRules ? BusinessNumberRules : []"
/>
</article>

Expand All @@ -215,7 +215,7 @@
label="Email Address"
id="person__email-address"
v-model.trim="orgPerson.officer.email"
:rules="Rules.EmailRules"
:rules="enableRules ? Rules.EmailRules : []"
:readonly="isCompletingParty && !isRoleStaff"
/>
</article>
Expand All @@ -227,13 +227,16 @@
ref="mailingAddressNew"
class="mt-4 mb-n6"
:editing="true"
:schema="PersonAddressSchema"
:schema="enableRules ? PersonAddressSchema : {}"
:address="inProgressMailingAddress"
@update:address="updateMailingAddress($event)"
@valid="updateMailingAddressValidity($event)"
/>
<!-- dummy component to make form invalid if mailing address is invalid -->
<v-input class="d-none" :rules="[() => mailingAddressValid]" />
<v-input
class="d-none"
:rules="enableRules ? [() => mailingAddressValid] : []"
/>
</article>

<!-- Delivery Address (for all roles) -->
Expand All @@ -251,14 +254,17 @@
ref="deliveryAddressNew"
class="mt-4 mb-n6"
:editing="true"
:schema="PersonAddressSchema"
:schema="enableRules ? PersonAddressSchema : {}"
:address="inProgressDeliveryAddress"
:noPoBox="true"
@update:address="updateDeliveryAddress($event)"
@valid="updateDeliveryAddressValidity($event)"
/>
<!-- dummy component to make form invalid if delivery address is invalid -->
<v-input class="d-none" :rules="[() => inheritMailingAddress || deliveryAddressValid]" />
<v-input
class="d-none"
:rules="enableRules ? [() => inheritMailingAddress || deliveryAddressValid] : []"
/>
</article>
</div>

Expand Down
1 change: 1 addition & 0 deletions src/components/Registration/RegPeopleAndRoles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
<!-- Add/Edit Bus/Corp -->
<v-expand-transition>
<v-card flat v-if="showOrgPersonForm" class="mt-8">
<!-- FUTURE: move this component into a slot in ListPeopleAndRoles ??? -->
<RegAddEditOrgPerson
:initialValue="currentOrgPerson"
:activeIndex="activeIndex"
Expand Down
26 changes: 16 additions & 10 deletions src/components/common/AddEditOrgPerson.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
label="First Name"
id="person__first-name"
v-model.trim="orgPerson.officer.firstName"
:rules="Rules.FirstNameRules"
:rules="enableRules ? Rules.FirstNameRules : []"
:readonly="isCompletingParty && !isRoleStaff && isTypeCoop"
/>
<v-text-field
Expand All @@ -83,7 +83,7 @@
label="Middle Name"
id="person__middle-name"
v-model.trim="orgPerson.officer.middleName"
:rules="Rules.MiddleNameRules"
:rules="enableRules ? Rules.MiddleNameRules: []"
:readonly="isCompletingParty && !isRoleStaff && isTypeCoop"
/>
<v-text-field
Expand All @@ -92,7 +92,7 @@
label="Last Name"
id="person__last-name"
v-model.trim="orgPerson.officer.lastName"
:rules="Rules.LastNameRules"
:rules="enableRules ? Rules.LastNameRules : []"
:readonly="isCompletingParty && !isRoleStaff && isTypeCoop"
/>
</div>
Expand All @@ -108,7 +108,7 @@
label="Full Legal Corporation or Firm Name"
id="firm-name"
v-model.trim="orgPerson.officer.organizationName"
:rules="Rules.OrgNameRules"
:rules="enableRules ? Rules.OrgNameRules : []"
/>
</div>
</article>
Expand Down Expand Up @@ -138,7 +138,7 @@
:value="RoleTypes.INCORPORATOR"
:label="RoleTypes.INCORPORATOR"
:disabled="disableIncorporatorRole"
:rules="roleRules"
:rules="enableRules ? roleRules: []"
/>
</v-col>

Expand All @@ -150,7 +150,7 @@
:value="RoleTypes.DIRECTOR"
:label="RoleTypes.DIRECTOR"
:disabled="disableDirectorRole"
:rules="roleRules"
:rules="enableRules ? roleRules : []"
@click="updateSameAsMailingChkBox()"
/>
</v-col>
Expand All @@ -165,13 +165,16 @@
ref="mailingAddressNew"
class="mt-6"
:editing="true"
:schema="PersonAddressSchema"
:schema="enableRules ? PersonAddressSchema : {}"
:address="inProgressMailingAddress"
@update:address="updateMailingAddress($event)"
@valid="updateMailingAddressValidity($event)"
/>
<!-- dummy component to make form invalid if mailing address is invalid -->
<v-input class="d-none" :rules="[() => mailingAddressValid]" />
<v-input
class="d-none"
:rules="enableRules ? [() => mailingAddressValid] : []"
/>
</article>

<!-- Delivery Address (for directors only) -->
Expand All @@ -189,14 +192,17 @@
ref="deliveryAddressNew"
class="mt-6"
:editing="true"
:schema="PersonAddressSchema"
:schema="enableRules ? PersonAddressSchema : {}"
:address="inProgressDeliveryAddress"
:noPoBox="true"
@update:address="updateDeliveryAddress($event)"
@valid="updateDeliveryAddressValidity($event)"
/>
<!-- dummy component to make form invalid if delivery address is invalid -->
<v-input class="d-none" :rules="[() => inheritMailingAddress || deliveryAddressValid]" />
<v-input
class="d-none"
:rules="enableRules ? [() => inheritMailingAddress || deliveryAddressValid] : []"
/>
</article>
</div>

Expand Down
32 changes: 17 additions & 15 deletions src/components/common/ListPeopleAndRoles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,28 @@
>
<v-col class="name-column d-flex text-break">
<div class="pr-2">
<v-icon color="primary" v-if="isPerson(orgPerson)">mdi-account</v-icon>
<v-icon color="primary" v-if="isOrg(orgPerson)">mdi-domain</v-icon>
<v-icon color="gray9" v-if="isPerson(orgPerson)">mdi-account</v-icon>
<v-icon color="gray9" v-if="isOrg(orgPerson)">mdi-domain</v-icon>
</div>
<div>
<span class="name" :class="{'text-uppercase':isOrg(orgPerson)}"
>{{ formatName(orgPerson) }}</span>

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

<div v-if="officerIncorpNumber(orgPerson)" class="mt-2">
<p>Incorporation Number:</p>
<p>{{ officerIncorpNumber(orgPerson) }}</p>
</div>

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

<div v-if="officerIncorpNumber(orgPerson)" class="mt-2">
<p>Incorporation Number:</p>
<p>{{ officerIncorpNumber(orgPerson) }}</p>
</div>

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

Expand Down
1 change: 1 addition & 0 deletions src/components/common/PeopleAndRoles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<!-- Add/Edit Person/Org -->
<v-expand-transition>
<v-card flat v-if="showOrgPersonForm" class="mt-8">
<!-- FUTURE: move this component into a slot in ListPeopleAndRoles ??? -->
<AddEditOrgPerson
:initialValue="currentOrgPerson"
:activeIndex="activeIndex"
Expand Down
7 changes: 6 additions & 1 deletion src/mixins/add-edit-org-person-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default class AddEditOrgPersonMixin extends Vue {
// Local properties
private orgPerson: OrgPersonIF = null
private addPersonOrgFormValid = true
private enableRules = false

// Address related properties
private inProgressMailingAddress: AddressIF
Expand Down Expand Up @@ -282,7 +283,11 @@ export default class AddEditOrgPersonMixin extends Vue {
}
}

protected validateAddPersonOrgForm (): void {
protected async validateAddPersonOrgForm (): Promise<void> {
// enable component rules and wait to let them update
this.enableRules = true
await Vue.nextTick()

// first validate the address form(s)
this.$refs.mailingAddressNew.$refs.addressForm.validate()
if (this.$refs.deliveryAddressNew) {
Expand Down
1 change: 1 addition & 0 deletions tests/unit/AddEditOrgPerson.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ function createComponent (
document.body.setAttribute('data-app', 'true')
return mount(AddEditOrgPerson, {
localVue,
data() { return { enableRules: true }},
propsData: {
initialValue,
activeIndex,
Expand Down
1 change: 1 addition & 0 deletions tests/unit/RegAddEditOrgPerson.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ function createComponent (
document.body.setAttribute('data-app', 'true')
return mount(AddEditOrgPerson, {
localVue,
data() { return { enableRules: true }},
propsData: {
initialValue,
activeIndex,
Expand Down

0 comments on commit 9458d5d

Please sign in to comment.