fixsome changes

This commit is contained in:
2026-08-16 14:03:11 +03:30
parent 2b27b16296
commit 27f3a6212a
7 changed files with 469 additions and 59 deletions
+72 -2
View File
@@ -63,7 +63,35 @@
</div>
</template>
<a-row :gutter="[16, 16]" class="settings-grid">
<template v-if="group.subsections?.length">
<div
v-for="block in subsectionBlocks(group)"
:key="block.id"
class="settings-subsection"
>
<h3 class="settings-subsection__title">{{ block.title }}</h3>
<a-row :gutter="[16, 16]" class="settings-grid">
<a-col
v-for="row in block.rows"
:key="row.id"
:xs="24"
:sm="12"
:lg="rowColSpan(row)"
>
<SettingCard
:row="row"
:model-value="draftValue(row)"
:readonly="isReadonly(row)"
:saving="isSaving(row.id)"
:saved-flash="isSavedFlash(row.id)"
@update:value="onValueChange(row, $event)"
@blur="onFieldBlur(row)"
/>
</a-col>
</a-row>
</div>
</template>
<a-row v-else :gutter="[16, 16]" class="settings-grid">
<a-col
v-for="row in groupedFiltered[group.id]"
:key="row.id"
@@ -178,7 +206,8 @@ import { applyBannerEnabledFromRows, applyTrackingSystemsEnabledFromRows, applyC
import {
EDITABLE_SETTING_GROUPS,
SYSTEM_SETTING_GROUPS,
getSettingGroupId
getSettingGroupId,
type SettingGroupDef
} from './settingGroups'
import {
SETTING_TYPE_OPTIONS,
@@ -318,6 +347,32 @@ const visibleSettingGroups = computed(() =>
settingGroups.value.filter((g) => (groupedFiltered.value[g.id]?.length ?? 0) > 0)
)
function subsectionBlocks(group: SettingGroupDef) {
const rows = groupedFiltered.value[group.id] ?? []
if (!group.subsections?.length) {
return [{ id: 'all', title: group.title, rows }]
}
const used = new Set<number>()
const blocks = group.subsections
.map((sub) => {
const subRows = rows.filter((row) => {
if (row.id == null || used.has(row.id)) return false
if (!sub.match(row.key || '')) return false
used.add(row.id)
return true
})
return { id: sub.id, title: sub.title, rows: subRows }
})
.filter((b) => b.rows.length > 0)
const leftovers = rows.filter((row) => row.id != null && !used.has(row.id))
if (leftovers.length) {
blocks.push({ id: `${group.id}-other`, title: 'سایر', rows: leftovers })
}
return blocks
}
const defaultOpenGroupId = computed(() => {
const visibleIds = visibleSettingGroups.value.map((g) => g.id)
const preferred = isSystemMode.value
@@ -740,6 +795,21 @@ async function ok() {
margin-bottom: 8px;
}
.settings-subsection {
& + & {
margin-top: 1.25rem;
padding-top: 1rem;
border-top: 1px solid var(--admin-border);
}
&__title {
margin: 0 0 0.75rem;
font-size: 13px;
font-weight: 700;
color: var(--admin-text-primary);
}
}
:deep(.ant-form-item-extra) {
font-size: 12px;
color: rgba(0, 0, 0, 0.45);
@@ -1,8 +1,16 @@
export type SettingSubsectionDef = {
id: string
title: string
match: (key: string) => boolean
}
export type SettingGroupDef = {
id: string
title: string
icon: string
match: (key: string) => boolean
/** زیربخش‌های داخل گروه (مثلاً روش‌های واریز) */
subsections?: SettingSubsectionDef[]
}
/** گروه‌های صفحه تنظیمات عادی (فقط can_edit=1) */
@@ -81,6 +89,44 @@ export const EDITABLE_SETTING_GROUPS: SettingGroupDef[] = [
icon: 'vuesax-linear:shop',
match: (k) => /^external_order/.test(k)
},
{
id: 'deposit_methods',
title: 'روش‌های واریز',
icon: 'vuesax-linear:card-send',
match: (k) =>
k.startsWith('deposit_method_')
|| k === 'deposit_account_holder'
|| k === 'deposit_card_number'
|| k === 'deposit_account_number'
|| k === 'deposit_sheba',
subsections: [
{
id: 'card_to_card',
title: 'کارت به کارت',
match: (k) =>
k === 'deposit_method_card_to_card'
|| k === 'deposit_account_holder'
|| k === 'deposit_card_number'
|| k === 'deposit_account_number'
|| k === 'deposit_sheba',
},
{
id: 'gateway',
title: 'درگاه پرداخت',
match: (k) => k === 'deposit_method_gateway',
},
{
id: 'identified',
title: 'شناسه واریز',
match: (k) => k === 'deposit_method_identified',
},
{
id: 'shetab',
title: 'شبکه شتابی',
match: (k) => k === 'deposit_method_shetab',
},
],
},
{
id: 'support',
title: 'پشتیبانی',
@@ -89,7 +135,7 @@ export const EDITABLE_SETTING_GROUPS: SettingGroupDef[] = [
k === 'support_messengers'
|| k.startsWith('support_messenger_')
|| k === 'deposit_sms_support_number'
|| (k.startsWith('deposit_') && !k.startsWith('external_')),
|| k === 'deposit_support_message_text',
},
{
id: 'bots',
@@ -181,12 +227,21 @@ export const SYSTEM_SETTING_GROUPS: SettingGroupDef[] = [
match: (k) => /^node_/.test(k) || k === 'montify_name' || k === 'external_order_api_enabled'
},
{
id: 'gateway',
title: 'درگاه شارژ آنلاین',
icon: 'vuesax-linear:card-pos',
id: 'deposit_methods',
title: 'روش‌های واریز',
icon: 'vuesax-linear:card-send',
match: (k) =>
k.startsWith('external_payment_')
|| k === 'wallet_payment_provider'
|| k === 'wallet_payment_provider',
subsections: [
{
id: 'gateway',
title: 'درگاه فروشگاه / پرداخت آنلاین',
match: (k) =>
k.startsWith('external_payment_')
|| k === 'wallet_payment_provider',
},
],
},
{
id: 'payping',
@@ -245,3 +300,14 @@ export function getSettingGroupId(key: string, groups: SettingGroupDef[]): strin
}
return 'misc'
}
export function getSettingSubsectionId(
key: string,
group: SettingGroupDef | undefined
): string | null {
if (!group?.subsections?.length) return null
for (const sub of group.subsections) {
if (sub.match(key)) return sub.id
}
return null
}
@@ -368,6 +368,10 @@ const KEY_TYPE_FALLBACK: Record<string, SettingFieldType> = {
deposit_card_number: 'text',
deposit_account_number: 'text',
deposit_sheba: 'text',
deposit_method_card_to_card: 'switch',
deposit_method_gateway: 'switch',
deposit_method_identified: 'switch',
deposit_method_shetab: 'switch',
invite_link_text: 'longtext',
support_messenger: 'select',
deposit_sms_support_number: 'number',
@@ -775,6 +779,14 @@ const KEY_HELP_FALLBACK: Record<string, string> = {
'شماره حساب بانکی واریز — در مودال راهنمای شارژ کنار کارت و شبا نمایش داده می‌شود. در متن‌ها با ٪حساب یا %حساب جایگزین می‌شود.',
deposit_sheba:
'شماره شبا واریز — در متن‌ها با ٪شبا یا %شبا جایگزین می‌شود.',
deposit_method_card_to_card:
'روشن (پیش‌فرض): روش کارت به کارت در صفحه واریز اپ نمایش داده می‌شود. خاموش: این روش از لیست روش‌های واریز حذف می‌شود.',
deposit_method_gateway:
'روشن: روش درگاه پرداخت در صفحه واریز نمایش داده می‌شود. خاموش: مخفی است. اتصال و کدهای درگاه در تنظیمات پیشرفته → روش‌های واریز تنظیم می‌شوند.',
deposit_method_identified:
'روشن: روش شناسه واریز در صفحه واریز نمایش داده می‌شود. خاموش: مخفی است.',
deposit_method_shetab:
'روشن: روش شبکه شتابی در صفحه واریز نمایش داده می‌شود. خاموش: مخفی است.',
deposit_sms_support_number:
'شماره تماس پشتیبانی برای راهنمای واریز و دکمه پیامک داخل مودال شارژ. برای نمایش در منوی شناور، باید «تماس تلفنی» یا «پیامک» را جداگانه در لیست پیام‌رسان‌های پشتیبانی اضافه کنید.',
charge_notif:
@@ -1030,6 +1042,10 @@ export const KEY_LABEL_FALLBACK: Record<string, string> = {
deposit_card_number: 'شماره کارت واریز',
deposit_account_number: 'شماره حساب واریز',
deposit_sheba: 'شبا واریز',
deposit_method_card_to_card: 'فعال‌سازی کارت به کارت',
deposit_method_gateway: 'فعال‌سازی درگاه پرداخت',
deposit_method_identified: 'فعال‌سازی شناسه واریز',
deposit_method_shetab: 'فعال‌سازی شبکه شتابی',
deposit_sms_support_number: 'شماره تماس پشتیبانی',
price_channel_enabled: 'ارسال قیمت به کانال',
price_channel_access: 'دسترسی ارسال قیمت به کانال',
@@ -1119,6 +1135,7 @@ export const SETTING_EDITABLE_KEYS = new Set([
'sms_notif_price_trigger', 'sms_notif_wallet_alert', 'sms_notif_support_admin',
'deposit_sms_support_number', 'deposit_support_message_text',
'deposit_account_holder', 'deposit_card_number', 'deposit_account_number', 'deposit_sheba',
'deposit_method_card_to_card', 'deposit_method_gateway', 'deposit_method_identified', 'deposit_method_shetab',
'endDay',
'fee_free', 'fee_service_charge_percentage',
'gift_for_referral', 'gift_for_referrer',
@@ -1138,6 +1155,7 @@ export const SETTING_EDITABLE_KEYS = new Set([
'support_messengers', 'support_messenger_text',
'has_chat',
'deposit_support_message_text', 'deposit_account_holder', 'deposit_card_number', 'deposit_account_number', 'deposit_sheba',
'deposit_method_card_to_card', 'deposit_method_gateway', 'deposit_method_identified', 'deposit_method_shetab',
'text_about', 'text_rule',
'zaarbox_price_key',
'price_channel_enabled', 'price_channel_messengers', 'price_channel_diff',