diff --git a/webroot/src/components/LicenseCard/LicenseCard.less b/webroot/src/components/LicenseCard/LicenseCard.less index 3e19bdecf..dc84a28fa 100644 --- a/webroot/src/components/LicenseCard/LicenseCard.less +++ b/webroot/src/components/LicenseCard/LicenseCard.less @@ -377,7 +377,7 @@ flex-direction: column; width: 100%; - &:not(:last-child) { + &:first-child { margin-bottom: 1.2rem; } diff --git a/webroot/src/components/LicenseCard/LicenseCard.ts b/webroot/src/components/LicenseCard/LicenseCard.ts index 07807a013..a01799d22 100644 --- a/webroot/src/components/LicenseCard/LicenseCard.ts +++ b/webroot/src/components/LicenseCard/LicenseCard.ts @@ -103,6 +103,14 @@ class LicenseCard extends mixins(MixinForm) { return this.$store.state.user; } + get isAppModeJcc(): boolean { + return this.$store.getters.isAppModeJcc; + } + + get isAppModeCosmetology(): boolean { + return this.$store.getters.isAppModeCosmetology; + } + get currentUser(): StaffUser { return this.userStore.model; } @@ -243,11 +251,17 @@ class LicenseCard extends mixins(MixinForm) { } get encumberDisciplineOptions(): Array<{ value: string, name: string | ComputedRef }> { - const options = this.$tm('licensing.disciplineTypes').map((disciplineType) => ({ + let options = this.$tm('licensing.disciplineTypes').map((disciplineType) => ({ value: disciplineType.key, name: disciplineType.name, })); + if (this.isAppModeCosmetology) { + const includeList = ['suspension', 'revocation', 'surrender of license']; + + options = options.filter((option) => includeList.includes(option.value)); + } + options.unshift({ value: '', name: computed(() => this.$t('common.selectOption')), @@ -257,10 +271,32 @@ class LicenseCard extends mixins(MixinForm) { } get npdbCategoryOptions(): Array<{ value: string, name: string | ComputedRef }> { - return this.$tm('licensing.npdbTypes').map((npdbType) => ({ + const { isAppModeJcc, isAppModeCosmetology } = this; + let options = this.$tm('licensing.npdbTypes').map((npdbType) => ({ value: npdbType.key, name: npdbType.name, })); + + if (isAppModeJcc) { + const excludeList = ['Consumer Harm']; + + options = options.filter((option) => !excludeList.includes(option.value)); + } else if (isAppModeCosmetology) { + const includeList = ['Fraud, Deception, or Misrepresentation', 'Consumer Harm', 'Other']; + + options = options.filter((option) => includeList.includes(option.value)); + + options.unshift({ + value: '', + name: computed(() => this.$t('common.selectOption')), + }); + } + + return options; + } + + get shouldAllowNpdbMultiSelect(): boolean { + return this.isAppModeJcc; } get endInvestigationModalTitle(): string { @@ -314,10 +350,16 @@ class LicenseCard extends mixins(MixinForm) { encumberModalNpdbCategories: new FormInput({ id: 'npdb-categories', name: 'npdb-categories', - label: computed(() => this.$t('licensing.npdbCategoryLabel')), - validation: Joi.array().min(1).messages(this.joiMessages.array), + label: (this.shouldAllowNpdbMultiSelect) + ? computed(() => this.$t('licensing.npdbCategoryLabel')) + : computed(() => this.$t('licensing.encumberBasisLabel')), + validation: (this.shouldAllowNpdbMultiSelect) + ? Joi.array().min(1).messages(this.joiMessages.array) + : Joi.string().required().messages(this.joiMessages.string), valueOptions: this.npdbCategoryOptions, - value: [], + value: (this.shouldAllowNpdbMultiSelect) + ? [] + : '', }), encumberModalStartDate: new FormInput({ id: 'encumber-start', @@ -482,7 +524,8 @@ class LicenseCard extends mixins(MixinForm) { currentCompactType: compactType, licenseeId, stateAbbrev, - licenseTypeAbbrev + licenseTypeAbbrev, + formData } = this; if (this.selectedInvestigation) { @@ -496,9 +539,11 @@ class LicenseCard extends mixins(MixinForm) { licenseType: licenseTypeAbbrev.toLowerCase(), investigationId, encumbrance: { - encumbranceType: this.formData.encumberModalDisciplineAction.value, - npdbCategories: this.formData.encumberModalNpdbCategories.value, - startDate: this.formData.encumberModalStartDate.value, + encumbranceType: formData.encumberModalDisciplineAction.value, + npdbCategories: (Array.isArray(formData.encumberModalNpdbCategories.value)) + ? formData.encumberModalNpdbCategories.value + : [formData.encumberModalNpdbCategories.value], + startDate: formData.encumberModalStartDate.value, }, }).catch((err) => { this.modalErrorMessage = err?.message || this.$t('common.error'); @@ -511,9 +556,11 @@ class LicenseCard extends mixins(MixinForm) { licenseeId, licenseState: stateAbbrev, licenseType: licenseTypeAbbrev.toLowerCase(), - encumbranceType: this.formData.encumberModalDisciplineAction.value, - npdbCategories: this.formData.encumberModalNpdbCategories.value, - startDate: this.formData.encumberModalStartDate.value, + encumbranceType: formData.encumberModalDisciplineAction.value, + npdbCategories: (Array.isArray(formData.encumberModalNpdbCategories.value)) + ? formData.encumberModalNpdbCategories.value + : [formData.encumberModalNpdbCategories.value], + startDate: formData.encumberModalStartDate.value, }).catch((err) => { this.modalErrorMessage = err?.message || this.$t('common.error'); this.isFormError = true; @@ -952,7 +999,9 @@ class LicenseCard extends mixins(MixinForm) { this.validateAll({ asTouched: true }); } else if (this.isEncumberLicenseModalDisplayed) { this.formData.encumberModalDisciplineAction.value = this.encumberDisciplineOptions[1]?.value; - this.formData.encumberModalNpdbCategories.value = [this.npdbCategoryOptions[1]?.value]; + this.formData.encumberModalNpdbCategories.value = (this.shouldAllowNpdbMultiSelect) + ? [this.npdbCategoryOptions[1]?.value] + : this.npdbCategoryOptions[1]?.value; this.formData.encumberModalStartDate.value = moment().format('YYYY-MM-DD'); await nextTick(); this.validateAll({ asTouched: true }); diff --git a/webroot/src/components/LicenseCard/LicenseCard.vue b/webroot/src/components/LicenseCard/LicenseCard.vue index 1f415d33f..501f9c5a7 100644 --- a/webroot/src/components/LicenseCard/LicenseCard.vue +++ b/webroot/src/components/LicenseCard/LicenseCard.vue @@ -155,7 +155,14 @@
- + +
}> { - const options = this.$tm('licensing.disciplineTypes').map((disciplineType) => ({ + let options = this.$tm('licensing.disciplineTypes').map((disciplineType) => ({ value: disciplineType.key, name: disciplineType.name, })); + if (this.isAppModeCosmetology) { + const includeList = ['suspension', 'revocation', 'surrender of license']; + + options = options.filter((option) => includeList.includes(option.value)); + } + options.unshift({ value: '', name: computed(() => this.$t('common.selectOption')), @@ -237,10 +243,32 @@ class PrivilegeCard extends mixins(MixinForm) { } get npdbCategoryOptions(): Array<{ value: string, name: string | ComputedRef }> { - return this.$tm('licensing.npdbTypes').map((npdbType) => ({ + const { isAppModeJcc, isAppModeCosmetology } = this; + let options = this.$tm('licensing.npdbTypes').map((npdbType) => ({ value: npdbType.key, name: npdbType.name, })); + + if (isAppModeJcc) { + const excludeList = ['Consumer Harm']; + + options = options.filter((option) => !excludeList.includes(option.value)); + } else if (isAppModeCosmetology) { + const includeList = ['Fraud, Deception, or Misrepresentation', 'Consumer Harm', 'Other']; + + options = options.filter((option) => includeList.includes(option.value)); + + options.unshift({ + value: '', + name: computed(() => this.$t('common.selectOption')), + }); + } + + return options; + } + + get shouldAllowNpdbMultiSelect(): boolean { + return this.isAppModeJcc; } get endInvestigationModalTitle(): string { @@ -314,10 +342,16 @@ class PrivilegeCard extends mixins(MixinForm) { encumberModalNpdbCategories: new FormInput({ id: 'npdb-categories', name: 'npdb-categories', - label: computed(() => this.$t('licensing.npdbCategoryLabel')), - validation: Joi.array().min(1).messages(this.joiMessages.array), + label: (this.shouldAllowNpdbMultiSelect) + ? computed(() => this.$t('licensing.npdbCategoryLabel')) + : computed(() => this.$t('licensing.encumberBasisLabel')), + validation: (this.shouldAllowNpdbMultiSelect) + ? Joi.array().min(1).messages(this.joiMessages.array) + : Joi.string().required().messages(this.joiMessages.string), valueOptions: this.npdbCategoryOptions, - value: [], + value: (this.shouldAllowNpdbMultiSelect) + ? [] + : '', }), encumberModalStartDate: new FormInput({ id: 'encumber-start', @@ -546,7 +580,8 @@ class PrivilegeCard extends mixins(MixinForm) { currentCompactType: compactType, licenseeId, stateAbbrev, - privilegeTypeAbbrev + privilegeTypeAbbrev, + formData } = this; if (this.selectedInvestigation) { @@ -560,9 +595,11 @@ class PrivilegeCard extends mixins(MixinForm) { licenseType: privilegeTypeAbbrev.toLowerCase(), investigationId, encumbrance: { - encumbranceType: this.formData.encumberModalDisciplineAction.value, - npdbCategories: this.formData.encumberModalNpdbCategories.value, - startDate: this.formData.encumberModalStartDate.value, + encumbranceType: formData.encumberModalDisciplineAction.value, + npdbCategories: (Array.isArray(formData.encumberModalNpdbCategories.value)) + ? formData.encumberModalNpdbCategories.value + : [formData.encumberModalNpdbCategories.value], + startDate: formData.encumberModalStartDate.value, }, }).catch((err) => { this.modalErrorMessage = err?.message || this.$t('common.error'); @@ -575,9 +612,11 @@ class PrivilegeCard extends mixins(MixinForm) { licenseeId, privilegeState: stateAbbrev, licenseType: privilegeTypeAbbrev.toLowerCase(), - encumbranceType: this.formData.encumberModalDisciplineAction.value, - npdbCategories: this.formData.encumberModalNpdbCategories.value, - startDate: this.formData.encumberModalStartDate.value, + encumbranceType: formData.encumberModalDisciplineAction.value, + npdbCategories: (Array.isArray(formData.encumberModalNpdbCategories.value)) + ? formData.encumberModalNpdbCategories.value + : [formData.encumberModalNpdbCategories.value], + startDate: formData.encumberModalStartDate.value, }).catch((err) => { this.modalErrorMessage = err?.message || this.$t('common.error'); this.isFormError = true; @@ -1015,7 +1054,9 @@ class PrivilegeCard extends mixins(MixinForm) { this.validateAll({ asTouched: true }); } else if (this.isEncumberPrivilegeModalDisplayed) { this.formData.encumberModalDisciplineAction.value = this.encumberDisciplineOptions[1]?.value; - this.formData.encumberModalNpdbCategories.value = [this.npdbCategoryOptions[1]?.value]; + this.formData.encumberModalNpdbCategories.value = (this.shouldAllowNpdbMultiSelect) + ? [this.npdbCategoryOptions[1]?.value] + : this.npdbCategoryOptions[1]?.value; this.formData.encumberModalStartDate.value = moment().format('YYYY-MM-DD'); await nextTick(); this.validateAll({ asTouched: true }); diff --git a/webroot/src/components/PrivilegeCard/PrivilegeCard.vue b/webroot/src/components/PrivilegeCard/PrivilegeCard.vue index 529035a05..1d8805eaf 100644 --- a/webroot/src/components/PrivilegeCard/PrivilegeCard.vue +++ b/webroot/src/components/PrivilegeCard/PrivilegeCard.vue @@ -101,7 +101,7 @@
{{$t('licensing.privilegeNumSymbol')}}
{{privilegeId}}
-
+
{{ $t('licensing.disciplineStatus') }}
{{disciplineContent}}
@@ -216,7 +216,14 @@
- + +