Skip to content

Commit

Permalink
'Consent to Continue Out' - fix filing history text and display badge…
Browse files Browse the repository at this point in the history
… in tombstone (#80)
  • Loading branch information
patrickpeinanw authored Nov 26, 2024
1 parent 0a8c1cc commit 68e433e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
5 changes: 3 additions & 2 deletions src/components/bcros/businessDetails/Status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ const {
currentBusiness,
currentBusinessIdentifier,
stateFiling,
isInLimitedRestoration,
isAuthorizedToContinueOut
isInLimitedRestoration
} = storeToRefs(useBcrosBusiness())
const { isAuthorizedToContinueOut } = storeToRefs(useBcrosFilings())
const getReasonText = computed(() => {
if (currentBusiness.value.state !== BusinessStateE.HISTORICAL) {
return ''
Expand Down
16 changes: 8 additions & 8 deletions src/components/bcros/filing/item/ConsentContinuationOut.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<template #body>
<div>
<p v-if="expiry && !isConsentExpired" class="mt-0">
{{ $t('text.filing.continuation.consentContinueOutTo') }} {{ foreignJurisdiction }}&nbsp;
{{ $t('text.filing.continuation.isValid') }}&nbsp;
{{ $t('text.filing.continuation.consentContinueOutTo') }} {{ foreignJurisdiction }}
{{ $t('text.filing.continuation.isValid') }}
<strong>{{ $t('text.filing.continuation.until') }}&nbsp;{{ expiry }}</strong>.
</p>

Expand Down Expand Up @@ -34,7 +34,7 @@ const expiry = props.filing.data?.consentContinuationOut?.expiry
: null
/** Check if Consent is Expired. (Assumes expiry is not empty.) */
const isConsentExpired = (): boolean => {
const isConsentExpired: Ref<boolean> = computed(() => {
const expiry = props.filing.data?.consentContinuationOut?.expiry
if (expiry) {
const date = new Date(expiry)
Expand All @@ -44,16 +44,16 @@ const isConsentExpired = (): boolean => {
}
}
return false
}
})
const getRegionName = (countryShortCode: string, regionShortCode: string): string =>
regionShortCode.toUpperCase() === 'FEDERAL'
? 'Federal'
: iso3166.subdivision(countryShortCode, regionShortCode)
: iso3166.subdivision(countryShortCode, regionShortCode).name
const foreignJurisdiction = (): string => {
const foreignJurisdiction: Ref<string> = computed(() => {
const foreignJurisdictionCountry = props.filing.data?.consentContinuationOut?.country?.toUpperCase()
const countryName = iso3166.country(foreignJurisdictionCountry)
const countryName = iso3166.country(foreignJurisdictionCountry).name
const regionShortCode = props.filing.data?.consentContinuationOut?.region?.toUpperCase()
const regionName = getRegionName(foreignJurisdictionCountry, regionShortCode)
Expand All @@ -62,5 +62,5 @@ const foreignJurisdiction = (): string => {
} else {
return countryName
}
}
})
</script>
10 changes: 0 additions & 10 deletions src/stores/business.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,6 @@ export const useBcrosBusiness = defineStore('bcros/business', () => {
return isTypeRestorationLimited.value || isTypeRestorationLimitedExtension.value
})

const isAuthorizedToContinueOut = computed(() => {
const expiryDate = stateFiling.value?.consentContinuationOut?.expiry
if (expiryDate) {
const ccoExpiryDate = new Date(expiryDate)
return ccoExpiryDate >= new Date()
}
return false
})

// computed variables for staff filing options
const showConsentAmalgamationOut = computed(() => {
return (
Expand Down Expand Up @@ -569,7 +560,6 @@ export const useBcrosBusiness = defineStore('bcros/business', () => {
isTypeRestorationLimited,
isTypeRestorationFull,
isFirm,
isAuthorizedToContinueOut,
showAmalgamateOut,
showConsentAmalgamationOut,
showContinueOut,
Expand Down
19 changes: 19 additions & 0 deletions src/stores/filings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ export const useBcrosFilings = defineStore('bcros/filings', () => {
const apiURL = useRuntimeConfig().public.legalApiURL

const downloadingInProgress = ref(false)

/** Whether the business is authorized to continue out, i.e. true if cco expiry date is present or in the future. */
const isAuthorizedToContinueOut = computed(() => {
const ccoFiling = filings.value?.find((val) => {
const exp = val.data?.consentContinuationOut?.expiry
if (exp) {
return true
}
return false
})
if (ccoFiling) {
const exp = ccoFiling.data?.consentContinuationOut?.expiry
const ccoExpiryDate = apiToDate(exp)
return ccoExpiryDate >= new Date()
}
return false
})

const setDownloadingInProgress = (isDownloading: boolean) => {
downloadingInProgress.value = isDownloading
}
Expand Down Expand Up @@ -137,6 +155,7 @@ export const useBcrosFilings = defineStore('bcros/filings', () => {
loading,
errors,
downloadingInProgress,
isAuthorizedToContinueOut,
loadFilings,
loadBootstrapFiling,
clearFilings,
Expand Down

0 comments on commit 68e433e

Please sign in to comment.