Skip to content
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

21138 Fetch and display expro data from COLIN + UI updates + fixed misc states and validations, etc #691

Merged
merged 2 commits into from
May 27, 2024

Conversation

severinbeauvais
Copy link
Collaborator

@severinbeauvais severinbeauvais commented May 16, 2024

Issue #: bcgov/entity#21138

Description of changes:
Commit 1:

  • app version = 5.10.12
  • added COLIN env config
  • imported some updated shared components
  • added COLIN vault keys
  • added a base class
  • misc cleanup
  • added error dialog to Extrapro Registration
  • re-worked Extrapro Registration components, layout, logic, etc
  • added rules + validation
  • added date picker
  • removed ULC radio group
  • finished affidavit file upload
  • changed historical fields to display-only
  • changed active fields to all editable
  • added jurisdiction conversions
  • fixed some Manual Business Info bugs + cleanup
  • added BN hints
  • re-worked Summary Business Home Jurisdiction fields, etc
  • added conditional contact info to Generic Error Dialog
  • added Colin Business interface
  • updated Continuation In Filing interface
  • updated Continuation Authorization interface
  • updated Existing Business Info interface
  • updated filing save/restore code
  • added Colin Services module
  • added store getters for new (continuation in) entity types
  • added COLIN keys to Fetch Config
  • updated unit tests

Commit 2:

  • added affidavit file to summary section
  • updated isContinuationInValid getter
  • added Court Order/POA component to review page
  • imported fixed shared DatePicker component
  • updated validation triggers
  • reactively set homeJurisdiction objects
  • wait for form to show before validating it
  • misc logic cleanup
  • deleted unneeded Empty Existing Business Info object
  • updated initial value in store state

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the bcrs-entities-create-ui license (Apache 2.0).

@severinbeauvais severinbeauvais self-assigned this May 16, 2024
@severinbeauvais severinbeauvais changed the title 21138 WIP 21138 Fetch and display expro data from COLIN (WIP) May 17, 2024
@severinbeauvais severinbeauvais force-pushed the 21138 branch 2 times, most recently from 24e9671 to 742f100 Compare May 21, 2024 21:29
@bcgov bcgov deleted a comment from bcregistry-sre May 22, 2024
@bcgov bcgov deleted a comment from bcregistry-sre May 22, 2024
@severinbeauvais severinbeauvais force-pushed the 21138 branch 2 times, most recently from 9d12368 to 6107499 Compare May 24, 2024 15:55
- added COLIN env config
- imported some updated shared components
- added COLIN vault keys
- added a base class
- misc cleanup
- added error dialog to Extrapro Registration
- re-worked Extrapro Registration components, layout, logic, etc
- added rules + validation
- added date picker
- removed ULC radio group
- finished affidavit file upload
- changed historical fields to display-only
- changed active fields to all editable
- added jurisdiction conversions
- fixed some Manual Business Info bugs + cleanup
- added BN hints
- re-worked Summary Business Home Jurisdiction fields, etc
- added conditional contact info to Generic Error Dialog
- added Colin Business interface
- updated Continuation In Filing interface
- updated Continuation Authorization interface
- updated Existing Business Info interface
- updated filing save/restore code
- added Colin Services module
- added store getters for new (continuation in) entity types
- added COLIN keys to Fetch Config
- updated unit test
@@ -14,6 +14,8 @@ VUE_APP_SITEMINDER_LOGOUT_URL="https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi"
#vaults API
VUE_APP_AUTH_API_URL="https://auth-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_AUTH_API_VERSION="/api/v1"
VUE_APP_COLIN_API_URL="https://colin-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_COLIN_API_VERSION="/api/v1"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For calling COLIN API to fetch expro business info.

"@bcrs-shared-components/certify": "2.1.15",
"@bcrs-shared-components/completing-party": "2.1.30",
"@bcrs-shared-components/confirm-dialog": "1.2.1",
"@bcrs-shared-components/contact-info": "1.2.15",
"@bcrs-shared-components/corp-type-module": "1.0.16",
"@bcrs-shared-components/correct-name": "1.0.46",
"@bcrs-shared-components/court-order-poa": "3.0.11",
"@bcrs-shared-components/date-picker": "1.2.15",
"@bcrs-shared-components/date-picker": "1.2.55",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component now correctly supports disablePicker prop.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this again so that DatePicker honour the input rules (which were previously conditional). I tested this in other filings and it looks fine.

"@bcrs-shared-components/interfaces": "1.1.13",
"@bcrs-shared-components/jurisdiction": "1.1.2",
"@bcrs-shared-components/interfaces": "1.1.15",
"@bcrs-shared-components/jurisdiction": "1.1.3",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component now supports readonly prop + small bugfixes.

:title="errorDialogTitle"
:showContactInfo="false"
@close="errorDialog = false"
/>
Copy link
Collaborator Author

@severinbeauvais severinbeauvais May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this:

image

(Note that there is no contact info.)

v-if="isBusinessActive"
ref="formRef"
lazy-validation
@submit.prevent
>
Copy link
Collaborator Author

@severinbeauvais severinbeauvais May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a v-form to trigger validation on Vuetify components.

(Also need to call validation explicitly on our own components because they don't support the validation api.)

Copy link
Collaborator Author

@severinbeauvais severinbeauvais May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshots:

Historical expro
image

Active expro when cont in type is "C"
image

Active expro when cont in type is "CUL"
image

(validation will be fixed soon) fixed

}
if (jurisdiction?.country === JurisdictionLocation.CA) {
if (jurisdiction?.region === 'FEDERAL') return 'Federal'
return CanJurisdictions.find(can => can.value === jurisdiction?.region)?.text || 'Canada'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can't find the region, I provide a fallback to "Canada" (since the data from COLIN, in Dev at least, is all over the place).

Ditto for "USA", below.

mounted (): void {
// set existing business info object from the store, if it exists
// point business variable to Existing Business Info object from the store, if it exists
Copy link
Collaborator Author

@severinbeauvais severinbeauvais May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is important.

The local business object variable and the store state (accessing via getters and actions) are pointers to the same memory location. Thus, we don't have to "set" the store variable every time the local business object changes (eg, due to a text field v-model update); it's just the one object that everybody is updating.

status: result.status,
taxId: result.bn?.substring(0, 9) || null
taxId: businessInfo.businessNumber?.substring(0, 9) || null
}
this.setExistingBusinessInfo(this.business)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This re-syncs the local object with the store state.

this.$set(this.business, 'affidavitFileKey', psu.key)
this.$set(this.business, 'affidavitFileName', file.name)
this.$set(this.business, 'affidavitFileUrl', psu.preSignedUrl)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We save the File so that the file upload component can re-init when a draft is restored.

We save the Key because the Legal API needs it for later.

We save the Name because the UI displays it in a couple of places.

We save the URL because the UI will need it (future ticket) to show the files are download links on the review page.

<v-form
v-if="jurisdiction && !isMrasJurisdiction"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we show the form for all jurisdictions (ie, it was decided to not use MRAS search so no special handling here).

@bcgov bcgov deleted a comment from bcregistry-sre May 24, 2024
@severinbeauvais severinbeauvais changed the title 21138 Fetch and display expro data from COLIN (WIP) 21138 Fetch and display expro data from COLIN + UI updates + fixed misc states and validations, etc May 24, 2024
package.json Outdated Show resolved Hide resolved
@severinbeauvais severinbeauvais marked this pull request as ready for review May 27, 2024 17:45
@severinbeauvais
Copy link
Collaborator Author

/gcbrun

@bcregistry-sre
Copy link
Collaborator

bcregistry-sre commented May 27, 2024

Temporary Url for review: https://business-create-dev--pr-691-nozaqqyw.web.app

SB says, try these:
C (with no data entered): https://business-create-dev--pr-691-nozaqqyw.web.app/continuation-in-business-home?id=TItNIA7UFN
CBEN: https://business-create-dev--pr-691-nozaqqyw.web.app/continuation-in-business-home?id=TbY9bJGz0k
CUL: https://business-create-dev--pr-691-nozaqqyw.web.app/continuation-in-business-home?id=TyS39DGw5j

Search for active expro: A0073450
Search for active expro: A0071234 (different name in BC/SK)
Search for active expro: A0045632 (missing name in home jurisdiction)
Search for historical expro (Alberta): A0034510
Search for historical expro (Federal): A0014545

@bcgov bcgov deleted a comment from bcregistry-sre May 27, 2024
@severinbeauvais severinbeauvais force-pushed the 21138 branch 3 times, most recently from 8e23b22 to 74b791d Compare May 27, 2024 17:58
- updated isContinuationInValid getter
- added Court Order/POA component to review page
- imported fixed shared DatePicker component
- updated validation triggers
- reactively set homeJurisdiction objects
- wait for form to show before validating it
- misc logic cleanup
- deleted unneeded Empty Existing Business Info object
- updated initial value in store state
@bcgov bcgov deleted a comment from bcregistry-sre May 27, 2024
<!-- *** TODO: remove after testing: -->
({{ item.status?.charAt(0) }})
<span>{{ item.identifier }}</span>
<span v-if="showBusinessSearchStatus">&nbsp;({{ item.status?.charAt(0) }})</span>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the Active/Historical indicator but feature-flagged it. It's super useful for testing but we don't want to show it in Prod.

@JazzarKarim
Copy link
Collaborator

I've tested a bunch in the temp links, it's amazing we're getting all these details from that COLIN call:
colin call returning

This helps a bunch.

:initialValue="business.homeIncorporationDate"
:inputRules="getShowErrors ? incorporationDateRules: []"
:maxDate="getCurrentDate"
@emitDateSync="$set(business, 'homeIncorporationDate', $event)"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me call your attention to this $set call, which adds the prop "homeIncorporationDate" to the "business" object reactively (since business was initialized to {}).

Without this, the new date was not recognized by the watcher function and the valid event was not emitted to the parent component.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now, this is setting business.homeIncorporationDate to whatever date is being picked reactively. Sweet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply assigning the value correctly updated the business object but watchers (and computeds, etc) did not react to it, so this was needed. It's because the business object was initialized without properties.


if (jurisdiction?.group === 0) {
// set property reactively (in case it was null)
this.$set(this.business, 'homeJurisdiction', {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing again with $set.

It appears that the Vuetify v-model properties don't need this. It's likely that Vuetify just initialized and sets the properties as above.

jurisdictionText = regions.find(p => p.short === region).name

// set local property based on jurisdiction value
this.isMrasJurisdiction = MrasJurisdictions.includes(jurisdictionText.toLowerCase())
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the MRAS-related logic.

Copy link
Collaborator

@JazzarKarim JazzarKarim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great Sev 👍 👍

if (this.active && this.getShowErrors) {
await this.$nextTick() // wait for form to finish rendering
this.$refs.manualFormRef?.validate()
this.$refs.incorporationDateRef?.validateForm()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the "active" and "getShowErrors" flags change and are both True, this code is executed.

You can see that I call the v-form validation to trigger validations on the Vuetify components, and I explicitly call our custom component's validation.

What caused me some grief here was needing to wait after "active" becomes true so that the template is rendered and the refs are initialized (otherwise they are undefined). It now works correctly and I can explain why (no magic).

@@ -217,7 +218,7 @@ export const stateModel: StateModelIF = {
continuationIn: {
businessHomeValid: false,
continuationAuthorization: null,
existingBusinessInfo: null
existingBusinessInfo: {} as ExistingBusinessInfoIF
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows us to re-reference object properties without an exception, though we might have to $set them in the object for reactivity.

@@ -2,7 +2,7 @@
<div id="continuation-in-business-home">
<!-- Existing Business Information -->
<section class="mt-10">
<header id="existing-Business-information">
<header id="existing-business-information">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A 1-character bug.

When this section was invalid, the page didn't scroll to it. Turns out, ids are case-sensitive 🤦

@severinbeauvais
Copy link
Collaborator Author

severinbeauvais commented May 27, 2024

I've tested a bunch in the temp links, it's amazing we're getting all these details from that COLIN call:
...

Thanks for testing! Yes, Vysakh and I designed this COLIN call and he implemented it 😀

(We did this so that Business Search didn't have to be updated.)

@severinbeauvais severinbeauvais merged commit 4d4a70b into bcgov:main May 27, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants