171 lines
4.7 KiB
TypeScript
171 lines
4.7 KiB
TypeScript
export type SettingGroupDef = {
|
|
id: string
|
|
title: string
|
|
icon: string
|
|
match: (key: string) => boolean
|
|
}
|
|
|
|
/** گروههای صفحه تنظیمات عادی (فقط can_edit=1) */
|
|
export const EDITABLE_SETTING_GROUPS: SettingGroupDef[] = [
|
|
{
|
|
id: 'general',
|
|
title: 'عمومی و برند',
|
|
icon: 'vuesax-linear:home-2',
|
|
match: (k) =>
|
|
/^(name_fa|name_en|bace_url|server_url|logo_|title_pwa|title_fav|open_register|auto_active_customer|store_status|key$)/.test(
|
|
k
|
|
)
|
|
},
|
|
{
|
|
id: 'trading_hours',
|
|
title: 'ساعت کاری و نمایش قیمت',
|
|
icon: 'vuesax-linear:clock',
|
|
match: (k) => /^(close_price|startDay|endDay|show_last_price)$/.test(k)
|
|
},
|
|
{
|
|
id: 'pricing',
|
|
title: 'کارمزد و محدودیتها',
|
|
icon: 'vuesax-linear:dollar-circle',
|
|
match: (k) =>
|
|
/^(fee_|buy_fee|sell_fee|min_|minimum_|up_price|down_price|price_extreme_date|balance_report_exclude)/.test(
|
|
k
|
|
) || k.includes('charge_percentage')
|
|
},
|
|
{
|
|
id: 'price_source',
|
|
title: 'منبع قیمت و تابلو',
|
|
icon: 'vuesax-linear:chart-2',
|
|
match: (k) => /^(price_provider|zaarbox_|main_product$)/.test(k)
|
|
},
|
|
{
|
|
id: 'content',
|
|
title: 'متنهای اپ',
|
|
icon: 'vuesax-linear:document-text',
|
|
match: (k) => /^text_/.test(k)
|
|
},
|
|
{
|
|
id: 'referral',
|
|
title: 'معرف و پاداش',
|
|
icon: 'vuesax-linear:people',
|
|
match: (k) =>
|
|
/^(referral_|gift_for|register_referral|register_jibit|jibit_verification|referral_bonus|invite_link_text)/.test(
|
|
k
|
|
)
|
|
},
|
|
{
|
|
id: 'montzar',
|
|
title: 'همکار Montzar',
|
|
icon: 'vuesax-linear:link-2',
|
|
match: (k) =>
|
|
(k.startsWith('montzar_') && !['montzar_base_url', 'montzar_closed'].includes(k)) ||
|
|
k === 'display_montzar'
|
|
},
|
|
{
|
|
id: 'store',
|
|
title: 'سفارش خارجی',
|
|
icon: 'vuesax-linear:shop',
|
|
match: (k) => /^external_order/.test(k)
|
|
},
|
|
{
|
|
id: 'support',
|
|
title: 'پشتیبانی',
|
|
icon: 'vuesax-linear:headphone',
|
|
match: (k) => k.startsWith('support_messenger') || k === 'deposit_sms_support_number'
|
|
},
|
|
{
|
|
id: 'bots',
|
|
title: 'باتها',
|
|
icon: 'vuesax-linear:messages-2',
|
|
match: (k) => /^(telegram_bot|bale_bot)/.test(k)
|
|
},
|
|
{
|
|
id: 'notifications',
|
|
title: 'پیامک و اعلان',
|
|
icon: 'vuesax-linear:notification',
|
|
match: (k) => /^charge_notif/.test(k)
|
|
},
|
|
{
|
|
id: 'features',
|
|
title: 'قابلیتهای سیستم',
|
|
icon: 'vuesax-linear:setting-2',
|
|
match: (k) => /^(product_|main_wallet_products|profit_gold)/.test(k)
|
|
},
|
|
{
|
|
id: 'misc',
|
|
title: 'سایر',
|
|
icon: 'vuesax-linear:more-circle',
|
|
match: () => true
|
|
}
|
|
]
|
|
|
|
/** گروههای صفحه دیپلوی — شامل تنظیمات can_edit=0 */
|
|
export const SYSTEM_SETTING_GROUPS: SettingGroupDef[] = [
|
|
{
|
|
id: 'general',
|
|
title: 'عمومی و برند',
|
|
icon: 'vuesax-linear:home-2',
|
|
match: (k) =>
|
|
/^(name_fa|name_en|app_url|admin_url|apk_download_link|banner_enabled|bace_url|server_url|logo_|title_pwa|title_fav|metal_type|main_metal|unit$|open_register|auto_active_customer|store_status|key$|is_store|group_sms|has_page_earn_money)/.test(
|
|
k
|
|
)
|
|
},
|
|
{
|
|
id: 'chart',
|
|
title: 'نمودار قیمت',
|
|
icon: 'vuesax-linear:chart-2',
|
|
match: (k) => /^chart_/.test(k)
|
|
},
|
|
{
|
|
id: 'pricing',
|
|
title: 'منبع قیمت و تابلو',
|
|
icon: 'vuesax-linear:dollar-circle',
|
|
match: (k) =>
|
|
/^(price_provider|zaarbox_|main_product$)/.test(k) ||
|
|
k.includes('charge_percentage')
|
|
},
|
|
{
|
|
id: 'montzar',
|
|
title: 'Montzar',
|
|
icon: 'vuesax-linear:link-2',
|
|
match: (k) => /^montzar_/.test(k) || k === 'display_montzar'
|
|
},
|
|
{
|
|
id: 'store',
|
|
title: 'اتصال فروشگاه',
|
|
icon: 'vuesax-linear:shop',
|
|
match: (k) => /^node_/.test(k) || k === 'montify_name' || k === 'external_order_api_enabled'
|
|
},
|
|
{
|
|
id: 'payping',
|
|
title: 'درگاه Payping',
|
|
icon: 'vuesax-linear:card',
|
|
match: (k) => k.startsWith('payping_')
|
|
},
|
|
{
|
|
id: 'tahesab',
|
|
title: 'تهحساب',
|
|
icon: 'vuesax-linear:receipt-2',
|
|
match: (k) => k.startsWith('tahesab_') || k === 'send_to_tahesab'
|
|
},
|
|
{
|
|
id: 'infra',
|
|
title: 'زیرساخت',
|
|
icon: 'vuesax-linear:cpu',
|
|
match: (k) => /^(wss_enabled|sse_path|profit_gold_api_enabled)/.test(k)
|
|
},
|
|
{
|
|
id: 'misc',
|
|
title: 'سایر',
|
|
icon: 'vuesax-linear:more-circle',
|
|
match: () => true
|
|
}
|
|
]
|
|
|
|
export function getSettingGroupId(key: string, groups: SettingGroupDef[]): string {
|
|
for (const g of groups) {
|
|
if (g.id === 'misc') continue
|
|
if (g.match(key)) return g.id
|
|
}
|
|
return 'misc'
|
|
}
|