Skip to content
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
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "name-request",
"version": "5.8.5",
"version": "5.8.6",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
8 changes: 8 additions & 0 deletions app/src/components/dialogs/mras-search-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<div class="mt-1 mb-1 text-center">
<v-btn
class="search-btn"
:disabled="isDisabled"
@click="isNameSearch ? handleSubmit() : clearAndClose()"
>
{{ name ? 'Search' : 'Close' }}
Expand All @@ -50,6 +51,7 @@ import { Component, Vue } from 'vue-property-decorator'
import { Action, Getter } from 'pinia-class'
import { useStore } from '@/store'
import { ActionBindingIF } from '@/interfaces/store-interfaces'
import { MRAS_MIN_LENGTH, MRAS_MAX_LENGTH } from '@/components/new-request/constants'
import NameInput from '@/components/new-request/name-input.vue'
import { BAD_REQUEST, NOT_FOUND, SERVICE_UNAVAILABLE } from 'http-status-codes'

Expand All @@ -64,6 +66,7 @@ export default class MrasSearchInfoDialog extends Vue {
@Getter(useStore) getMrasSearchResultCode!: number
@Getter(useStore) getName!: string
@Getter(useStore) getMrasSearchInfoModalVisible!: boolean
@Getter(useStore) isXproFlow!: boolean

@Action(useStore) setMrasSearchInfoModalVisible!: ActionBindingIF
@Action(useStore) setName!: ActionBindingIF
Expand Down Expand Up @@ -125,6 +128,11 @@ export default class MrasSearchInfoDialog extends Vue {
return this.getErrors
}

get isDisabled (): boolean {
return !!this.name && this.isXproFlow &&
(!this.name || this.name.length < MRAS_MIN_LENGTH || this.name.length > MRAS_MAX_LENGTH)
}

async handleSubmit (): Promise<void> {
this.showModal = false
if (this.name) await this.startAnalyzeName(null)
Expand Down
28 changes: 26 additions & 2 deletions app/src/components/new-request/name-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:error-messages="message"
autocomplete="chrome-off"
:filled="!isReadOnly"
:rules="(searchValue && isMrasSearch) ? mrasRules : defaultRules"
:rules="getRules"
:label="label"
:class="{ 'read-only-mode': isReadOnly }"
:disabled="isReadOnly"
Expand Down Expand Up @@ -66,6 +66,18 @@ export default class NameInput extends Vue {
this.nameInputComponent = this.$refs['nameInputRef']
}

get getRules (): any[] {
if (this.searchValue) {
if (this.isMrasSearch) {
return this.mrasRules
}
if (this.isXproFlow) {
return this.xproRules
}
}
return this.defaultRules
}

/** The array of validation rules for the MRAS corp num. */
get mrasRules (): any[] {
return [
Expand All @@ -75,6 +87,13 @@ export default class NameInput extends Vue {
]
}

get xproRules (): any[] {
return [
v => (!v || v.length >= MRAS_MIN_LENGTH) || `Must be at least ${MRAS_MIN_LENGTH} characters`,
v => (!v || v.length <= MRAS_MAX_LENGTH) || `Cannot exceed ${MRAS_MAX_LENGTH} characters`
]
}

/** Local validator when input is a MRAS corp num. */
get isCorpNumValid (): boolean {
if (this.isMrasSearch) return this.nameInputComponent?.valid || false
Expand Down Expand Up @@ -114,7 +133,12 @@ export default class NameInput extends Vue {
}

if (this.getErrors.includes('max_length')) {
return ['Please enter a shorter name']
let maxCharacters = DFLT_MAX_LENGTH
if (this.isXproFlow) {
maxCharacters = MRAS_MAX_LENGTH
}

return [`Cannot exceed ${maxCharacters} characters`]
}

const invalidDesignationMsg = checkInvalidDesignation(this.getEntityTypeCd, this.searchValue)
Expand Down
14 changes: 13 additions & 1 deletion app/src/components/new-request/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@
id="search-name-btn"
class="px-9"
:class="{ 'mobile-btn' : isMobile }"
:disabled="!corpNumValid"
:disabled="isSearchBtnDisabled"
@click="handleSubmit(true)"
>
<v-icon
Expand Down Expand Up @@ -424,6 +424,8 @@ import { Navigate } from '@/plugins'
import { ActionBindingIF } from '@/interfaces/store-interfaces'
import { Action, Getter } from 'pinia-class'
import { useStore } from '@/store'
import { MRAS_MIN_LENGTH, MRAS_MAX_LENGTH }
from '@/components/new-request/constants'

/**
* This is the component that displays the new NR menus and flows.
Expand All @@ -450,6 +452,7 @@ export default class Search extends Mixins(CommonMixin, NrAffiliationMixin, Sear
@Getter(useStore) getIsLearBusiness!: boolean
// @Getter(useStore) isRoleStaff!: boolean
@Getter(useStore) getAuthorizedActions!: string[]
@Getter(useStore) getName!: string

// Constant
readonly colinLink = sessionStorage.getItem('CORPORATE_ONLINE_URL')
Expand Down Expand Up @@ -756,6 +759,15 @@ export default class Search extends Mixins(CommonMixin, NrAffiliationMixin, Sear
return false
}

get isValidXproName (): boolean {
const name = this.getName
return name.length >= MRAS_MIN_LENGTH && name.length <= MRAS_MAX_LENGTH
}

get isSearchBtnDisabled (): boolean {
return (this.getHasNoCorpNum && !this.isValidXproName) || (!this.getHasNoCorpNum && !this.corpNumValid)
}

/**
* If user is authenticated, create draft business and redirect to Dashboard.
* If restoration/reinstatement selected, go to business dashboard.
Expand Down
Loading