Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Severin Beauvais committed Dec 21, 2023
1 parent 6228e99 commit e94d09d
Show file tree
Hide file tree
Showing 18 changed files with 278 additions and 146 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@bcrs-shared-components/confirm-dialog": "1.2.1",
"@bcrs-shared-components/contact-info": "1.2.15",
"@bcrs-shared-components/corp-type-module": "1.0.11",
"@bcrs-shared-components/correct-name": "1.0.33",
"@bcrs-shared-components/correct-name": "1.0.34",
"@bcrs-shared-components/court-order-poa": "3.0.11",
"@bcrs-shared-components/date-picker": "1.2.15",
"@bcrs-shared-components/document-delivery": "1.2.0",
Expand All @@ -35,7 +35,7 @@
"@bcrs-shared-components/interfaces": "1.1.5",
"@bcrs-shared-components/jurisdiction": "1.0.1",
"@bcrs-shared-components/limited-restoration-panel": "1.0.5",
"@bcrs-shared-components/mixins": "1.1.33",
"@bcrs-shared-components/mixins": "1.1.34",
"@bcrs-shared-components/nature-of-business": "1.2.14",
"@bcrs-shared-components/relationships-panel": "1.0.9",
"@bcrs-shared-components/staff-comments": "1.3.15",
Expand Down
6 changes: 6 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,12 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
this.nameRequestInvalidErrorDialog = true
})
//
// The NR checks below are sort-of a duplicate of code in BusinessName.vue and
// ResultingBusinessName.vue, but we assume the other checks passed if the user
// was able to add the NR to this filing, so these checks should be sufficient.
//
// ensure NR was found
if (!nrResponse) {
this.nameRequestInvalidType = NameRequestStates.NOT_FOUND
Expand Down
6 changes: 4 additions & 2 deletions src/components/Amalgamation/BusinessTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export default class BusinessTable extends Mixins(AmalgamationMixin) {
readonly AmlTypes = AmlTypes
readonly GetCorpFullDescription = GetCorpFullDescription
@Action(useStore) setDefineCompanyStepValidity!: (x: boolean) => void
@Action(useStore) spliceAmalgamatingBusiness!: (x: number) => void
/**
Expand Down Expand Up @@ -173,7 +172,10 @@ export default class BusinessTable extends Mixins(AmalgamationMixin) {
@Watch('businesses', { deep: true, immediate: true })
@Emit('valid')
private emitValidity (): boolean {
return this.businesses.every(business => business.status === AmlStatuses.OK)
return (
this.businesses.length > 0 &&
this.businesses.every(business => business.status === AmlStatuses.OK)
)
}
}
</script>
Expand Down
97 changes: 54 additions & 43 deletions src/components/Amalgamation/ResultingBusinessName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<!-- Editing Mode -->
<div
v-if="!isNewName"
v-if="!getCorrectNameOption"
class="section-container"
:class="{ 'invalid-section': invalidSection }"
>
Expand All @@ -27,16 +27,18 @@
>
<CorrectName
actionTxt="choose the resulting business name"
:amalgamatingBusinesses="getAmalgamatingBusinesses"
:businessId="getBusinessId"
:companyName="companyName"
:companyName="getNameRequestApprovedName || getBusinessLegalName"
:correctionNameChoices="correctionNameChoices"
:entityType="getEntityType"
:fetchAndValidateNr="fetchAndValidateNr"
:formType="formType"
:formType="getCorrectNameOption"
:nameRequest="getNameRequest"
@cancel="resetName()"
@saved="onSave($event)"
@update:companyName="onUpdateCompanyName($event)"
@update:formType="formType = $event"
@update:formType="onUpdateFormType($event)"
@update:nameRequest="onUpdateNameRequest($event)"
/>
</v-col>
Expand All @@ -46,7 +48,7 @@
<!-- Display Mode -->
<template v-else>
<NameRequestInfo />
<NameTranslations class="mt-n8" />
<NameTranslations />

<v-btn
text
Expand All @@ -64,11 +66,11 @@
</template>

<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import { Component, Mixins, Watch } from 'vue-property-decorator'
import { Getter, Action } from 'pinia-class'
import { useStore } from '@/store/store'
import { NameRequestMixin } from '@/mixins'
import { EmptyNameRequest, NameRequestIF } from '@/interfaces/'
import { AmalgamatingBusinessIF, EmptyNameRequest, NameRequestIF, NameTranslationIF } from '@/interfaces/'
import { LegalServices } from '@/services/'
import { CorrectNameOptions, NrRequestActionCodes } from '@bcrs-shared-components/enums/'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
Expand All @@ -84,6 +86,7 @@ import NameTranslations from '@/components/common/NameTranslations.vue'
}
})
export default class ResultingBusinessName extends Mixins(NameRequestMixin) {
@Getter(useStore) getAmalgamatingBusinesses!: AmalgamatingBusinessIF[]
@Getter(useStore) getBusinessId!: string
@Getter(useStore) getBusinessLegalName!: string
@Getter(useStore) getCorrectNameOption!: CorrectNameOptions
Expand All @@ -96,75 +99,83 @@ export default class ResultingBusinessName extends Mixins(NameRequestMixin) {
@Action(useStore) setCorrectNameOption!: (x: CorrectNameOptions) => void
@Action(useStore) setNameRequest!: (x: NameRequestIF) => void
@Action(useStore) setNameRequestApprovedName!: (x: string) => void
// Local properties
businessNameOption = null as string
// businessNameOption = this.getNameRequestNumber ? 'named' : 'numbered'
formType = null as CorrectNameOptions
@Action(useStore) setNameTranslations!: (x: NameTranslationIF[]) => void
readonly correctionNameChoices = [
CorrectNameOptions.CORRECT_AML_ADOPT,
CorrectNameOptions.CORRECT_NEW_NR,
CorrectNameOptions.CORRECT_AML_NUMBERED
]
/** The company name. */
get companyName (): string {
return (this.getNameRequestApprovedName || this.getBusinessLegalName)
}
// get companyName (): string {
// return (this.getNameRequestApprovedName || this.getBusinessLegalName)
// }
// get formType (): CorrectNameOptions {
// return this.getCorrectNameOption
// }
// get nameRequest (): NameRequestIF {
// return this.getNameRequest
// }
/** This section's validity state (when prompted by app). */
get invalidSection (): boolean {
return (this.getShowErrors && !this.getCorrectNameOption)
}
/** Called when component is created. */
created (): void {
// this.businessNameOption = this.getNameRequestNumber ? 'named' : 'numbered'
}
/**
* Fetches and validation a NR.
* @param nrNum the NR number
* @param businessId the business id
* @param businessId the business id (not used here but needed in method signature)
* @param phone the phone number to match
* @param email the email address to match
* @returns a promise to return the NR, or throws a printable error
*/
async fetchAndValidateNr (nrNum: string, businessId: string, phone: string, email: string): Promise<NameRequestIF> {
async fetchAndValidateNr (
nrNum: string, businessId: string, phone: string, email: string
): Promise<NameRequestIF> {
console.log('*** fetching and validating NR, params =', nrNum, businessId, phone, email)
const nameRequest = await LegalServices.fetchValidContactNr(nrNum, phone, email)
if (!nameRequest) throw new Error('Error fetching Name Request')
// validateNameRequest() already throws printable errors
return this.validateNameRequest(nameRequest, NrRequestActionCodes.AMALGAMATE)
}
/** On company name update, sets store accordingly. */
onUpdateCompanyName (name: string): void {
this.setCorrectNameOption(this.formType)
this.setNameRequestApprovedName(name)
/** Resets business name values (and name translations) when Cancel was clicked. */
resetName (): void {
// clear out existing data
this.setNameRequest(EmptyNameRequest)
this.setNameRequestApprovedName(null)
this.setCorrectNameOption(null)
this.setNameTranslations([])
}
/** On name request update, sets store accordingly. */
onUpdateNameRequest (nameRequest: NameRequestIF): void {
this.setNameRequest(nameRequest)
onSave (val: boolean): void {
console.log('*** on save =', val)
}
/** Whether a new business legal name was entered. */
get isNewName (): boolean {
// Approved Name is null when we start
// and is set when a name option is selected
return !!this.getNameRequestApprovedName
/** On company name update, sets store accordingly. */
onUpdateCompanyName (val: string): void {
console.log('*** updated company name =', val)
this.setNameRequestApprovedName(val)
}
/** Reset company name values to original. */
resetName (): void {
// clear out existing data
this.setNameRequest(EmptyNameRequest)
this.setNameRequestApprovedName(null)
this.setCorrectNameOption(null)
onUpdateFormType (val: CorrectNameOptions): void {
console.log('*** updated form type =', val)
this.setCorrectNameOption(val)
}
/** On name request update, sets store accordingly. */
onUpdateNameRequest (val: NameRequestIF): void {
console.log('*** updated name request =', val)
this.setNameRequest(val)
}
// reset flag
this.formType = null
@Watch('getCorrectNameOption')
private onCorrectNameOption (val: CorrectNameOptions): void {
console.log('*** on correct name option =', val)
}
}
</script>
Expand Down
1 change: 1 addition & 0 deletions src/components/Restoration/BusinessName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
sm="9"
class="pt-4 pt-sm-0"
>
<!-- *** TODO: fix synced props here (after I get it working in ResultingBusinessName.vue) -->
<CorrectName
actionTxt="restore the business"
:businessId="getBusinessId"
Expand Down
1 change: 1 addition & 0 deletions src/components/common/AddNameTranslation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<v-text-field
id="name-translation-input"
v-model="nameTranslation"
autofocus
filled
persistent-hint
label="Enter Name Translation"
Expand Down
Loading

0 comments on commit e94d09d

Please sign in to comment.