-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
19291 Implemented "future effective amalgamation" alert #608
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<template> | ||
<v-expansion-panels | ||
id="amalgamation-container" | ||
v-model="panel" | ||
> | ||
<v-expansion-panel class="mb-6"> | ||
<v-expansion-panel-header | ||
hide-actions | ||
class="d-flex justify-space-between px-6 py-5" | ||
> | ||
<h3> | ||
<v-icon | ||
left | ||
color="orange darken-2" | ||
> | ||
mdi-alert | ||
</v-icon> | ||
<span>This corporation is part of an amalgamation and is scheduled to become | ||
historical on {{ amalgamationDate || '[unknown]' }}.</span> | ||
</h3> | ||
<v-btn | ||
text | ||
color="primary" | ||
class="details-btn my-n1" | ||
@click.stop="togglePanel()" | ||
> | ||
<span color="primary">{{ panel === 0 ? "Hide Details" : "View Details" }}</span> | ||
<v-icon | ||
right | ||
color="primary" | ||
> | ||
{{ panel === 0 ? "mdi-chevron-up" : "mdi-chevron-down" }} | ||
</v-icon> | ||
</v-btn> | ||
</v-expansion-panel-header> | ||
|
||
<v-expansion-panel-content> | ||
<p class="mb-0"> | ||
If you have any questions, please contact BC Registries staff: | ||
</p> | ||
<ContactInfo class="pt-5" /> | ||
</v-expansion-panel-content> | ||
</v-expansion-panel> | ||
</v-expansion-panels> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Vue } from 'vue-property-decorator' | ||
import { Getter } from 'pinia-class' | ||
import { ContactInfo } from '@/components/common' | ||
import { useBusinessStore } from '@/stores' | ||
import { ApiDateTimeUtc, BusinessWarningIF } from '@/interfaces' | ||
import { DateUtilities } from '@/services' | ||
|
||
@Component({ | ||
components: { ContactInfo } | ||
}) | ||
export default class Amalgamation extends Vue { | ||
@Getter(useBusinessStore) getBusinessWarnings!: BusinessWarningIF[] | ||
|
||
panel = 1 | ||
|
||
togglePanel (): void { | ||
this.panel = (this.panel === 1 ? 0 : 1) | ||
} | ||
|
||
get amalgamationDate (): string { | ||
const warning = this.getBusinessWarnings.find(item => | ||
item.warningType?.includes('FUTURE_EFFECTIVE_AMALGAMATION') | ||
) | ||
const date = warning?.data?.amalgamationDate as ApiDateTimeUtc | ||
return DateUtilities.apiToPacificDate(date, true) | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import "@/assets/styles/theme.scss"; | ||
|
||
.v-expansion-panel-header { | ||
pointer-events: none; // disable whole-row expansion | ||
} | ||
|
||
h3 { | ||
.v-icon { | ||
margin-top: -2px; | ||
font-size: $px-20; | ||
} | ||
|
||
span { | ||
font-size: $px-14; | ||
} | ||
} | ||
|
||
.details-btn { | ||
pointer-events: auto; // enable detail button only | ||
max-width: fit-content; | ||
color: $app-blue; | ||
|
||
span { | ||
font-size: $px-13; | ||
} | ||
|
||
.v-icon { | ||
font-size: $px-24 !important; | ||
} | ||
} | ||
|
||
// override default expansion panel padding | ||
:deep(.v-expansion-panel-content__wrap) { | ||
padding: 0 1.5rem 1.25rem 1.5rem; | ||
} | ||
|
||
p { | ||
font-size: $px-14; | ||
} | ||
|
||
// override contact info sizes | ||
:deep(.contact-info .contact-container) { | ||
.v-icon { | ||
font-size: $px-16 !important; | ||
} | ||
span { | ||
font-size: $px-14 !important; | ||
} | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
</template> | ||
</v-checkbox> | ||
<p class="certify-clause signature-date"> | ||
<strong>Date:</strong> {{ formattedCurrentDate }} | ||
<strong>Date:</strong> {{ formattedCurrentDate || '[unknown]' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any particular reason why "[unknown]" is lowercase here but is capitalized as "[Unknown]" in LimitedRestorationExtensionFiling.vue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We haven't had much UX guidance on error handling, but I've gravitated towards showing unknown as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm personally good with either if it's consistent! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is now! |
||
</p> | ||
<p class="certify-clause"> | ||
{{ message }} | ||
|
@@ -94,7 +94,7 @@ export default class Certify extends Vue { | |
|
||
get formattedCurrentDate (): string { | ||
const date = DateUtilities.yyyyMmDdToDate(this.getCurrentDate) | ||
return (DateUtilities.dateToPacificDate(date, true) || 'Unknown') | ||
return DateUtilities.dateToPacificDate(date, true) | ||
} | ||
|
||
/** The trimmed "Certified By" string (may be ''). */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ export interface BusinessWarningIF { | |
filing?: string // not used | ||
message: string | ||
warningType: string // FUTURE: use an enum | ||
data?: any // optional extra properties (eg, amalgamationDate) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per bcgov/entity#19292. |
||
} | ||
|
||
/** The Business object from the Legal API. */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import Vue from 'vue' | ||
import Vuetify from 'vuetify' | ||
import { mount } from '@vue/test-utils' | ||
import { createPinia, setActivePinia } from 'pinia' | ||
import { useBusinessStore } from '@/stores' | ||
import Amalgamation from '@/components/Dashboard/Alerts/Amalgamation.vue' | ||
import { ContactInfo } from '@/components/common' | ||
import flushPromises from 'flush-promises' | ||
|
||
Vue.use(Vuetify) | ||
const vuetify = new Vuetify({}) | ||
|
||
setActivePinia(createPinia()) | ||
const businessStore = useBusinessStore() | ||
|
||
describe('Amalgamation component', () => { | ||
beforeAll(() => { | ||
businessStore.$state.businessInfo.warnings = [ | ||
{ | ||
code: 'AMALGAMATING_BUSINESS', | ||
message: 'This business is part of a future effective amalgamation.', | ||
warningType: 'FUTURE_EFFECTIVE_AMALGAMATION', | ||
data: { | ||
amalgamationDate: '2024-01-31T08:00:00+00:00' | ||
} | ||
} | ||
] | ||
}) | ||
|
||
it('Displays expansion panel closed', () => { | ||
const wrapper = mount(Amalgamation, { vuetify }) | ||
|
||
// verify content | ||
expect(wrapper.find('h3').text()).toContain('This corporation is part of an amalgamation') | ||
expect(wrapper.find('h3').text()).toContain('January 31, 2024') | ||
expect(wrapper.find('.details-btn').text()).toBe('View Details') | ||
expect(wrapper.find('.v-expansion-panel-content').exists()).toBe(false) | ||
|
||
wrapper.destroy() | ||
}) | ||
|
||
it('Displays expansion panel open', async () => { | ||
const wrapper = mount(Amalgamation, { vuetify }) | ||
|
||
// click the button | ||
await wrapper.find('.details-btn').trigger('click') | ||
await flushPromises() // wait for expansion transition | ||
|
||
// verify content | ||
expect(wrapper.find('h3').text()).toContain('This corporation is part of an amalgamation') | ||
expect(wrapper.find('h3').text()).toContain('January 31, 2024') | ||
expect(wrapper.find('.v-expansion-panel-content').exists()).toBe(true) | ||
expect(wrapper.find('.v-expansion-panel-content__wrap').text()).toContain('If you have any questions') | ||
expect(wrapper.findComponent(ContactInfo).exists()).toBe(true) | ||
|
||
wrapper.destroy() | ||
}) | ||
|
||
// FUTURE: add a text to verify hidePhoneNumbers() | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This safely returns null if
date
is invalid/null/undefined.