Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
.form-section-title {
margin-bottom: 1.2rem;

&.notifications,
&.live-status {
&:not(:first-of-type) {
padding-top: 1.2rem;
border-top: 1px solid @lightGrey;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ class CompactSettingsConfig 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 compactType(): CompactType | null {
return this.userStore.currentCompact?.type;
}
Expand Down Expand Up @@ -131,12 +139,16 @@ class CompactSettingsConfig extends mixins(MixinForm) {
}

initFormInputs(): void {
const { isAppModeJcc } = this;

this.formData = reactive({
compactFee: new FormInput({
id: 'compact-fee',
name: 'compact-fee',
label: computed(() => this.$t('compact.compactFee')),
validation: Joi.number().required().min(0).messages(this.joiMessages.currency),
validation: (isAppModeJcc)
? Joi.number().required().min(0).messages(this.joiMessages.currency)
: Joi.any(),
value: this.initialCompactConfig?.compactCommissionFee?.feeAmount,
}),
creditCardTransactionFee: new FormInput({
Expand Down Expand Up @@ -170,7 +182,7 @@ class CompactSettingsConfig extends mixins(MixinForm) {
label: computed(() => this.$t('compact.summaryReportEmails')),
labelSubtext: computed(() => this.$t('compact.summaryReportEmailsSubtext')),
placeholder: computed(() => this.$t('compact.addEmails')),
validation: Joi.array().min(1).messages(this.joiMessages.array),
validation: Joi.array().min(isAppModeJcc ? 1 : 0).messages(this.joiMessages.array),
value: this.initialCompactConfig?.compactSummaryReportNotificationEmails || [],
}),
isRegistrationEnabled: new FormInput({
Expand Down Expand Up @@ -241,23 +253,28 @@ class CompactSettingsConfig extends mixins(MixinForm) {
isRegistrationEnabled,
} = this.formValues;
const payload: CompactConfig = {
compactCommissionFee: {
feeType: FeeType.FLAT_RATE,
feeAmount: Number(compactFee),
},
// Common config fields
compactOperationsTeamEmails: opsNotificationEmails,
compactAdverseActionsNotificationEmails: adverseActionNotificationEmails,
compactSummaryReportNotificationEmails: summaryReportNotificationEmails,
transactionFeeConfiguration: {
licenseeRegistrationEnabled: isRegistrationEnabled,
configuredStates: this.initialCompactConfig?.configuredStates || [],
};
Comment thread
coderabbitai[bot] marked this conversation as resolved.

// Per compact config fields
if (this.isAppModeJcc) {
payload.compactCommissionFee = {
feeType: FeeType.FLAT_RATE,
feeAmount: Number(compactFee),
};
payload.transactionFeeConfiguration = {
licenseeCharges: {
active: true,
chargeType: FeeType.FLAT_FEE_PER_PRIVILEGE,
chargeAmount: Number(creditCardTransactionFee),
},
},
licenseeRegistrationEnabled: isRegistrationEnabled,
configuredStates: this.initialCompactConfig?.configuredStates || [],
};
};
payload.compactSummaryReportNotificationEmails = summaryReportNotificationEmails;
}

// Call the server API to update
await dataApi.updateCompactConfig(compact, payload).catch((err) => {
Expand Down Expand Up @@ -327,12 +344,17 @@ class CompactSettingsConfig extends mixins(MixinForm) {
}

async mockPopulate(): Promise<void> {
this.populateFormInput(this.formData.compactFee, 5.55);
this.populateFormInput(this.formData.creditCardTransactionFee, 5);
// Common compact configs
this.populateFormInput(this.formData.opsNotificationEmails, ['ops@example.com']);
this.populateFormInput(this.formData.adverseActionNotificationEmails, ['adverse@example.com']);
this.populateFormInput(this.formData.summaryReportNotificationEmails, ['summary@example.com']);
this.populateFormInput(this.formData.isRegistrationEnabled, true);

// Per compact configs
if (this.isAppModeJcc) {
this.populateFormInput(this.formData.compactFee, 5.55);
this.populateFormInput(this.formData.creditCardTransactionFee, 5);
this.populateFormInput(this.formData.summaryReportNotificationEmails, ['summary@example.com']);
}
}

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
<form v-else class="compact-config-form" @submit.prevent="handleSubmit(false)">
<div class="compact-config-form-container">
<!-- Privilege fees -->
<h2 class="form-section-title fees">{{ $t('compact.privilegeFees') }}</h2>
<h2 v-if="isAppModeJcc" class="form-section-title fees">{{ $t('compact.privilegeFees') }}</h2>
<MockPopulate :isEnabled="isMockPopulateEnabled" @selected="mockPopulate" />
<InputText
v-if="isAppModeJcc"
:formInput="formData.compactFee"
class="form-row currency"
@input="formatInput(formData.compactFee)"
@blur="formatBlur(formData.compactFee)"
/>
<InputText
v-if="isAppModeJcc"
:formInput="formData.creditCardTransactionFee"
class="form-row currency"
@input="formatInput(formData.creditCardTransactionFee)"
Expand All @@ -33,7 +35,7 @@
<h2 class="form-section-title notifications">{{ $t('compact.notifications') }}</h2>
<InputEmailList :formInput="formData.opsNotificationEmails" />
<InputEmailList :formInput="formData.adverseActionNotificationEmails" />
<InputEmailList :formInput="formData.summaryReportNotificationEmails" />
<InputEmailList v-if="isAppModeJcc" :formInput="formData.summaryReportNotificationEmails" />
<button
class="btn-catch-email-lists"
@click.stop.prevent="() => null"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
.form-section-title {
margin-bottom: 1.2rem;

&.jurisprudence,
&.notifications,
&.live-status {
&:not(:first-of-type) {
padding-top: 1.2rem;
border-top: 1px solid @lightGrey;
}
Expand Down
56 changes: 39 additions & 17 deletions webroot/src/components/StateSettingsConfig/StateSettingsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ class StateSettingsConfig 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 compactType(): CompactType | null {
return this.userStore?.currentCompact?.type || null;
}
Expand Down Expand Up @@ -134,12 +142,16 @@ class StateSettingsConfig extends mixins(MixinForm) {
}

initFormInputs(): void {
const { isAppModeJcc } = this;

this.formData = reactive({
isJurisprudenceExamRequired: new FormInput({
id: 'jurisprudence-exam-required',
name: 'jurisprudence-exam-required',
label: computed(() => this.$t('compact.jurisprudenceExamRequired')),
validation: Joi.boolean().required().messages(this.joiMessages.boolean),
validation: (isAppModeJcc)
? Joi.boolean().required().messages(this.joiMessages.boolean)
: Joi.any(),
valueOptions: [
{ value: true, name: computed(() => this.$t('common.yes')) },
{ value: false, name: computed(() => this.$t('common.no')) },
Expand Down Expand Up @@ -179,7 +191,7 @@ class StateSettingsConfig extends mixins(MixinForm) {
label: computed(() => this.$t('compact.summaryReportEmails')),
labelSubtext: computed(() => this.$t('compact.summaryReportEmailsSubtext')),
placeholder: computed(() => this.$t('compact.addEmails')),
validation: Joi.array().min(1).messages(this.joiMessages.array),
validation: Joi.array().min(isAppModeJcc ? 1 : 0).messages(this.joiMessages.array),
value: this.initialStateConfig?.jurisdictionSummaryReportNotificationEmails || [],
}),
isPurchaseEnabled: new FormInput({
Expand Down Expand Up @@ -299,7 +311,15 @@ class StateSettingsConfig extends mixins(MixinForm) {
} = this.formValues;
const feeInputsCore = this.feeInputs.filter((feeInput) => feeInput.id.endsWith('fee'));
const payload: CompactStateConfig = {
privilegeFees: feeInputsCore.map((feeInputCore) => {
// Common config fields
jurisdictionOperationsTeamEmails: opsNotificationEmails,
jurisdictionAdverseActionsNotificationEmails: adverseActionNotificationEmails,
licenseeRegistrationEnabled: isPurchaseEnabled,
};

// Per compact config fields
if (this.isAppModeJcc) {
payload.privilegeFees = feeInputsCore.map((feeInputCore) => {
// Map indeterminate set of privilege fee inputs to their payload structure
const [ licenseType ] = feeInputCore.id.split('-');
const militaryInput = Object.values(this.formData).find((formInput) =>
Expand All @@ -312,16 +332,13 @@ class StateSettingsConfig extends mixins(MixinForm) {
? null
: Number(militaryInput?.value),
};
}),
jurisprudenceRequirements: {
});
payload.jurisprudenceRequirements = {
required: isJurisprudenceExamRequired,
linkToDocumentation: jurisprudenceInfoLink,
},
jurisdictionOperationsTeamEmails: opsNotificationEmails,
jurisdictionAdverseActionsNotificationEmails: adverseActionNotificationEmails,
jurisdictionSummaryReportNotificationEmails: summaryReportNotificationEmails,
licenseeRegistrationEnabled: isPurchaseEnabled,
};
};
payload.jurisdictionSummaryReportNotificationEmails = summaryReportNotificationEmails;
}

// Call the server API to update
await dataApi.updateCompactStateConfig(compact, this.stateAbbrev, payload).catch((err) => {
Expand Down Expand Up @@ -384,15 +401,20 @@ class StateSettingsConfig extends mixins(MixinForm) {
}

async mockPopulate(): Promise<void> {
this.feeInputs.forEach((feeInput) => {
this.populateFormInput(feeInput, 5);
});
this.populateFormInput(this.formData.isJurisprudenceExamRequired, true);
this.populateFormInput(this.formData.jurisprudenceInfoLink, 'https://example.com');
// Common state configs
this.populateFormInput(this.formData.opsNotificationEmails, ['ops@example.com']);
this.populateFormInput(this.formData.adverseActionNotificationEmails, ['adverse@example.com']);
this.populateFormInput(this.formData.summaryReportNotificationEmails, ['summary@example.com']);
this.populateFormInput(this.formData.isPurchaseEnabled, true);

// Per compact state configs
if (this.isAppModeJcc) {
this.feeInputs.forEach((feeInput) => {
this.populateFormInput(feeInput, 5);
});
this.populateFormInput(this.formData.isJurisprudenceExamRequired, true);
this.populateFormInput(this.formData.jurisprudenceInfoLink, 'https://example.com');
this.populateFormInput(this.formData.summaryReportNotificationEmails, ['summary@example.com']);
}
}

//
Expand Down
34 changes: 22 additions & 12 deletions webroot/src/components/StateSettingsConfig/StateSettingsConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,35 @@
<form v-else class="state-config-form" @submit.prevent="handleSubmit(false)">
<div class="state-config-form-container">
<!-- Privilege fees -->
<h2 class="form-section-title fees">{{ $t('compact.privilegeFees') }}</h2>
<h2 v-if="isAppModeJcc" class="form-section-title fees">{{ $t('compact.privilegeFees') }}</h2>
<MockPopulate :isEnabled="isMockPopulateEnabled" @selected="mockPopulate" />
<template v-if="isAppModeJcc">
<InputText
v-for="(formInput) in feeInputs"
:key="formInput.id"
:formInput="formInput"
class="form-row currency"
@input="formatInput(formInput)"
@blur="formatBlur(formInput, formInput.id.endsWith('military'))"
/>
</template>
<!-- Jurisprudence -->
<h2 v-if="isAppModeJcc" class="form-section-title jurisprudence">{{ $t('compact.jurisprudence') }}</h2>
<InputRadioGroup
v-if="isAppModeJcc"
:formInput="formData.isJurisprudenceExamRequired"
class="form-row"
/>
<InputText
v-for="(formInput) in feeInputs"
:key="formInput.id"
:formInput="formInput"
class="form-row currency"
@input="formatInput(formInput)"
@blur="formatBlur(formInput, formInput.id.endsWith('military'))"
v-if="isAppModeJcc"
:formInput="formData.jurisprudenceInfoLink"
class="form-row jurisprudence-info-link"
/>
<!-- Jurisprudence -->
<h2 class="form-section-title jurisprudence">{{ $t('compact.jurisprudence') }}</h2>
<InputRadioGroup :formInput="formData.isJurisprudenceExamRequired" class="form-row" />
<InputText :formInput="formData.jurisprudenceInfoLink" class="form-row jurisprudence-info-link" />
<!-- Notifications -->
<h2 class="form-section-title notifications">{{ $t('compact.notifications') }}</h2>
<InputEmailList :formInput="formData.opsNotificationEmails" />
<InputEmailList :formInput="formData.adverseActionNotificationEmails" />
<InputEmailList :formInput="formData.summaryReportNotificationEmails" />
<InputEmailList v-if="isAppModeJcc" :formInput="formData.summaryReportNotificationEmails" />
Comment thread
coderabbitai[bot] marked this conversation as resolved.
<button
class="btn-catch-email-lists"
@click.stop.prevent="() => null"
Expand Down
12 changes: 6 additions & 6 deletions webroot/src/models/Compact/Compact.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ export interface CompactConfig {
compactAbbr?: string,
compactName?: string,
licenseeRegistrationEnabled: boolean,
compactCommissionFee: {
compactCommissionFee?: {
feeType: FeeType,
feeAmount: number,
},
compactOperationsTeamEmails: Array<string>,
compactAdverseActionsNotificationEmails: Array<string>,
compactSummaryReportNotificationEmails: Array<string>,
transactionFeeConfiguration: {
compactSummaryReportNotificationEmails?: Array<string>,
transactionFeeConfiguration?: {
licenseeCharges: {
active: boolean,
chargeType: FeeType,
Expand All @@ -60,19 +60,19 @@ export interface CompactStateConfig {
jurisdictionName?: string,
postalAbbreviation?: string,
licenseeRegistrationEnabled: boolean,
privilegeFees: Array<{
privilegeFees?: Array<{
licenseTypeAbbreviation: string,
amount: number,
militaryRate: number | null, // Specific mix of number & null required by server
name?: string,
}>
jurisprudenceRequirements: {
jurisprudenceRequirements?: {
required: boolean,
linkToDocumentation: string | null,
},
jurisdictionOperationsTeamEmails: Array<string>,
jurisdictionAdverseActionsNotificationEmails: Array<string>,
jurisdictionSummaryReportNotificationEmails: Array<string>,
jurisdictionSummaryReportNotificationEmails?: Array<string>,
}

export interface InterfaceCompactCreate {
Expand Down
Loading