Skip to content

Commit

Permalink
16528-add jurisdiction component to consent (#516)
Browse files Browse the repository at this point in the history
* 16528-add jusrisdiction component

* 16528-jurisdiction details

* 16528-remove log statement

* 16528-unit tests

* 16528-add condition to shoe region error message

* 16528-update ledger text

* 16528-update package version

* 16528-update unit test and add JSDoc comemnt

* 16528-update component for validations

* 16528-add comments

* 16528-correct indentation

* 16528-correct spaces

* 16528-Fixes based on review

* 16528-merge main and update package version

* 16528-update filing-interface based on schema

* 16528-fixes based on review

* 16528-update unit test

* 16528-update api-interface to match schema

* 16528-update to expiry date with time

* 16528-update unit test
  • Loading branch information
ketaki-deodhar authored Jun 12, 2023
1 parent c836012 commit bb48ff7
Show file tree
Hide file tree
Showing 10 changed files with 244 additions and 28 deletions.
4 changes: 2 additions & 2 deletions 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-filings-ui",
"version": "6.5.11",
"version": "6.5.12",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<template>
<FilingTemplate class="consent-continuation-out" :filing="filing" :index="index">
<template #body>
<div v-if="isFilingComplete">
<p class="mt-4">
This consent is valid <strong>until {{ expiry }} at 12:01 am Pacific time</strong>.
<div>
<p class="mt-4" v-if="isFilingComplete && !isConsentExpired">
This consent to continue out to {{foreignJurisdiction}} is valid <strong>until {{ expiry }}</strong>.
</p>
<p class="mt-4" v-if="isConsentExpired">
<v-icon class="warn-icon" left color="orange darken-2">mdi-alert</v-icon>
This consent is expired. Please resubmit the continue out application for authorization to become a foreign
corporation.
</p>
<p v-if="orderDetails" class="mt-4" v-html="orderDetails" />
<p v-if="fileNumber" class="mt-4 mb-0">Court Order Number: {{ fileNumber }}</p>
Expand All @@ -14,26 +19,37 @@
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import { Component, Mixins, Prop } from 'vue-property-decorator'
import { ApiFilingIF } from '@/interfaces'
import FilingTemplate from '../FilingTemplate.vue'
import { DateUtilities, EnumUtilities } from '@/services'
import { CountriesProvincesMixin } from '@/mixins'
@Component({
components: { FilingTemplate }
})
export default class ConsentContinuationOut extends Vue {
export default class ConsentContinuationOut extends Mixins(CountriesProvincesMixin) {
@Prop({ required: true }) readonly filing!: ApiFilingIF
@Prop({ required: true }) readonly index!: number
get expiry (): string {
const expiry = this.filing.data?.consentContinuationOut?.expiry
if (expiry) {
return DateUtilities.apiToPacificDate(expiry, true)
return DateUtilities.apiToPacificDateTime(expiry, true)
}
return '[unknown]'
}
/** Check if Consent is Expired. */
get isConsentExpired (): boolean {
const date = DateUtilities.apiToDate(this.filing.data?.consentContinuationOut?.expiry)
const daysToExpire = DateUtilities.daysFromToday(new Date(), date)
if (isNaN(daysToExpire) || daysToExpire < 0) {
return true
}
return false
}
get orderDetails (): string {
return this.filing.data?.order?.orderDetails?.replaceAll('\n', '<br/>')
}
Expand All @@ -48,10 +64,38 @@ export default class ConsentContinuationOut extends Vue {
return Boolean(this.filing.data?.order?.effectOfOrder)
}
get foreignJurisdiction (): string {
const foreignJusrisdictionCountry = this.filing.data?.consentContinuationOut?.country
const country = this.getCountryName(this.filing.data?.consentContinuationOut?.country)
const region = this.getRegionNameFromCode(this.filing.data?.consentContinuationOut?.region)
if (foreignJusrisdictionCountry === 'CA' || foreignJusrisdictionCountry === 'US') {
return region + ', ' + country
} else {
return country
}
}
/** Whether the filing is complete. */
get isFilingComplete (): boolean {
return EnumUtilities.isStatusCompleted(this.filing)
}
private getRegionNameFromCode (short: string): string {
const region = this.canadaUsaRegions?.find(region => region.short === short)
return region?.name
}
/** Get the respective regions of the country selected as an array of objects. */
get canadaUsaRegions (): Array<object> {
const foreignJusrisdictionCountry = this.filing.data?.consentContinuationOut?.country
if (foreignJusrisdictionCountry === 'CA') {
return this.getCountryRegions('CA')
} else if (foreignJusrisdictionCountry === 'US') {
return this.getCountryRegions('US')
}
return []
}
}
</script>

Expand All @@ -63,4 +107,9 @@ p {
font-size: $px-15;
margin-top: 1rem !important;
}
.warn-icon {
margin-bottom: 6px;
}
</style>
33 changes: 33 additions & 0 deletions src/components/common/ForeignJurisdiction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</v-col>
<v-col cols="12" sm="9">
<v-select
ref="countrySelectRef"
id="country-selector"
:items="getCountries()"
item-text="name"
Expand All @@ -18,6 +19,7 @@
@input="emitChangedCountry($event)"
/>
<v-select
ref="regionSelectRef"
v-if="canadaUsaRegions.length > 0"
id="region-selector"
:items="canadaUsaRegions"
Expand All @@ -40,12 +42,21 @@ import { CountriesProvincesMixin } from '@/mixins'
@Component({})
export default class ForeignJurisdiction extends Mixins(CountriesProvincesMixin) {
// Refs
$refs!: {
countrySelectRef: any
regionSelectRef: any
}
/** Country passed into this component. */
@Prop({ default: () => '' }) readonly draftCountry!: string
/** Region passed into this component. */
@Prop({ default: () => '' }) readonly draftRegion!: string
/** Prompt the validations. Used for global validations. */
@Prop({ default: false }) readonly validateForm!: boolean
selectedCountryName = ''
selectedRegionName = ''
Expand Down Expand Up @@ -121,6 +132,28 @@ export default class ForeignJurisdiction extends Mixins(CountriesProvincesMixin)
this.selectedRegionName = val
}
/** Validate country field */
@Watch('validateForm')
validateForeignJurisdiction (): void {
if (this.validateForm && !this.selectedCountryName) {
this.$refs.countrySelectRef.validate()
this.$refs.countrySelectRef.error = true
}
}
/** Validate region field */
@Watch('selectedCountryName')
@Watch('validateForm')
async onCountrychanged (): Promise<void> {
if (this.validateForm) {
await this.$nextTick()
if (this.selectedCountryName === 'Canada' || this.selectedCountryName === 'United States of America') {
this.$refs.regionSelectRef.validate()
this.$refs.regionSelectRef.error = true
}
}
}
/** Emit the selected country's code whenever a new country is selected. */
@Emit('update:country')
emitChangedCountry (): string {
Expand Down
4 changes: 4 additions & 0 deletions src/interfaces/api-filing-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export interface ApiFilingIF {
consentContinuationOut?: {
expiry: IsoDatePacific
orderDetails: string
foreignJurisdiction: {
country: string
region?: string
}
}

// conversion filings only
Expand Down
55 changes: 49 additions & 6 deletions src/views/ConsentContinuationOut.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,26 @@
</div>
</section>

<!-- Jurisdiction Information -->
<section>
<header>
<h2>Jurisdiction Information</h2>
</header>
<div :class="{ 'invalid-foreign-jurisdiction': !foreignJurisdictionValid && showErrors }"
id="foreign-jurisdiction-section">
<v-card flat class="pt-6 px-4">
<ForeignJurisdiction
ref="foreignJurisdictionRef"
:validateForm="showErrors"
:draftCountry="draftCountry"
:draftRegion="draftRegion"
@update:country="selectedCountry=$event"
@update:region="selectedRegion=$event"
@valid="foreignJurisdictionValid=$event"/>
</v-card>
</div>
</section>

<!-- Documents Delivery -->
<section>
<header>
Expand Down Expand Up @@ -240,7 +260,7 @@ import { Getter } from 'pinia-class'
import { StatusCodes } from 'http-status-codes'
import { navigate } from '@/utils'
import SbcFeeSummary from 'sbc-common-components/src/components/SbcFeeSummary.vue'
import { Certify, DetailComment } from '@/components/common'
import { Certify, DetailComment, ForeignJurisdiction } from '@/components/common'
import { ConfirmDialog, PaymentErrorDialog, ResumeErrorDialog, SaveErrorDialog, StaffPaymentDialog }
from '@/components/dialogs'
import { CommonMixin, DateMixin, EnumMixin, FilingMixin, ResourceLookupMixin } from '@/mixins'
Expand All @@ -259,6 +279,7 @@ import { useBusinessStore, useConfigurationStore, useRootStore } from '@/stores'
CourtOrderPoa,
DetailComment,
DocumentDelivery,
ForeignJurisdiction,
PaymentErrorDialog,
ResumeErrorDialog,
SaveErrorDialog,
Expand All @@ -272,7 +293,8 @@ export default class ConsentContinuationOut extends Mixins(CommonMixin, DateMixi
$refs!: {
confirm: ConfirmDialogType,
certifyRef: Certify,
detailCommentRef: DetailComment
detailCommentRef: DetailComment,
foreignJurisdictionRef: ForeignJurisdiction
}
@Getter(useConfigurationStore) getAuthWebUrl!: string
Expand All @@ -298,6 +320,13 @@ export default class ConsentContinuationOut extends Mixins(CommonMixin, DateMixi
hasPlanOfArrangement = false
courtOrderValid = true
// variables for Foreign Jurisdiction component
draftCountry = ''
draftRegion = ''
selectedCountry = ''
selectedRegion = ''
foreignJurisdictionValid = false
// variables for Document Delivery component
documentDeliveryValid = true
documentOptionalEmail = ''
Expand Down Expand Up @@ -350,7 +379,8 @@ export default class ConsentContinuationOut extends Mixins(CommonMixin, DateMixi
/** True if page is valid, else False. */
get isPageValid (): boolean {
return (this.detailCommentValid && this.certifyFormValid && this.documentDeliveryValid && this.courtOrderValid)
return (this.detailCommentValid && this.certifyFormValid && this.foreignJurisdictionValid &&
this.documentDeliveryValid && this.courtOrderValid)
}
/** True when saving, saving and resuming, or filing and paying. */
Expand Down Expand Up @@ -466,6 +496,12 @@ export default class ConsentContinuationOut extends Mixins(CommonMixin, DateMixi
this.hasPlanOfArrangement = EnumUtilities.isEffectOfOrderPlanOfArrangement(courtOrder.effectOfOrder)
}
const foreignJurisdiction = filing.consentContinuationOut.foreignJurisdiction
if (foreignJurisdiction) {
this.draftCountry = foreignJurisdiction.country
this.draftRegion = foreignJurisdiction.region
}
if (filing.header.documentOptionalEmail) {
this.documentOptionalEmail = filing.header.documentOptionalEmail
}
Expand Down Expand Up @@ -712,11 +748,10 @@ export default class ConsentContinuationOut extends Mixins(CommonMixin, DateMixi
const data: any = {
[FilingTypes.CONSENT_CONTINUATION_OUT]: {
// FUTURE: add more filing properties below
details: `${this.defaultComment}\n${this.detailComment}`,
foreignJurisdiction: {
country: 'CA',
region: 'AB'
country: this.selectedCountry,
region: this.selectedRegion
}
}
}
Expand Down Expand Up @@ -845,6 +880,7 @@ export default class ConsentContinuationOut extends Mixins(CommonMixin, DateMixi
/** Array of valid components. Must match validFlags. */
readonly validComponents = [
'detail-comment-section',
'foreign-jurisdiction-section',
'document-delivery-section',
'certify-form-section',
'court-order-section'
Expand All @@ -854,6 +890,7 @@ export default class ConsentContinuationOut extends Mixins(CommonMixin, DateMixi
get validFlags (): object {
return {
detailComment: this.detailCommentValid,
foreignJurisdiction: this.foreignJurisdictionValid,
documentDelivery: this.documentDeliveryValid,
certifyForm: this.certifyFormValid,
courtOrder: this.courtOrderValid
Expand All @@ -864,6 +901,7 @@ export default class ConsentContinuationOut extends Mixins(CommonMixin, DateMixi
@Watch('courtOrderValid')
@Watch('detailCommentValid')
@Watch('documentDeliveryValid')
@Watch('foreignJurisdictionValid')
onHaveChanges (): void {
this.haveChanges = true
}
Expand Down Expand Up @@ -959,5 +997,10 @@ h2 {
color: $app-red;
}
}
.invalid-foreign-jurisdiction {
.title-label {
color: $app-red;
}
}
}
</style>
Loading

0 comments on commit bb48ff7

Please sign in to comment.