This commit is contained in:
2026-08-24 12:59:34 +03:30
parent 6bbd8704b8
commit 010e287c70
4 changed files with 29 additions and 6 deletions
+2
View File
@@ -5,6 +5,8 @@ export interface Const {
description?: string
title_fa?: string
type?: string
menu?: string
show_to_user?: boolean | number
is_active: boolean | number
can_edit?: number | boolean
}
+11 -5
View File
@@ -206,7 +206,8 @@ import { applyBannerEnabledFromRows, applyTrackingSystemsEnabledFromRows, applyC
import {
EDITABLE_SETTING_GROUPS,
SYSTEM_SETTING_GROUPS,
getSettingGroupId,
resolveSettingMenu,
OTHER_PAGE_SETTING_MENUS,
type SettingGroupDef
} from './settingGroups'
import {
@@ -311,7 +312,11 @@ const filteredRows = computed(() =>
(baseData.value || []).filter((row) => {
if (row.id == null || !matchesFilter(row)) return false
if (!isSettingVisible(row.key)) return false
if (!isSystemMode.value && TRADING_HOURS_SETTING_KEY_SET.has(row.key || '')) return false
const menu = String(row.menu ?? '').trim()
if (OTHER_PAGE_SETTING_MENUS.has(menu)) return false
if (!menu && !isSystemMode.value && TRADING_HOURS_SETTING_KEY_SET.has(row.key || '')) {
return false
}
if (isSystemMode.value) return true
return isEditable(row)
})
@@ -330,15 +335,16 @@ const otherRows = computed(() =>
// گروه‌بندی تنظیمات — اولین match برنده است؛ misc فقط برای باقی‌مانده
// =============================================================================
function getGroupId(key: string): string {
return getSettingGroupId(key, settingGroups.value)
function getGroupId(row: Const): string {
return resolveSettingMenu(row, settingGroups.value)
}
const groupedFiltered = computed(() => {
const map: Record<string, Const[]> = {}
for (const g of settingGroups.value) map[g.id] = []
for (const row of filteredRows.value) {
const gid = getGroupId(row.key || '')
const gid = getGroupId(row)
if (!map[gid]) map[gid] = []
map[gid].push(row)
}
Object.keys(map).forEach((k) => {
@@ -291,6 +291,19 @@ export function getSettingGroupId(key: string, groups: SettingGroupDef[]): strin
return 'misc'
}
/** گروه از ستون menu اگر در همین صفحه تعریف شده باشد؛ وگرنه regex. */
export function resolveSettingMenu(
row: { key?: string; menu?: string | null },
groups: SettingGroupDef[]
): string {
const menu = String(row.menu ?? '').trim()
if (menu && groups.some((g) => g.id === menu)) return menu
return getSettingGroupId(row.key || '', groups)
}
/** این کلیدها صفحهٔ جدا دارند و در لیست تنظیمات عادی/پیشرفته نمی‌آیند */
export const OTHER_PAGE_SETTING_MENUS = new Set(['trading_hours', 'capture_sites'])
export function getSettingSubsectionId(
key: string,
group: SettingGroupDef | undefined
@@ -110,7 +110,9 @@ export function useTradingHoursPage() {
const map: Record<string, Const> = {}
const draftMap: Record<string, string> = {}
for (const row of rows || []) {
if (!row.key || !TRADING_HOURS_SETTING_KEY_SET.has(row.key)) continue
if (!row.key) continue
const fromMenu = String(row.menu ?? '').trim() === 'trading_hours'
if (!fromMenu && !TRADING_HOURS_SETTING_KEY_SET.has(row.key)) continue
map[row.key] = row
if (row.id != null) draftMap[String(row.id)] = row.value ?? ''
}