Skip to content

Commit 5421784

Browse files
authored
Frontend/cosmo settings updates (#1309)
1 parent c30ba4c commit 5421784

7 files changed

Lines changed: 110 additions & 57 deletions

File tree

webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.less

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
.form-section-title {
3838
margin-bottom: 1.2rem;
3939

40-
&.notifications,
41-
&.live-status {
40+
&:not(:first-of-type) {
4241
padding-top: 1.2rem;
4342
border-top: 1px solid @lightGrey;
4443
}

webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.ts

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ class CompactSettingsConfig extends mixins(MixinForm) {
7777
return this.$store.state.user;
7878
}
7979

80+
get isAppModeJcc(): boolean {
81+
return this.$store.getters.isAppModeJcc;
82+
}
83+
84+
get isAppModeCosmetology(): boolean {
85+
return this.$store.getters.isAppModeCosmetology;
86+
}
87+
8088
get compactType(): CompactType | null {
8189
return this.userStore.currentCompact?.type;
8290
}
@@ -131,12 +139,16 @@ class CompactSettingsConfig extends mixins(MixinForm) {
131139
}
132140

133141
initFormInputs(): void {
142+
const { isAppModeJcc } = this;
143+
134144
this.formData = reactive({
135145
compactFee: new FormInput({
136146
id: 'compact-fee',
137147
name: 'compact-fee',
138148
label: computed(() => this.$t('compact.compactFee')),
139-
validation: Joi.number().required().min(0).messages(this.joiMessages.currency),
149+
validation: (isAppModeJcc)
150+
? Joi.number().required().min(0).messages(this.joiMessages.currency)
151+
: Joi.any(),
140152
value: this.initialCompactConfig?.compactCommissionFee?.feeAmount,
141153
}),
142154
creditCardTransactionFee: new FormInput({
@@ -170,7 +182,7 @@ class CompactSettingsConfig extends mixins(MixinForm) {
170182
label: computed(() => this.$t('compact.summaryReportEmails')),
171183
labelSubtext: computed(() => this.$t('compact.summaryReportEmailsSubtext')),
172184
placeholder: computed(() => this.$t('compact.addEmails')),
173-
validation: Joi.array().min(1).messages(this.joiMessages.array),
185+
validation: Joi.array().min(isAppModeJcc ? 1 : 0).messages(this.joiMessages.array),
174186
value: this.initialCompactConfig?.compactSummaryReportNotificationEmails || [],
175187
}),
176188
isRegistrationEnabled: new FormInput({
@@ -241,23 +253,28 @@ class CompactSettingsConfig extends mixins(MixinForm) {
241253
isRegistrationEnabled,
242254
} = this.formValues;
243255
const payload: CompactConfig = {
244-
compactCommissionFee: {
245-
feeType: FeeType.FLAT_RATE,
246-
feeAmount: Number(compactFee),
247-
},
256+
// Common config fields
248257
compactOperationsTeamEmails: opsNotificationEmails,
249258
compactAdverseActionsNotificationEmails: adverseActionNotificationEmails,
250-
compactSummaryReportNotificationEmails: summaryReportNotificationEmails,
251-
transactionFeeConfiguration: {
259+
licenseeRegistrationEnabled: isRegistrationEnabled,
260+
configuredStates: this.initialCompactConfig?.configuredStates || [],
261+
};
262+
263+
// Per compact config fields
264+
if (this.isAppModeJcc) {
265+
payload.compactCommissionFee = {
266+
feeType: FeeType.FLAT_RATE,
267+
feeAmount: Number(compactFee),
268+
};
269+
payload.transactionFeeConfiguration = {
252270
licenseeCharges: {
253271
active: true,
254272
chargeType: FeeType.FLAT_FEE_PER_PRIVILEGE,
255273
chargeAmount: Number(creditCardTransactionFee),
256274
},
257-
},
258-
licenseeRegistrationEnabled: isRegistrationEnabled,
259-
configuredStates: this.initialCompactConfig?.configuredStates || [],
260-
};
275+
};
276+
payload.compactSummaryReportNotificationEmails = summaryReportNotificationEmails;
277+
}
261278

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

329346
async mockPopulate(): Promise<void> {
330-
this.populateFormInput(this.formData.compactFee, 5.55);
331-
this.populateFormInput(this.formData.creditCardTransactionFee, 5);
347+
// Common compact configs
332348
this.populateFormInput(this.formData.opsNotificationEmails, ['ops@example.com']);
333349
this.populateFormInput(this.formData.adverseActionNotificationEmails, ['adverse@example.com']);
334-
this.populateFormInput(this.formData.summaryReportNotificationEmails, ['summary@example.com']);
335350
this.populateFormInput(this.formData.isRegistrationEnabled, true);
351+
352+
// Per compact configs
353+
if (this.isAppModeJcc) {
354+
this.populateFormInput(this.formData.compactFee, 5.55);
355+
this.populateFormInput(this.formData.creditCardTransactionFee, 5);
356+
this.populateFormInput(this.formData.summaryReportNotificationEmails, ['summary@example.com']);
357+
}
336358
}
337359

338360
//

webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@
1515
<form v-else class="compact-config-form" @submit.prevent="handleSubmit(false)">
1616
<div class="compact-config-form-container">
1717
<!-- Privilege fees -->
18-
<h2 class="form-section-title fees">{{ $t('compact.privilegeFees') }}</h2>
18+
<h2 v-if="isAppModeJcc" class="form-section-title fees">{{ $t('compact.privilegeFees') }}</h2>
1919
<MockPopulate :isEnabled="isMockPopulateEnabled" @selected="mockPopulate" />
2020
<InputText
21+
v-if="isAppModeJcc"
2122
:formInput="formData.compactFee"
2223
class="form-row currency"
2324
@input="formatInput(formData.compactFee)"
2425
@blur="formatBlur(formData.compactFee)"
2526
/>
2627
<InputText
28+
v-if="isAppModeJcc"
2729
:formInput="formData.creditCardTransactionFee"
2830
class="form-row currency"
2931
@input="formatInput(formData.creditCardTransactionFee)"
@@ -33,7 +35,7 @@
3335
<h2 class="form-section-title notifications">{{ $t('compact.notifications') }}</h2>
3436
<InputEmailList :formInput="formData.opsNotificationEmails" />
3537
<InputEmailList :formInput="formData.adverseActionNotificationEmails" />
36-
<InputEmailList :formInput="formData.summaryReportNotificationEmails" />
38+
<InputEmailList v-if="isAppModeJcc" :formInput="formData.summaryReportNotificationEmails" />
3739
<button
3840
class="btn-catch-email-lists"
3941
@click.stop.prevent="() => null"

webroot/src/components/StateSettingsConfig/StateSettingsConfig.less

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@
3737
.form-section-title {
3838
margin-bottom: 1.2rem;
3939

40-
&.jurisprudence,
41-
&.notifications,
42-
&.live-status {
40+
&:not(:first-of-type) {
4341
padding-top: 1.2rem;
4442
border-top: 1px solid @lightGrey;
4543
}

webroot/src/components/StateSettingsConfig/StateSettingsConfig.ts

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ class StateSettingsConfig extends mixins(MixinForm) {
8181
return this.$store.state.user;
8282
}
8383

84+
get isAppModeJcc(): boolean {
85+
return this.$store.getters.isAppModeJcc;
86+
}
87+
88+
get isAppModeCosmetology(): boolean {
89+
return this.$store.getters.isAppModeCosmetology;
90+
}
91+
8492
get compactType(): CompactType | null {
8593
return this.userStore?.currentCompact?.type || null;
8694
}
@@ -134,12 +142,16 @@ class StateSettingsConfig extends mixins(MixinForm) {
134142
}
135143

136144
initFormInputs(): void {
145+
const { isAppModeJcc } = this;
146+
137147
this.formData = reactive({
138148
isJurisprudenceExamRequired: new FormInput({
139149
id: 'jurisprudence-exam-required',
140150
name: 'jurisprudence-exam-required',
141151
label: computed(() => this.$t('compact.jurisprudenceExamRequired')),
142-
validation: Joi.boolean().required().messages(this.joiMessages.boolean),
152+
validation: (isAppModeJcc)
153+
? Joi.boolean().required().messages(this.joiMessages.boolean)
154+
: Joi.any(),
143155
valueOptions: [
144156
{ value: true, name: computed(() => this.$t('common.yes')) },
145157
{ value: false, name: computed(() => this.$t('common.no')) },
@@ -179,7 +191,7 @@ class StateSettingsConfig extends mixins(MixinForm) {
179191
label: computed(() => this.$t('compact.summaryReportEmails')),
180192
labelSubtext: computed(() => this.$t('compact.summaryReportEmailsSubtext')),
181193
placeholder: computed(() => this.$t('compact.addEmails')),
182-
validation: Joi.array().min(1).messages(this.joiMessages.array),
194+
validation: Joi.array().min(isAppModeJcc ? 1 : 0).messages(this.joiMessages.array),
183195
value: this.initialStateConfig?.jurisdictionSummaryReportNotificationEmails || [],
184196
}),
185197
isPurchaseEnabled: new FormInput({
@@ -299,7 +311,15 @@ class StateSettingsConfig extends mixins(MixinForm) {
299311
} = this.formValues;
300312
const feeInputsCore = this.feeInputs.filter((feeInput) => feeInput.id.endsWith('fee'));
301313
const payload: CompactStateConfig = {
302-
privilegeFees: feeInputsCore.map((feeInputCore) => {
314+
// Common config fields
315+
jurisdictionOperationsTeamEmails: opsNotificationEmails,
316+
jurisdictionAdverseActionsNotificationEmails: adverseActionNotificationEmails,
317+
licenseeRegistrationEnabled: isPurchaseEnabled,
318+
};
319+
320+
// Per compact config fields
321+
if (this.isAppModeJcc) {
322+
payload.privilegeFees = feeInputsCore.map((feeInputCore) => {
303323
// Map indeterminate set of privilege fee inputs to their payload structure
304324
const [ licenseType ] = feeInputCore.id.split('-');
305325
const militaryInput = Object.values(this.formData).find((formInput) =>
@@ -312,16 +332,13 @@ class StateSettingsConfig extends mixins(MixinForm) {
312332
? null
313333
: Number(militaryInput?.value),
314334
};
315-
}),
316-
jurisprudenceRequirements: {
335+
});
336+
payload.jurisprudenceRequirements = {
317337
required: isJurisprudenceExamRequired,
318338
linkToDocumentation: jurisprudenceInfoLink,
319-
},
320-
jurisdictionOperationsTeamEmails: opsNotificationEmails,
321-
jurisdictionAdverseActionsNotificationEmails: adverseActionNotificationEmails,
322-
jurisdictionSummaryReportNotificationEmails: summaryReportNotificationEmails,
323-
licenseeRegistrationEnabled: isPurchaseEnabled,
324-
};
339+
};
340+
payload.jurisdictionSummaryReportNotificationEmails = summaryReportNotificationEmails;
341+
}
325342

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

386403
async mockPopulate(): Promise<void> {
387-
this.feeInputs.forEach((feeInput) => {
388-
this.populateFormInput(feeInput, 5);
389-
});
390-
this.populateFormInput(this.formData.isJurisprudenceExamRequired, true);
391-
this.populateFormInput(this.formData.jurisprudenceInfoLink, 'https://example.com');
404+
// Common state configs
392405
this.populateFormInput(this.formData.opsNotificationEmails, ['ops@example.com']);
393406
this.populateFormInput(this.formData.adverseActionNotificationEmails, ['adverse@example.com']);
394-
this.populateFormInput(this.formData.summaryReportNotificationEmails, ['summary@example.com']);
395407
this.populateFormInput(this.formData.isPurchaseEnabled, true);
408+
409+
// Per compact state configs
410+
if (this.isAppModeJcc) {
411+
this.feeInputs.forEach((feeInput) => {
412+
this.populateFormInput(feeInput, 5);
413+
});
414+
this.populateFormInput(this.formData.isJurisprudenceExamRequired, true);
415+
this.populateFormInput(this.formData.jurisprudenceInfoLink, 'https://example.com');
416+
this.populateFormInput(this.formData.summaryReportNotificationEmails, ['summary@example.com']);
417+
}
396418
}
397419

398420
//

webroot/src/components/StateSettingsConfig/StateSettingsConfig.vue

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,35 @@
1515
<form v-else class="state-config-form" @submit.prevent="handleSubmit(false)">
1616
<div class="state-config-form-container">
1717
<!-- Privilege fees -->
18-
<h2 class="form-section-title fees">{{ $t('compact.privilegeFees') }}</h2>
18+
<h2 v-if="isAppModeJcc" class="form-section-title fees">{{ $t('compact.privilegeFees') }}</h2>
1919
<MockPopulate :isEnabled="isMockPopulateEnabled" @selected="mockPopulate" />
20+
<template v-if="isAppModeJcc">
21+
<InputText
22+
v-for="(formInput) in feeInputs"
23+
:key="formInput.id"
24+
:formInput="formInput"
25+
class="form-row currency"
26+
@input="formatInput(formInput)"
27+
@blur="formatBlur(formInput, formInput.id.endsWith('military'))"
28+
/>
29+
</template>
30+
<!-- Jurisprudence -->
31+
<h2 v-if="isAppModeJcc" class="form-section-title jurisprudence">{{ $t('compact.jurisprudence') }}</h2>
32+
<InputRadioGroup
33+
v-if="isAppModeJcc"
34+
:formInput="formData.isJurisprudenceExamRequired"
35+
class="form-row"
36+
/>
2037
<InputText
21-
v-for="(formInput) in feeInputs"
22-
:key="formInput.id"
23-
:formInput="formInput"
24-
class="form-row currency"
25-
@input="formatInput(formInput)"
26-
@blur="formatBlur(formInput, formInput.id.endsWith('military'))"
38+
v-if="isAppModeJcc"
39+
:formInput="formData.jurisprudenceInfoLink"
40+
class="form-row jurisprudence-info-link"
2741
/>
28-
<!-- Jurisprudence -->
29-
<h2 class="form-section-title jurisprudence">{{ $t('compact.jurisprudence') }}</h2>
30-
<InputRadioGroup :formInput="formData.isJurisprudenceExamRequired" class="form-row" />
31-
<InputText :formInput="formData.jurisprudenceInfoLink" class="form-row jurisprudence-info-link" />
3242
<!-- Notifications -->
3343
<h2 class="form-section-title notifications">{{ $t('compact.notifications') }}</h2>
3444
<InputEmailList :formInput="formData.opsNotificationEmails" />
3545
<InputEmailList :formInput="formData.adverseActionNotificationEmails" />
36-
<InputEmailList :formInput="formData.summaryReportNotificationEmails" />
46+
<InputEmailList v-if="isAppModeJcc" :formInput="formData.summaryReportNotificationEmails" />
3747
<button
3848
class="btn-catch-email-lists"
3949
@click.stop.prevent="() => null"

webroot/src/models/Compact/Compact.model.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ export interface CompactConfig {
3535
compactAbbr?: string,
3636
compactName?: string,
3737
licenseeRegistrationEnabled: boolean,
38-
compactCommissionFee: {
38+
compactCommissionFee?: {
3939
feeType: FeeType,
4040
feeAmount: number,
4141
},
4242
compactOperationsTeamEmails: Array<string>,
4343
compactAdverseActionsNotificationEmails: Array<string>,
44-
compactSummaryReportNotificationEmails: Array<string>,
45-
transactionFeeConfiguration: {
44+
compactSummaryReportNotificationEmails?: Array<string>,
45+
transactionFeeConfiguration?: {
4646
licenseeCharges: {
4747
active: boolean,
4848
chargeType: FeeType,
@@ -60,19 +60,19 @@ export interface CompactStateConfig {
6060
jurisdictionName?: string,
6161
postalAbbreviation?: string,
6262
licenseeRegistrationEnabled: boolean,
63-
privilegeFees: Array<{
63+
privilegeFees?: Array<{
6464
licenseTypeAbbreviation: string,
6565
amount: number,
6666
militaryRate: number | null, // Specific mix of number & null required by server
6767
name?: string,
6868
}>
69-
jurisprudenceRequirements: {
69+
jurisprudenceRequirements?: {
7070
required: boolean,
7171
linkToDocumentation: string | null,
7272
},
7373
jurisdictionOperationsTeamEmails: Array<string>,
7474
jurisdictionAdverseActionsNotificationEmails: Array<string>,
75-
jurisdictionSummaryReportNotificationEmails: Array<string>,
75+
jurisdictionSummaryReportNotificationEmails?: Array<string>,
7676
}
7777

7878
export interface InterfaceCompactCreate {

0 commit comments

Comments
 (0)