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 webroot/src/components/LicenseCard/LicenseCard.less
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@
flex-direction: column;
width: 100%;

&:not(:last-child) {
&:first-child {
margin-bottom: 1.2rem;
}

Expand Down
75 changes: 62 additions & 13 deletions webroot/src/components/LicenseCard/LicenseCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -243,11 +251,17 @@ class LicenseCard extends mixins(MixinForm) {
}

get encumberDisciplineOptions(): Array<{ value: string, name: string | ComputedRef<string> }> {
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')),
Expand All @@ -257,10 +271,32 @@ class LicenseCard extends mixins(MixinForm) {
}

get npdbCategoryOptions(): Array<{ value: string, name: string | ComputedRef<string> }> {
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 {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -482,7 +524,8 @@ class LicenseCard extends mixins(MixinForm) {
currentCompactType: compactType,
licenseeId,
stateAbbrev,
licenseTypeAbbrev
licenseTypeAbbrev,
formData
} = this;

if (this.selectedInvestigation) {
Expand All @@ -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');
Expand All @@ -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;
Expand Down Expand Up @@ -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 });
Expand Down
9 changes: 8 additions & 1 deletion webroot/src/components/LicenseCard/LicenseCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,14 @@
<InputSelect :formInput="formData.encumberModalDisciplineAction" />
</div>
<div class="form-row">
<InputSelectMultiple :formInput="formData.encumberModalNpdbCategories" />
<InputSelectMultiple
v-if="shouldAllowNpdbMultiSelect"
:formInput="formData.encumberModalNpdbCategories"
/>
<InputSelect
v-else
:formInput="formData.encumberModalNpdbCategories"
/>
</div>
<div class="form-row">
<InputDate
Expand Down
2 changes: 1 addition & 1 deletion webroot/src/components/PrivilegeCard/PrivilegeCard.less
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
flex-direction: column;
width: 100%;

&:not(:last-child) {
&:first-child {
margin-bottom: 1.2rem;
}
Comment thread
jsandoval81 marked this conversation as resolved.

Expand Down
67 changes: 54 additions & 13 deletions webroot/src/components/PrivilegeCard/PrivilegeCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,17 @@ class PrivilegeCard extends mixins(MixinForm) {
}

get encumberDisciplineOptions(): Array<{ value: string, name: string | ComputedRef<string> }> {
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')),
Expand All @@ -237,10 +243,32 @@ class PrivilegeCard extends mixins(MixinForm) {
}

get npdbCategoryOptions(): Array<{ value: string, name: string | ComputedRef<string> }> {
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 {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -546,7 +580,8 @@ class PrivilegeCard extends mixins(MixinForm) {
currentCompactType: compactType,
licenseeId,
stateAbbrev,
privilegeTypeAbbrev
privilegeTypeAbbrev,
formData
} = this;

if (this.selectedInvestigation) {
Expand All @@ -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');
Expand All @@ -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;
Expand Down Expand Up @@ -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 });
Expand Down
11 changes: 9 additions & 2 deletions webroot/src/components/PrivilegeCard/PrivilegeCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<div class="info-item-title">{{$t('licensing.privilegeNumSymbol')}}</div>
<div class="info-item rr-block">{{privilegeId}}</div>
</div>
<div v-if="isAppModeJcc" class="info-item-container discipline-item">
<div v-if="isAppModeJcc || isCurrentUserPrivilegeAdmin" class="info-item-container discipline-item">
<div class="info-item-title">{{ $t('licensing.disciplineStatus') }}</div>
<div class="info-item">{{disciplineContent}}</div>
</div>
Expand Down Expand Up @@ -216,7 +216,14 @@
<InputSelect :formInput="formData.encumberModalDisciplineAction" />
</div>
<div class="form-row">
<InputSelectMultiple :formInput="formData.encumberModalNpdbCategories" />
<InputSelectMultiple
v-if="shouldAllowNpdbMultiSelect"
:formInput="formData.encumberModalNpdbCategories"
/>
<InputSelect
v-else
:formInput="formData.encumberModalNpdbCategories"
/>
</div>
<div class="form-row">
<InputDate
Expand Down
5 changes: 5 additions & 0 deletions webroot/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@
"encumber": "Encumber",
"encumbered": "Encumbered",
"encumberAction": "Disciplinary action",
"encumberBasisLabel": "Basis for action",
"npdbCategoryLabel": "Basis for action / NPDB category",
"encumberStartDate": "Start of encumbrance",
"confirmLicenseEncumberTitle": "Are you sure you want to encumber this license?",
Expand Down Expand Up @@ -931,6 +932,10 @@
"name": "Improper Supervision or Allowing Unlicensed Practice",
"key": "Improper Supervision or Allowing Unlicensed Practice"
},
{
"name": "Consumer harm",
"key": "Consumer Harm"
},
{
"name": "Other",
"key": "Other"
Expand Down
5 changes: 5 additions & 0 deletions webroot/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@
"encumber": "Cargar",
"encumbered": "Gravado",
"encumberAction": "Acción disciplinaria",
"encumberBasisLabel": "Base para la acción",
"npdbCategoryLabel": "Base para la acción / Categoría NPDB",
"encumberStartDate": "Inicio del gravamen",
"confirmLicenseEncumberTitle": "¿Estás seguro de que quieres gravar esta licencia?",
Expand Down Expand Up @@ -915,6 +916,10 @@
"name": "Supervisión inadecuada o autorización de prácticas sin licencia",
"key": "Improper Supervision or Allowing Unlicensed Practice"
},
{
"name": "Daños al consumidor",
"key": "Consumer Harm"
},
{
"name": "Otro",
"key": "Other"
Expand Down
1 change: 1 addition & 0 deletions webroot/src/network/mocks/mock.data.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ export class DataApi {
licenseState,
licenseType,
encumbranceType,
npdbCategory,
npdbCategories,
startDate
) {
Expand Down
Loading