Skip to content

Commit

Permalink
change formatted to a getter
Browse files Browse the repository at this point in the history
Signed-off-by: Qin <[email protected]>
  • Loading branch information
ArwenQin committed Oct 30, 2024
1 parent 34e3e85 commit d6b2495
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
17 changes: 11 additions & 6 deletions src/components/ContinuationIn/ExtraproRegistration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
:persistentHint="true"
:initialValue="business.prevIncorporationDate"
:inputRules="getShowErrors ? incorporationDateRules: []"
:maxDate="business.bcRegistrationDateFormatted || getCurrentDate"
:maxDate="bcRegistrationDateFormatted || getCurrentDate"
@emitDateSync="$set(business, 'prevIncorporationDate', $event)"
/>
</v-col>
Expand Down Expand Up @@ -203,7 +203,7 @@
</div>
<div class="date-registration-bc font-15 mt-2">
<label>Date of Registration in B.C.:</label>
{{ yyyyMmDdToPacificDate(business.bcRegistrationDateFormatted, true, false) || '[Unknown]' }}
{{ yyyyMmDdToPacificDate(bcRegistrationDateFormatted, true, false) || '[Unknown]' }}
</div>
</v-col>
</v-row>
Expand Down Expand Up @@ -352,10 +352,10 @@ export default class ExtraproRegistration extends Mixins(DateMixin) {
get incorporationDateRules (): Array<VuetifyRuleFunction> {
return [
(v) => !!v || 'Date of Incorporation is required',
() => (this.business.bcRegistrationDateFormatted && this.business.prevIncorporationDate <= this.getCurrentDate) ||
() => (this.bcRegistrationDateFormatted && this.business.prevIncorporationDate <= this.getCurrentDate) ||
'Date of Incorporation cannot be in the future',
() => !this.business.bcRegistrationDateFormatted ||
(this.business.prevIncorporationDate <= this.business.bcRegistrationDateFormatted) ||
() => !this.bcRegistrationDateFormatted ||
(this.business.prevIncorporationDate <= this.bcRegistrationDateFormatted) ||
'Date of Incorporation in previous jurisdiction must be before Date of Registration in B.C.'
]
}
Expand All @@ -381,6 +381,12 @@ export default class ExtraproRegistration extends Mixins(DateMixin) {
return IntlJurisdictions.find(intl => intl.value === jurisdiction?.country)?.text || null
}
get bcRegistrationDateFormatted (): string | null {
return this.business.bcRegistrationDate
? this.dateToYyyyMmDd(this.apiToDate(this.business.bcRegistrationDate))
: null
}
/** Called when this component is mounted. */
mounted (): void {
// point business variable to Existing Business Info object from the store, if it exists
Expand Down Expand Up @@ -410,7 +416,6 @@ export default class ExtraproRegistration extends Mixins(DateMixin) {
this.business = {
bcRegistrationDate: businessInfo.foundingDate,
bcRegistrationDateFormatted: this.dateToYyyyMmDd(this.apiToDate(businessInfo.foundingDate)),
bcRegistrationNumber: businessInfo.identifier,
bcRegisteredName: businessInfo.legalName,
previousJurisdiction: this.getHomeJurisdiction(businessInfo.jurisdiction || ''),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ export interface ExistingBusinessInfoIF {
affidavitFile?: File // only used by UI
affidavitFileKey?: string
affidavitFileName?: string
bcRegistrationDate?: string
bcRegistrationDateFormatted?: string // expro only (YYYY-MM-DD)
bcRegistrationDate?: string // expro only (ISO date-time: '2007-04-25T22:42:42-00:00')
bcRegistrationNumber?: string // expro only (aka Identifier)
bcRegisteredName?: string // expro only
previousJurisdiction: {
Expand Down
7 changes: 2 additions & 5 deletions src/mixins/filing-template-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,8 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM

// Add expro business information.
if (this.getExistingBusinessInfo?.mode === 'EXPRO') {
const foundingDate = this.getExistingBusinessInfo?.bcRegistrationDate
filing.continuationIn.business = {
foundingDate: foundingDate,
foundingDate: this.getExistingBusinessInfo?.bcRegistrationDate,
identifier: this.getExistingBusinessInfo?.bcRegistrationNumber,
legalName: this.getExistingBusinessInfo?.bcRegisteredName
}
Expand Down Expand Up @@ -464,15 +463,13 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM

// restore existing business information
if (continuationIn.foreignJurisdiction) {
const foundingDate = continuationIn.business?.foundingDate
const exproConfirmation = (continuationIn.exproConfirmation === true) ? true
: (continuationIn.exproConfirmation === false) ? false : undefined
this.setExistingBusinessInfo({
affidavitFile: continuationIn.foreignJurisdiction.affidavitFile,
affidavitFileKey: continuationIn.foreignJurisdiction.affidavitFileKey,
affidavitFileName: continuationIn.foreignJurisdiction.affidavitFileName,
bcRegistrationDate: foundingDate,
bcRegistrationDateFormatted: this.dateToYyyyMmDd(this.apiToDate(foundingDate)),
bcRegistrationDate: continuationIn.business?.foundingDate,
bcRegistrationNumber: continuationIn.business?.identifier,
bcRegisteredName: continuationIn.business?.legalName,
// store previousJurisdiction as null if not saved
Expand Down

0 comments on commit d6b2495

Please sign in to comment.