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

15538 Don't set initial restoration type + misc cleanup #693

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,020 changes: 2,576 additions & 444 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-filings-ui",
"version": "7.3.23",
"version": "7.3.24",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down Expand Up @@ -38,7 +38,6 @@
"http-status-codes": "^2.2.0",
"launchdarkly-js-client-sdk": "^2.24.2",
"lodash": "^4.17.21",
"lodash.omit": "^4.5.0",
"pdfjs-dist": "3.9.179",
"pinia": "^2.0.35",
"pinia-class": "^0.0.3",
Expand All @@ -48,7 +47,7 @@
"register-service-worker": "^1.7.2",
"rxjs": "^7.8.1",
"sbc-common-components": "3.0.13",
"vue": "2.7.14",
"vue": "2.7.16",
"vue-affix": "^0.5.2",
"vue-auto-resize": "^1.0.1",
"vue-hotjar": "^1.4.0",
Expand All @@ -60,7 +59,7 @@
},
"devDependencies": {
"@pinia/testing": "^0.0.16",
"@types/lodash": "^4.14.194",
"@types/lodash": "^4.17.7",
"@types/sinon": "^10.0.14",
"@types/vue-the-mask": "^0.11.1",
"@types/vuelidate": "^0.7.16",
Expand All @@ -82,7 +81,7 @@
"vite": "4.5.2",
"vite-plugin-environment": "^1.1.3",
"vitest": "0.33.0",
"volar-service-vetur": "^0.0.54",
"volar-service-vetur": "^0.0.62",
"vue-class-component": "^7.2.6",
"vue-debounce-decorator": "^1.0.1",
"vue-property-decorator": "^9.1.2",
Expand Down
35 changes: 16 additions & 19 deletions src/components/Dashboard/StaffNotation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
v-if="isHistorical"
data-type="restoration"
:disabled="!isAllowed(AllowableActions.RESTORATION)"
@click="goToRestorationFiling(ApplicationTypes.CREATE_UI, FilingSubTypes.FULL_RESTORATION)"
@click="goToRestorationFiling()"
>
<v-list-item-title>
<span class="app-blue">Restore Company</span>
Expand Down Expand Up @@ -212,7 +212,7 @@
<v-list-item
v-if="isAllowed(AllowableActions.LIMITED_RESTORATION_EXTENSION)"
data-type="extend-limited-restoration"
@click="goToRestorationFiling(ApplicationTypes.EDIT_UI, FilingSubTypes.LIMITED_RESTORATION_EXTENSION)"
@click="goToRestorationFiling(FilingSubTypes.LIMITED_RESTORATION_EXTENSION)"
>
<v-list-item-title>
<span class="app-blue">Extend Limited Restoration</span>
Expand All @@ -222,7 +222,7 @@
<v-list-item
v-if="isAllowed(AllowableActions.LIMITED_RESTORATION_TO_FULL)"
data-type="convert-full-restoration"
@click="goToRestorationFiling(ApplicationTypes.EDIT_UI, FilingSubTypes.LIMITED_RESTORATION_TO_FULL)"
@click="goToRestorationFiling(FilingSubTypes.LIMITED_RESTORATION_TO_FULL)"
>
<v-list-item-title>
<span class="app-blue">Convert to Full Restoration</span>
Expand All @@ -239,12 +239,7 @@
import { Component, Emit, Mixins, Prop } from 'vue-property-decorator'
import { Action, Getter } from 'pinia-class'
import { GetFeatureFlag, navigate } from '@/utils'
import {
AllowableActions,
ApplicationTypes,
FilingSubTypes,
Routes
} from '@/enums'
import { AllowableActions, FilingSubTypes, Routes } from '@/enums'
import { FilingNames, FilingTypes } from '@bcrs-shared-components/enums'
import { AddStaffNotationDialog } from '@/components/dialogs'
import { AllowableActionsMixin, FilingMixin } from '@/mixins'
Expand All @@ -265,7 +260,6 @@ export default class StaffNotation extends Mixins(AllowableActionsMixin, FilingM

// enums for template
readonly AllowableActions = AllowableActions
readonly ApplicationTypes = ApplicationTypes
readonly FilingNames = FilingNames
readonly FilingSubTypes = FilingSubTypes
readonly FilingTypes = FilingTypes
Expand Down Expand Up @@ -373,9 +367,10 @@ export default class StaffNotation extends Mixins(AllowableActionsMixin, FilingM
this.$router.push({ name: Routes.CONTINUATION_OUT, query: { filingId: '0' } })
}

async goToRestorationFiling (applicationName: ApplicationTypes, restorationType: FilingSubTypes): Promise<void> {
let url: string
async goToRestorationFiling (restorationType: FilingSubTypes = null): Promise<void> {
try {
let url: string

// show spinner since the network calls below can take a few seconds
this.setFetchingDataSpinner(true)

Expand All @@ -386,13 +381,15 @@ export default class StaffNotation extends Mixins(AllowableActionsMixin, FilingM

if (isNaN(id)) throw new Error('Invalid API response')

// navigate to Create UI if Full/Limited restoration
// navigate to Edit UI if Limited extension/Full to Limited conversion
if (applicationName === ApplicationTypes.CREATE_UI) {
url = `${this.getCreateUrl}?id=${this.getIdentifier}`
}
if (applicationName === ApplicationTypes.EDIT_UI) {
url = `${this.getEditUrl}${this.getIdentifier}/` + restorationType + `?restoration-id=${id}`
// navigate to Edit UI for limited restoration extension filing
// navigate to Edit UI for limited restoration to full filing
// navigate to Create UI for full or limited restoration filing
if (restorationType === FilingSubTypes.LIMITED_RESTORATION_EXTENSION) {
url = `${this.getEditUrl}${this.getIdentifier}/limitedRestorationExtension?restoration-id=${id}`
} else if (restorationType === FilingSubTypes.LIMITED_RESTORATION_TO_FULL) {
url = `${this.getEditUrl}${this.getIdentifier}/limitedRestorationToFull?restoration-id=${id}`
} else {
url = `${this.getCreateUrl}restoration-business-name?id=${this.getIdentifier}`
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 added this direct route to step 1 of the restoration filing, which saves a default re-route and then another re-route for restorations.

Ditto in TodoList.

And also I updated the unit tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@hfekete Here's why a route is specified for Create UI ^^.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@patrickpeinanw FYI, and also see other changes in this PR. Thanks!

}

navigate(url)
Expand Down
55 changes: 13 additions & 42 deletions src/components/Dashboard/TodoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
<v-btn
class="ma-1 affiliation-invitation-action-button"
color="primary"
@click.native.stop="authorizeAffiliationInvitation(true, item)"

Check warning on line 279 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Authorize</span>
</v-btn>
Expand All @@ -284,7 +284,7 @@
class="ma-1 affiliation-invitation-action-button"
outlined
color="primary"
@click.native.stop="authorizeAffiliationInvitation(false, item)"

Check warning on line 287 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Do not authorize</span>
</v-btn>
Expand Down Expand Up @@ -358,7 +358,7 @@
<v-btn
class="btn-draft-delete"
color="primary"
@click.native.stop="confirmDeleteDraft(item)"

Check warning on line 361 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Delete draft</span>
</v-btn>
Expand All @@ -370,7 +370,7 @@
class="btn-draft-resume"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumeFiling(item)"

Check warning on line 373 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<template v-if="EnumUtilities.isTypeAmalgamationApplication(item) && item.isEmptyFiling">
<span>Fill out Amalgamation Application</span>
Expand Down Expand Up @@ -460,7 +460,7 @@
:class="{ 'cancellable' : isCancellableTodoItem(item) }"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumePayment(item)"

Check warning on line 463 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Change Payment Type</span>
</v-btn>
Expand All @@ -470,7 +470,7 @@
:class="{ 'cancellable' : isCancellableTodoItem(item) }"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumePayment(item)"

Check warning on line 473 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Resume Payment</span>
</v-btn>
Expand All @@ -488,7 +488,7 @@
color="primary"
:disabled="!item.enabled"
v-on="on"
@click.native.stop

Check warning on line 491 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<v-icon>mdi-menu-down</v-icon>
</v-btn>
Expand All @@ -510,7 +510,7 @@
class="btn-retry-payment"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumePayment(item)"

Check warning on line 513 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Retry Payment</span>
</v-btn>
Expand All @@ -527,7 +527,7 @@
class="btn-draft-resume rounded-r"
color="primary"
:disabled="!item.enabled"
@click.native.stop="doResumeFiling(item)"

Check warning on line 530 in src/components/Dashboard/TodoList.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'.native' modifier on 'v-on' directive is deprecated
>
<span>Make Changes</span>
</v-btn>
Expand Down Expand Up @@ -2086,54 +2086,25 @@
console.log('doResumeFiling(), invalid filing type =', item)
}

/* Handles the restoration flow inside of doResumeFiling */
navigateForResumeRestoration (item: TodoItemIF): void {
let restorationType: FilingSubTypes
/**
* Type assertion is done to fix TypeScript error.
* "This condition will always return 'false' since the types
* 'FilingSubTypes' and 'RestorationTypes' have no overlap."
*/
if (item.filingSubType === FilingSubTypes.FULL_RESTORATION) {
restorationType = FilingSubTypes.FULL_RESTORATION
}

if (item.filingSubType === FilingSubTypes.LIMITED_RESTORATION) {
restorationType = FilingSubTypes.LIMITED_RESTORATION
}

if (item.filingSubType === FilingSubTypes.LIMITED_RESTORATION_EXTENSION) {
restorationType = FilingSubTypes.LIMITED_RESTORATION_EXTENSION
}

if (item.filingSubType === FilingSubTypes.LIMITED_RESTORATION_TO_FULL) {
restorationType = FilingSubTypes.LIMITED_RESTORATION_TO_FULL
}

navigate(this.buildRestorationUrl(item, restorationType))
}

// navigate to Create UI if Full/Limited restoration or to Edit UI if Limited extension/Full to Limited conversion
buildRestorationUrl (item: TodoItemIF, restorationType: FilingSubTypes): string {
/* Called to resume draft restoration filing. */
private navigateForResumeRestoration (item: TodoItemIF): void {
let url: string

switch (restorationType) {
case FilingSubTypes.FULL_RESTORATION:
case FilingSubTypes.LIMITED_RESTORATION: {
url = `${this.getCreateUrl}?id=${this.getIdentifier}`
break
}
case FilingSubTypes.LIMITED_RESTORATION_EXTENSION:
case FilingSubTypes.LIMITED_RESTORATION_TO_FULL: {
url = `${this.getEditUrl}${this.getIdentifier}/` + restorationType + `?restoration-id=${item.filingId}`
break
}
// navigate to Edit UI to resume limited restoration extension filing
// navigate to Edit UI to resume limited restoration to full filing
// navigate to Create UI to resume full or limited restoration filing
if (item.filingSubType === FilingSubTypes.LIMITED_RESTORATION_EXTENSION) {
url = `${this.getEditUrl}${this.getIdentifier}/limitedRestorationExtension?restoration-id=${item.filingId}`
} else if (item.filingSubType === FilingSubTypes.LIMITED_RESTORATION_TO_FULL) {
url = `${this.getEditUrl}${this.getIdentifier}/limitedRestorationToFull?restoration-id=${item.filingId}`
} else {
url = `${this.getCreateUrl}restoration-business-name?id=${this.getIdentifier}`
}

return url
navigate(url)
}

// this is called for both Resume Payment and Retry Payment
/** Called to change payment type, resume payment or retry payment. */
doResumePayment (item: TodoItemIF): boolean {
const paymentToken = item.paymentToken

Expand Down
4 changes: 0 additions & 4 deletions src/enums/applicationTypes.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/enums/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export * from './actions'
export * from './affiliationInvitation'
export * from './allowableActions'
export * from './amalgamationEnums'
export * from './applicationTypes'
export * from './correctionTypes'
export * from './digitalCredentialTypes'
export * from './effectOfOrderTypes'
Expand Down
3 changes: 1 addition & 2 deletions src/mixins/common-mixin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, Vue } from 'vue-property-decorator'
import { isEqual } from 'lodash'
import omit from 'lodash.omit'
import { isEqual, omit } from 'lodash'
import { Getter } from 'pinia-class'
import { useConfigurationStore } from '@/stores'
import { GetFeatureFlag, navigate } from '@/utils'
Expand Down
3 changes: 2 additions & 1 deletion src/mixins/filing-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@ export default class FilingMixin extends DateMixin {

/**
* Builds a Restoration filing body.
* @param restorationType The type of restoration. May be null.
* @returns the filing body
*/
buildRestorationFiling (restorationType = FilingSubTypes.FULL_RESTORATION): RestorationFilingIF {
buildRestorationFiling (restorationType: FilingSubTypes): RestorationFilingIF {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just use what's passed in -- don't fall back to Full Restoration.

const restoration: RestorationFilingIF = {
header: {
date: this.getCurrentDate,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/StaffNotation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ describe('StaffNotation', () => {
await Vue.nextTick()

// verify redirection
expect(window.location.assign).toHaveBeenCalledWith('https://create.url/?id=BC1234567')
expect(window.location.assign).toHaveBeenCalledWith('https://create.url/restoration-business-name?id=BC1234567')

wrapper.destroy()
sinon.restore()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/TodoList1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3315,7 +3315,7 @@ describe('TodoList - Click Tests - Full and Limited Restoration', () => {

// verify redirection
const accountId = JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id
const createUrl = `https://create.url/?id=${test.businessId}`
const createUrl = `https://create.url/restoration-business-name?id=${test.businessId}`
expect(window.location.assign).toHaveBeenCalledWith(createUrl + '&accountid=' + accountId)

wrapper.destroy()
Expand Down
Loading