diff --git a/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.less b/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.less index a4f8bedf7..bcc4066f9 100644 --- a/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.less +++ b/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.less @@ -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; } diff --git a/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.ts b/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.ts index bdfe0a452..830430032 100644 --- a/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.ts +++ b/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.ts @@ -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; } @@ -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({ @@ -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({ @@ -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 || [], + }; + + // 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) => { @@ -327,12 +344,17 @@ class CompactSettingsConfig extends mixins(MixinForm) { } async mockPopulate(): Promise { - 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']); + } } // diff --git a/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.vue b/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.vue index 38bae9d1b..91e0cb415 100644 --- a/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.vue +++ b/webroot/src/components/CompactSettingsConfig/CompactSettingsConfig.vue @@ -15,15 +15,17 @@
-

{{ $t('compact.privilegeFees') }}

+

{{ $t('compact.privilegeFees') }}

{{ $t('compact.notifications') }} - +