Skip to content

Commit

Permalink
18532 - AM Button Implementation (#748)
Browse files Browse the repository at this point in the history
* For PR - AM Button Implementation

* Added amalgamate now error

* Alphabetized exports

* Alphabetized exports

* Alphabetized Actions

* Resolved UI logic issue

* Fixed UI logic, rmv debug comments and refactored

* used emit to reuse code.

* Updated for PR

* Updated getter declaration for isAmalgamation

* Fixed the test error

* Refactored code to reduce redundancy

* Removed duplicate functions & unused getter.
  • Loading branch information
jamespaologarcia authored Dec 5, 2023
1 parent 4ca645b commit b08fc6c
Show file tree
Hide file tree
Showing 15 changed files with 257 additions and 32 deletions.
25 changes: 19 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "name-request",
"version": "5.3.9",
"version": "5.3.10",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand All @@ -16,7 +16,7 @@
"@babel/compat-data": "^7.21.5",
"@bcrs-shared-components/breadcrumb": "2.1.24",
"@bcrs-shared-components/corp-type-module": "1.0.13",
"@bcrs-shared-components/enums": "1.0.44",
"@bcrs-shared-components/enums": "1.1.1",
"@bcrs-shared-components/genesys-web-message": "1.0.0",
"@bcrs-shared-components/interfaces": "1.0.67",
"@bcrs-shared-components/staff-payment": "1.0.29",
Expand Down
33 changes: 28 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
:dialog="getIncorporateNowErrorStatus"
@close="closeIncorporateNowErrorDialog()"
/>
<AmalgamateNowErrorDialog
attach="#app"
:dialog="getAmalgamateNowErrorStatus"
@close="closeAmalgamateNowErrorDialog()"
/>
<MrasSearchInfoDialog />
<NrNotRequiredDialog />
<PaymentCompleteDialog />
Expand Down Expand Up @@ -121,8 +126,8 @@ import { Breadcrumb } from '@/components/common'
import GenesysWebMessage from '@bcrs-shared-components/genesys-web-message/GenesysWebMessage.vue'
import { WebChat as ChatPopup } from '@bcrs-shared-components/web-chat'
import {
AffiliationErrorDialog, CancelDialog, ConditionsDialog, ErrorDialog, ExitDialog, HelpMeChooseDialog,
IncorporateNowErrorDialog, MrasSearchInfoDialog, NrNotRequiredDialog, ConfirmNrDialog,
AffiliationErrorDialog, AmalgamateNowErrorDialog, CancelDialog, ConditionsDialog, ErrorDialog, ExitDialog,
HelpMeChooseDialog, IncorporateNowErrorDialog, MrasSearchInfoDialog, NrNotRequiredDialog, ConfirmNrDialog,
PaymentCompleteDialog, PickEntityOrConversionDialog, RenewDialog, ReceiptsDialog,
RefundDialog, ResubmitDialog, RetryDialog, StaffPaymentErrorDialog, UpgradeDialog, ExitIncompletePaymentDialog
} from '@/components/dialogs'
Expand All @@ -137,10 +142,11 @@ import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
@Component({
components: {
ChatPopup,
AffiliationErrorDialog,
AmalgamateNowErrorDialog,
Breadcrumb,
CancelDialog,
ChatPopup,
ConditionsDialog,
ConfirmNrDialog,
ErrorDialog,
Expand Down Expand Up @@ -168,12 +174,14 @@ export default class App extends Mixins(
DateMixin, LoadKeycloakRolesMixin, NrAffiliationMixin, UpdateUserMixin
) {
// Global getters
@Getter getAmalgamateNowErrorStatus!: boolean
@Getter getDisplayedComponent!: string
@Getter getIncorporateNowErrorStatus!: boolean
@Getter getNrId!: number
@Getter isAuthenticated!: boolean
@Getter isRoleStaff!: boolean
@Getter isMobile!: boolean
@Getter isNewBusiness!: boolean
// Global actions
@Action resetAnalyzeName!: ActionBindingIF
Expand Down Expand Up @@ -267,13 +275,22 @@ export default class App extends Mixins(
// if there is stored legal type for an IA then incorporate/register it now
const legaltype = sessionStorage.getItem('LEGAL_TYPE')
if (legaltype) {
try {
await this.incorporateNow(legaltype as CorpTypeCd)
if (this.isNewBusiness) {
await this.incorporateNow(legaltype as CorpTypeCd)
} else {
await this.amalgamateNow(legaltype as CorpTypeCd)
}
// clear the legal type data
sessionStorage.removeItem('LEGAL_TYPE')
} catch (error) {
this.setIncorporateNowErrorStatus(true)
if (this.isNewBusiness) {
this.setIncorporateNowErrorStatus(true)
} else {
this.setAmalgamateNowErrorStatus(true)
}
console.error(error)
}
}
Expand Down Expand Up @@ -348,6 +365,12 @@ export default class App extends Mixins(
sessionStorage.removeItem('LEGAL_TYPE')
this.setIncorporateNowErrorStatus(false)
}
/** Close AmalgamateNowErrorDialog and clear session storage. */
closeAmalgamateNowErrorDialog (): void {
sessionStorage.removeItem('LEGAL_TYPE')
this.setAmalgamateNowErrorStatus(false)
}
}
</script>

Expand Down
96 changes: 96 additions & 0 deletions src/components/dialogs/amalgamate-now-error.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<template>
<v-dialog
v-model="dialog"
width="45rem"
persistent
:attach="attach"
>
<v-card>
<v-card-title id="dialog-title">
Unable to Amalgamate Now
</v-card-title>

<v-card-text id="dialog-text">
<!-- display message -->
<div class="general-error">
<p>Unable to amalgamate now. Please cancel or try again.</p>
</div>
</v-card-text>

<v-divider class="my-0" />

<v-card-actions>
<v-spacer />
<v-btn
id="dialog-cancel-button"
class="dialog-close"
text
@click="close()"
>
Cancel
</v-btn>
<v-btn
id="dialog-try-again-button"
class="dialog-close"
text
@click="tryAgain()"
>
Try Again
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>

<script lang="ts">
import { Component, Vue, Prop, Emit } from 'vue-property-decorator'
@Component({})
export default class AmalgamateNowErrorDialog extends Vue {
/** Prop to display the dialog. */
@Prop() readonly dialog: boolean
/** Prop to provide attachment selector. */
@Prop() readonly attach: string
/** Pass click event to parent. */
@Emit() close () { }
/** Try again button clicked. Refresh the page. */
tryAgain () {
window.location.reload()
}
}
</script>

<style lang="scss" scoped>
@import "@/assets/styles/theme.scss";
.v-dialog {
margin: 2rem;
.v-card {
padding: 0;
.v-card__title {
padding: 1.25rem 1.5rem;
color: $BCgovFontColorInverted;
background: $BCgovBlue5;
font-size: $px-18;
font-weight: bold;
margin: 0;
}
.v-card__text {
padding: 1.5rem !important;
font-weight: 300;
color: $gray7 !important;
font-size: $px-16;
}
.v-card__actions {
padding: 1rem;
}
}
}
</style>
1 change: 1 addition & 0 deletions src/components/dialogs/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { default as AffiliationErrorDialog } from './affiliation-error.vue'
export { default as AmalgamateNowErrorDialog } from './amalgamate-now-error.vue'
export { default as CancelDialog } from './cancel.vue'
export { default as ConditionsDialog } from './conditions.vue'
export { default as ConfirmNrDialog } from './confirm-name-request.vue'
Expand Down
7 changes: 3 additions & 4 deletions src/components/existing-request/existing-request-display.vue
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
:approvedName="approvedName && approvedName.name"
:emailAddress="nr && nr.applicants && nr.applicants.emailAddress"
:disabled="disableUnfurnished"
@incorporateRegisterYourBusiness="incorporateRegisterYourBusiness()"
@affiliateYourBusiness="affiliateYourBusiness()"
@goToSocietiesOnline="goToSocietiesOnline()"
@goToCorpOnline="goToCorpOnline()"
@goToEntityDashboard="goToEntityDashboard(nr.corpNum)"
Expand Down Expand Up @@ -368,7 +368,6 @@ export default class ExistingRequestDisplay extends Mixins(
@Getter getNrId!: number
@Getter getNrState!: NrState
@Getter isMobile!: boolean
// Global actions
@Action editExistingRequest!: ActionBindingIF
@Action setDisplayedComponent!: ActionBindingIF
Expand Down Expand Up @@ -773,8 +772,8 @@ export default class ExistingRequestDisplay extends Mixins(
this.setConditionsModalVisible(true)
}
/** Called to incorporate/register the business. */
async incorporateRegisterYourBusiness (): Promise<void> {
/** Called to incorporate/register/amalgamate the business. */
async affiliateYourBusiness (): Promise<void> {
// safety check
if (!this.isNrApprovedOrConditional) return
Expand Down
8 changes: 4 additions & 4 deletions src/components/existing-request/nr-approved-gray-box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class="register-btn mt-30"
min-width="20rem"
:disabled="disabled"
@click="$emit('incorporateRegisterYourBusiness')"
@click="$emit('affiliateYourBusiness')"
>
<strong>Register Your Business</strong>
</v-btn>
Expand All @@ -26,7 +26,7 @@
class="incorporate-now-btn mt-30"
min-width="20rem"
:disabled="disabled"
@click="$emit('incorporateRegisterYourBusiness')"
@click="$emit('affiliateYourBusiness')"
>
<strong>Incorporate Your Business</strong>
</v-btn>
Expand Down Expand Up @@ -72,7 +72,7 @@
class="amalgamate-now-btn mt-30"
min-width="20rem"
:disabled="disabled"
@click="$emit('goToEntityDashboard')"
@click="$emit('affiliateYourBusiness')"
>
<strong>Amalgamate Now</strong>
</v-btn>
Expand Down Expand Up @@ -225,7 +225,7 @@ export default class NrApprovedGrayBox extends Mixins(CommonMixin) {
}
get showOpenExternalIcon (): boolean {
if (this.showAmalgamateNowButton && !this.isSupportedAmalgamation(this.getNr.requestTypeCd)) return true
if (this.showAmalgamateNowButton && !this.isSupportedAmalgamation(this.getNr.entity_type_cd)) return true
if (this.showAlterNowButton && !this.isSupportedAlteration(this.getNr.requestTypeCd)) return true
return false
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/new-request/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ export default class Search extends Mixins(CommonMixin, NrAffiliationMixin, Sear
/** Retrieve text based on selected action/flow */
get actionNowButtonText (): string {
if (this.isContinuationIn) return 'Continue In Now'
if (this.isAmalgamation) return null // should never happen
if (this.isAmalgamation) return 'Amalgamate Now'
if (this.isConversion) return 'Alter Now'
if (this.isRestoration) return 'Restore Now'
if (this.isChangeName) return 'Change Name Now'
Expand Down Expand Up @@ -707,6 +707,8 @@ export default class Search extends Mixins(CommonMixin, NrAffiliationMixin, Sear
if (this.isAuthenticated) {
if (this.isConversion || this.isRestoration || this.isChangeName) {
this.goToEntityDashboard(this.getSearchBusiness.identifier)
} else if (this.isAmalgamation) {
await this.amalgamateNow(legalType)
} else {
await this.incorporateNow(legalType)
}
Expand Down
8 changes: 8 additions & 0 deletions src/interfaces/business.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { EntityStates, EntityTypes } from '@/enums'
import { AmalgamationTypes } from '@bcrs-shared-components/enums'

export interface BusinessRequest {
filing: {
Expand All @@ -15,6 +16,13 @@ export interface BusinessRequest {
nrNumber?: string
}
},
amalgamation?: {
nameRequest: {
legalType: string
nrNumber?: string
},
type: AmalgamationTypes
},
registration?: {
business: {
natureOfBusiness: string
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/new-request-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface NewRequestIF {
addressSuggestions: any[]
affiliationErrorModalValue: NrAffiliationErrors
allowAutoApprove: boolean
amalgamateNowError: boolean
analysisJSON: AnalysisJSONI
applicant: ApplicantI
assumedNameOriginal: string
Expand Down
Loading

0 comments on commit b08fc6c

Please sign in to comment.