Skip to content

Commit

Permalink
16638 & 16639 Created new BulletsColinLink component + implemented ne…
Browse files Browse the repository at this point in the history
…w registration wireframes (bcgov#620)

* 16638 & 16639 Created new component that either links to colin or dashboard + other changes

* Fixed styling + rearranged after rebasing

* Fixed spacing

* removed unnecessary emitter

* Added comment in template

* Update in response to Sev's comments before rebasing

* Update after rebase - redirect to dashboard after login + cleanup

* Third update in response to Sev's comments

* added extra line (lint fix)

* Updated the incorporate now error dialog + removed code from signin

* Remove session storage legal_type variable when user closes error dialog

* Made incorporate now error dialog naive and some cleanup

* Moved incorporate now error status to the store

* removed useless variable

* alternate cleaner syntax

* updated package version after rebase
  • Loading branch information
JazzarKarim committed Aug 24, 2023
1 parent f11e203 commit 4d0ce2c
Show file tree
Hide file tree
Showing 19 changed files with 454 additions and 47 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "name-request",
"version": "5.0.5",
"version": "5.0.6",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
34 changes: 31 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<ExitDialog />
<ExitIncompletePaymentDialog />
<HelpMeChooseDialog />
<IncorporateNowErrorDialog
attach="#app"
:dialog="getIncorporateNowErrorStatus"
@close="closeIncorporateNowErrorDialog()"
/>
<LocationInfoDialog />
<MrasSearchInfoDialog />
<NrNotRequiredDialog />
Expand Down Expand Up @@ -108,9 +113,9 @@ import GenesysWebMessage from '@bcrs-shared-components/genesys-web-message/Genes
import { WebChat as ChatPopup } from '@bcrs-shared-components/web-chat'
import {
AffiliationErrorDialog, CancelDialog, ConditionsDialog, ErrorDialog, ExitDialog, HelpMeChooseDialog,
LocationInfoDialog, MrasSearchInfoDialog, NrNotRequiredDialog, ConfirmNrDialog, PaymentCompleteDialog,
PickEntityOrConversionDialog, PickRequestTypeDialog, RenewDialog, ReceiptsDialog, RefundDialog,
ResubmitDialog, RetryDialog, StaffPaymentErrorDialog, UpgradeDialog, ExitIncompletePaymentDialog
IncorporateNowErrorDialog, LocationInfoDialog, MrasSearchInfoDialog, NrNotRequiredDialog, ConfirmNrDialog,
PaymentCompleteDialog, PickEntityOrConversionDialog, PickRequestTypeDialog, RenewDialog, ReceiptsDialog,
RefundDialog, ResubmitDialog, RetryDialog, StaffPaymentErrorDialog, UpgradeDialog, ExitIncompletePaymentDialog
} from '@/components/dialogs'
import SbcHeader from 'sbc-common-components/src/components/SbcHeader.vue'
import SbcFooter from 'sbc-common-components/src/components/SbcFooter.vue'
Expand All @@ -119,6 +124,7 @@ import SbcFooter from 'sbc-common-components/src/components/SbcFooter.vue'
import { ActionBindingIF } from '@/interfaces/store-interfaces'
import NamexServices from './services/namex-services'
import { PAYMENT_REQUIRED } from 'http-status-codes'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
@Component({
components: {
Expand All @@ -133,6 +139,7 @@ import { PAYMENT_REQUIRED } from 'http-status-codes'
ExitIncompletePaymentDialog,
GenesysWebMessage,
HelpMeChooseDialog,
IncorporateNowErrorDialog,
LocationInfoDialog,
MrasSearchInfoDialog,
NrNotRequiredDialog,
Expand All @@ -155,6 +162,7 @@ export default class App extends Mixins(
) {
// Global getters
@Getter getDisplayedComponent!: string
@Getter getIncorporateNowErrorStatus!: boolean
@Getter getNrId!: number
@Getter isRoleStaff: boolean
@Getter isMobile!: boolean
Expand All @@ -165,6 +173,7 @@ export default class App extends Mixins(
@Action setDisplayedComponent!: ActionBindingIF
@Action toggleConfirmNrModal!: ActionBindingIF
@Action setCurrentJsDate!: ActionBindingIF
@Action setIncorporateNowErrorStatus!: ActionBindingIF
@Action setWindowWidth!: ActionBindingIF
readonly axios = axios
Expand Down Expand Up @@ -248,6 +257,19 @@ export default class App extends Mixins(
sessionStorage.removeItem('NR_DATA')
}
// if there is stored legal type for an IA then incorporate it now
const legaltype = sessionStorage.getItem('LEGAL_TYPE')
if (legaltype) {
try {
await this.incorporateNow(legaltype as CorpTypeCd)
// clear the legal type data
sessionStorage.removeItem('LEGAL_TYPE')
} catch (error) {
this.setIncorporateNowErrorStatus(true)
console.error(error)
}
}
// listen for save error events
this.$root.$on('save-error-event', (error: any) => {
// save errors/warnings
Expand Down Expand Up @@ -309,6 +331,12 @@ export default class App extends Mixins(
get enableGenesysWebMessage (): boolean {
return !!GetFeatureFlag('enable-genesys-web-message')
}
/** Close IncorporateNowErrorDialog and clear session storage. */
closeIncorporateNowErrorDialog (): void {
sessionStorage.removeItem('LEGAL_TYPE')
this.setIncorporateNowErrorStatus(false)
}
}
</script>

Expand Down
173 changes: 173 additions & 0 deletions src/components/common/bullets-colin-link.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<template>
<v-row id="bullets-colin-link">
<v-col cols="12" sm="3">
<v-radio-group
v-model="selectedCompanyType"
flat
mandatory
@change="radioButtonChanged(selectedCompanyType)"
>
<v-radio id="named-company-radio"
class="mb-0 pb-4"
label="Named Company"
:value="CompanyType.NAMED_COMPANY"
/>
<v-radio id="numbered-company-radio"
label="Numbered Company"
:value="CompanyType.NUMBERED_COMPANY"
/>
</v-radio-group>
</v-col>
<v-col cols="12" sm="9">
<div v-if="selectedCompanyType === CompanyType.NAMED_COMPANY">
<v-row>
<slot name="name-input-slot">Name Input</slot>
<template v-if="showDesignation">
<slot name="designation">Designation</slot>
</template>
</v-row>
</div>
<div v-else>
<ul class="bullet-points">
<li v-for="bulletPoint in bulletPoints" :key="bulletPoint">
{{ bulletPoint }}
</li>
</ul>
<div class="btn-spacing" v-if="colinButton">
<v-btn class="px-9" :href="colinLink" target="_blank">
Go to Corporate Online to Register <v-icon small class="ml-1">mdi-open-in-new</v-icon>
</v-btn>
</div>
<div class="btn-spacing" v-else>
<v-btn
class="px-9"
id="incorporate-now-button"
@click="incorporateNowClicked()"
>
Incorporate Now
</v-btn>
</div>
</div>
</v-col>
</v-row>
</template>

<script lang="ts">
import { Component, Emit, Mixins, Prop } from 'vue-property-decorator'
import { Getter } from 'vuex-class'
import { CompanyType, EntityType } from '@/enums'
import NameInput from '@/components/new-request/name-input.vue'
import { Navigate } from '@/plugins'
import { NrAffiliationMixin } from '@/mixins'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
@Component({
components: {
NameInput
}
})
export default class BulletsColinLink extends Mixins(NrAffiliationMixin) {
/** The selected business type. */
@Prop({ default: '' }) readonly businessType!: EntityType
/** Show Colin Button. */
@Prop({ default: false }) readonly colinButton!: boolean
/** Show Designation Dropdown. */
@Prop({ default: false }) readonly showDesignation!: boolean
/** Whether user is authenticated. */
@Getter getIsAuthenticated!: boolean
// Local properties
selectedCompanyType: CompanyType = null
bulletPoints = [
'Your business name will be the Incorporation Number assinged by the Registry.',
'You can change your business name at a later date.',
'It is not possible to request a specific Incorporation Number.'
]
readonly colinLink = sessionStorage.getItem('CORPORATE_ONLINE_URL')
// For template
readonly CompanyType = CompanyType
/**
* The alternate codes for entity types.
* Alternate codes are used in Entities UIs.
*/
entityTypeAlternateCode (entityType: EntityType): CorpTypeCd {
switch (entityType) {
case EntityType.BC: return CorpTypeCd.BENEFIT_COMPANY
case EntityType.CC: return CorpTypeCd.BC_CCC
case EntityType.CR: return CorpTypeCd.BC_COMPANY
case EntityType.UL: return CorpTypeCd.BC_ULC_COMPANY
default: return null
}
}
/** Navigate to the Entity Dashboard. */
goToEntityDashboard (businessId: string): void {
if (businessId) {
const dashboardUrl = sessionStorage.getItem('DASHBOARD_URL')
Navigate(`${dashboardUrl}${businessId}`)
}
}
/**
* If user is authenticated, create draft business and redirect to Dashboard.
* If user is not authenticated, redirect to login screen then redirect back.
*/
async incorporateNowClicked () {
const legalType = this.entityTypeAlternateCode(this.businessType)
if (this.getIsAuthenticated) {
await this.incorporateNow(legalType)
} else {
// persist legal type of incorporate now in session upon authentication via Signin component
sessionStorage.setItem('LEGAL_TYPE', legalType)
// navigate to BC Registry login page with return parameter
const registryHomeUrl = sessionStorage.getItem('REGISTRY_HOME_URL')
const nameRequestUrl = `${window.location.origin}`
Navigate(`${registryHomeUrl}login?return=${nameRequestUrl}`)
}
}
/** Emit the selected radio button CompanyType enum value. */
@Emit('radioButtonChange')
radioButtonChanged (event: CompanyType): void {}
}
</script>

<style lang="scss" scoped>
@import '@/assets/styles/theme.scss';
// Radio button group spacing
.v-input--selection-controls {
padding-top: 0rem;
margin-top: 0rem;
}
// Remove background color from radio button group
.v-input__slot, .v-input--selection-controls .v-radio {
background-color: white;
font-weight: bold;
}
// Line spacing between bullet points and sizing
.bullet-points {
font-size: 0.875rem;
margin-top: -0.75rem;
line-height: 2rem;
}
// Font weight + size of button. This is done to stay consistent with "Check this Name" Button.
.v-btn {
font-weight: bold;
min-height: 45px;
padding-left: 4rem;
}
// Button Spacing. This is done to stay consistent with "Check this Name" Button.
.btn-spacing {
margin-top: 1rem;
padding-left: 8rem;
}
</style>
1 change: 1 addition & 0 deletions src/components/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { default as AppTitleCols } from './app-title-cols.vue'
export { Breadcrumb } from '@bcrs-shared-components/breadcrumb'
export { default as BulletsColinLink } from './bullets-colin-link.vue'
75 changes: 75 additions & 0 deletions src/components/dialogs/incorporate-now-error.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<v-dialog v-model="dialog" width="45rem" persistent :attach="attach">
<v-card>
<v-card-title id="dialog-title">Unable to Incorporate Now</v-card-title>

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

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

<v-card-actions>
<v-spacer></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 IncorporateNowErrorDialog 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: 1.125rem;
font-weight: bold;
margin: 0;
}
.v-card__text {
padding: 1.5rem !important;
font-weight: 300;
color: $gray7 !important;
font-size: 1rem;
}
.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
Expand Up @@ -6,6 +6,7 @@ export { default as ErrorDialog } from './error.vue'
export { default as ExitDialog } from './exit.vue'
export { default as ExitIncompletePaymentDialog } from './exit-incomplete-payment.vue'
export { default as HelpMeChooseDialog } from './help-me-choose.vue'
export { default as IncorporateNowErrorDialog } from './incorporate-now-error.vue'
export { default as LocationInfoDialog } from './location-info.vue'
export { default as MrasSearchInfoDialog } from './mras-search-info.vue'
export { default as NrNotRequiredDialog } from './nr-not-required.vue'
Expand Down
2 changes: 1 addition & 1 deletion src/components/new-request/name-check/name-check.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<v-col v-if="showDesignationSelect" :class="{'pl-3': !isMobile}" cols="12" lg="3">
<v-select filled
:items="designationOptions"
label="Select a Designation"
label="Enter designation"
style="line-height: 20px;"
v-model="designation">
</v-select>
Expand Down
2 changes: 1 addition & 1 deletion src/components/new-request/name-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class NameInput extends Vue {
return 'Business\'s full legal name in home jurisdiction'
}
return 'Enter a Name'
return 'Enter a name to request'
}
clearErrors () {
Expand Down
Loading

0 comments on commit 4d0ce2c

Please sign in to comment.