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
166 changes: 166 additions & 0 deletions webroot/src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,172 @@ export const compacts = {
cosm: {},
};

export const getEncumberConfigLicense = (appMode: AppModes) => {
let disciplineTypes: Array<string> = [];
let npdbTypes: Array<string> = [];

switch (appMode) {
case AppModes.JCC:
disciplineTypes = [
'fine',
'reprimand',
'required supervision',
'completion of continuing education',
'public reprimand',
'probation',
'injunctive action',
'suspension',
'revocation',
'denial',
'surrender of license',
'modification of previous action-extension',
'modification of previous action-reduction',
'other monitoring',
'other adjudicated action not listed',
];
npdbTypes = [
'Non-compliance With Requirements',
'Criminal Conviction or Adjudication',
'Confidentiality, Consent or Disclosure Violations',
'Misconduct or Abuse',
'Fraud, Deception, or Misrepresentation',
'Unsafe Practice or Substandard Care',
'Improper Supervision or Allowing Unlicensed Practice',
'Other',
];
break;
case AppModes.COSMETOLOGY:
disciplineTypes = [
'suspension',
'revocation',
'surrender of license',
];
npdbTypes = [
'fraud',
'consumer harm',
'other',
];
break;
case AppModes.SOCIAL_WORK:
disciplineTypes = [
'fine',
'reprimand',
'required supervision',
'completion of continuing education',
'public reprimand',
'probation',
'injunctive action',
'suspension',
'revocation',
'denial',
'surrender of license',
'modification of previous action-extension',
'modification of previous action-reduction',
'other monitoring',
'other adjudicated action not listed',
];
npdbTypes = [
'Non-compliance With Requirements',
'Conflict of Interest',
'Substandard Care or Patient Neglect/Abuse',
'Criminal Conviction or Adjudication',
'Confidentiality, Consent or Disclosure Violations',
'Fraud, Deception, or Misrepresentation',
'Improper Supervision or Allowing Unlicensed Practice',
'Improper Prescribing, Dispensing, Administering Medication/Drug Violation',
'Other',
];
break;
default:
break;
}

return { disciplineTypes, npdbTypes };
};

export const getEncumberConfigPrivilege = (appMode: AppModes) => {
let disciplineTypes: Array<string> = [];
let npdbTypes: Array<string> = [];

switch (appMode) {
case AppModes.JCC:
disciplineTypes = [
'fine',
'reprimand',
'required supervision',
'completion of continuing education',
'public reprimand',
'probation',
'injunctive action',
'suspension',
'revocation',
'denial',
'surrender of privilege',
'modification of previous action-extension',
'modification of previous action-reduction',
'other monitoring',
'other adjudicated action not listed',
];
npdbTypes = [
'Non-compliance With Requirements',
'Criminal Conviction or Adjudication',
'Confidentiality, Consent or Disclosure Violations',
'Misconduct or Abuse',
'Fraud, Deception, or Misrepresentation',
'Unsafe Practice or Substandard Care',
'Improper Supervision or Allowing Unlicensed Practice',
'Other',
];
break;
case AppModes.COSMETOLOGY:
disciplineTypes = [
'suspension',
'revocation',
'surrender of privilege',
];
npdbTypes = [
'fraud',
'consumer harm',
'other',
];
break;
case AppModes.SOCIAL_WORK:
disciplineTypes = [
'fine',
'reprimand',
'required supervision',
'completion of continuing education',
'public reprimand',
'probation',
'injunctive action',
'suspension',
'revocation',
'denial',
'surrender of privilege',
'modification of previous action-extension',
'modification of previous action-reduction',
'other monitoring',
'other adjudicated action not listed',
];
npdbTypes = [
'Non-compliance With Requirements',
'Conflict of Interest',
'Substandard Care or Patient Neglect/Abuse',
'Criminal Conviction or Adjudication',
'Confidentiality, Consent or Disclosure Violations',
'Fraud, Deception, or Misrepresentation',
'Improper Supervision or Allowing Unlicensed Practice',
'Improper Prescribing, Dispensing, Administering Medication/Drug Violation',
'Other',
];
break;
default:
break;
}

return { disciplineTypes, npdbTypes };
};

// =============================
// = Feature gate IDs =
// =============================
Expand Down
78 changes: 78 additions & 0 deletions webroot/src/components/LicenseCard/LicenseCard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { expect } from 'chai';
import { mountShallow } from '@tests/helpers/setup';
import LicenseCard from '@components/LicenseCard/LicenseCard.vue';
import { AppModes, getEncumberConfigLicense } from '@/app.config';

describe('LicenseCard component', async () => {
it('should mount the component', async () => {
Expand All @@ -16,4 +17,81 @@ describe('LicenseCard component', async () => {
expect(wrapper.exists()).to.equal(true);
expect(wrapper.findComponent(LicenseCard).exists()).to.equal(true);
});
it('should successfully return expected encumber config for license (jcc)', async () => {
const config = getEncumberConfigLicense(AppModes.JCC);

expect(config.disciplineTypes).to.eql([
'fine',
'reprimand',
'required supervision',
'completion of continuing education',
'public reprimand',
'probation',
'injunctive action',
'suspension',
'revocation',
'denial',
'surrender of license',
'modification of previous action-extension',
'modification of previous action-reduction',
'other monitoring',
'other adjudicated action not listed',
]);
expect(config.npdbTypes).to.eql([
'Non-compliance With Requirements',
'Criminal Conviction or Adjudication',
'Confidentiality, Consent or Disclosure Violations',
'Misconduct or Abuse',
'Fraud, Deception, or Misrepresentation',
'Unsafe Practice or Substandard Care',
'Improper Supervision or Allowing Unlicensed Practice',
'Other',
]);
});
it('should successfully return expected encumber config for license (cosmetology)', async () => {
const config = getEncumberConfigLicense(AppModes.COSMETOLOGY);

expect(config.disciplineTypes).to.eql([
'suspension',
'revocation',
'surrender of license',
]);
expect(config.npdbTypes).to.eql([
'fraud',
'consumer harm',
'other',
]);
});
it('should successfully return expected encumber config for license (social-work)', async () => {
const config = getEncumberConfigLicense(AppModes.SOCIAL_WORK);

expect(config.disciplineTypes).to.eql([
'fine',
'reprimand',
'required supervision',
'completion of continuing education',
'public reprimand',
'probation',
'injunctive action',
'suspension',
'revocation',
'denial',
'surrender of license',
'modification of previous action-extension',
'modification of previous action-reduction',
'other monitoring',
'other adjudicated action not listed',
]);
expect(config.npdbTypes).to.eql([
'Non-compliance With Requirements',
'Conflict of Interest',
'Substandard Care or Patient Neglect/Abuse',
'Criminal Conviction or Adjudication',
'Confidentiality, Consent or Disclosure Violations',
'Fraud, Deception, or Misrepresentation',
'Improper Supervision or Allowing Unlicensed Practice',
'Improper Prescribing, Dispensing, Administering Medication/Drug Violation',
'Other',
]);
});
});
59 changes: 14 additions & 45 deletions webroot/src/components/LicenseCard/LicenseCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
ComputedRef,
nextTick
} from 'vue';
import { dateFormatPatterns } from '@/app.config';
import { dateFormatPatterns, AppModes, getEncumberConfigLicense } from '@/app.config';
import MixinForm from '@components/Forms/_mixins/form.mixin';
import InputDate from '@components/Forms/InputDate/InputDate.vue';
import InputSelect from '@components/Forms/InputSelect/InputSelect.vue';
Expand Down Expand Up @@ -108,6 +108,10 @@ class LicenseCard extends mixins(MixinForm) {
return this.$store.state.user;
}

get appMode(): AppModes {
return this.$store.state.appMode;
}

get isAppModeJcc(): boolean {
return this.$store.getters.isAppModeJcc;
}
Expand Down Expand Up @@ -284,21 +288,13 @@ class LicenseCard extends mixins(MixinForm) {
}

get encumberDisciplineOptions(): Array<{ value: string, name: string | ComputedRef<string> }> {
let options = this.$tm('licensing.disciplineTypes').map((disciplineType) => ({
const includeList: Array<string> = getEncumberConfigLicense(this.appMode).disciplineTypes;
const options = this.$tm('licensing.disciplineTypes').map((disciplineType) => ({
value: disciplineType.key,
name: disciplineType.name,
}));

if (this.isAppModeCosmetology || this.isAppModeSocialWork) {
const includeList = ['suspension', 'revocation', 'surrender of license'];

options = options.filter((option) => includeList.includes(option.value));
} else {
const excludeList = ['surrender of privilege'];

options = options.filter((option) => !excludeList.includes(option.value));
}
})).filter((option) => includeList.includes(option.value) || option.value === '');

// For a single-select, include the blank option
options.unshift({
value: '',
name: computed(() => this.$t('common.selectOption')),
Expand All @@ -308,49 +304,22 @@ class LicenseCard extends mixins(MixinForm) {
}

get npdbCategoryOptions(): Array<{ value: string, name: string | ComputedRef<string> }> {
const { isAppModeJcc, isAppModeCosmetology, isAppModeSocialWork } = this;
const includeList: Array<string> = [];
let isMultiSelect = true;
let options = this.$tm('licensing.npdbTypes').map((npdbType) => ({
const includeList: Array<string> = getEncumberConfigLicense(this.appMode).npdbTypes;
const options = this.$tm('licensing.npdbTypes').map((npdbType) => ({
value: npdbType.key,
name: npdbType.name,
}));

// Define the included keys per compact
if (isAppModeJcc) {
includeList.push('Non-compliance With Requirements');
includeList.push('Criminal Conviction or Adjudication');
includeList.push('Confidentiality, Consent or Disclosure Violations');
includeList.push('Misconduct or Abuse');
includeList.push('Fraud, Deception, or Misrepresentation');
includeList.push('Unsafe Practice or Substandard Care');
includeList.push('Improper Supervision or Allowing Unlicensed Practice');
includeList.push('Other');
} else if (isAppModeCosmetology) {
isMultiSelect = false;
includeList.push('fraud');
includeList.push('consumer harm');
includeList.push('other');
} else if (isAppModeSocialWork) {
isMultiSelect = false;
includeList.push('fraud');
includeList.push('consumer harm');
includeList.push('other');
}

// Filter the compact-specific options
options = options.filter((option) => includeList.includes(option.value) || option.value === '');
})).filter((option) => includeList.includes(option.value) || option.value === '');

// For a single-select, include the blank option
if (!isMultiSelect) {
if (!this.shouldAllowNpdbMultiSelect) {
options.unshift({ value: '', name: computed(() => this.$t('common.selectOption')) });
}

return options;
}

get shouldAllowNpdbMultiSelect(): boolean {
return this.isAppModeJcc;
return this.isAppModeJcc || this.isAppModeSocialWork;
}

get endInvestigationModalTitle(): string {
Expand Down
Loading
Loading