setting pushed

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 09:48:27 +03:30
co-authored by Cursor
parent a75c4d915d
commit 6bbd8704b8
17 changed files with 2338 additions and 14 deletions
@@ -215,12 +215,14 @@ import {
helpText,
isSettingVisible,
isCodeManagedSettingKey,
isSuperAdminOwnedSettingKey,
isSettingLocked,
isSettingActive,
isSwitchOn,
normalizeSettingRow,
resolveSettingFieldType
} from './settingTypes'
import { TRADING_HOURS_SETTING_KEY_SET } from './tradingHoursKeys'
const props = withDefaults(defineProps<{ mode?: 'editable' | 'system' }>(), {
mode: 'editable'
@@ -309,6 +311,7 @@ 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
if (isSystemMode.value) return true
return isEditable(row)
})
@@ -429,6 +432,7 @@ function rowColSpan(row: Const): number {
function isReadonly(row: Const): boolean {
if (isCodeManagedSettingKey(row.key)) return true
if (isSuperAdminOwnedSettingKey(row.key)) return true
if (isSystemMode.value) return false
return isSettingLocked(row.can_edit)
}
@@ -31,15 +31,6 @@ export const EDITABLE_SETTING_GROUPS: SettingGroupDef[] = [
match: (k) =>
/^(banner_enabled|tracking_systems_enabled|jibit_verification|register_jibit_verify|show_product_details|show_product_trade_status|show_product_card_meta|products_site_link_enabled|products_site_link_url|products_site_link_text|has_chat)$/.test(k)
},
{
id: 'trading_hours',
title: 'ساعت کاری و نمایش قیمت',
icon: 'vuesax-linear:clock',
match: (k) =>
/^(close_price|startDay|endDay|show_last_price|show_home_price_when_closed|show_gold_ounce_price)$/.test(
k
)
},
{
id: 'fees',
title: 'کارمزدها',
@@ -199,6 +199,31 @@ export function isCodeManagedSettingKey(key?: string | null): boolean {
return SETTING_CODE_MANAGED_KEYS.has(String(key ?? '').trim())
}
/**
* دسترسی مشتری به قابلیت‌ها — مالک: سوپرادمین.
* در پنل خانگی دیده می‌شوند ولی ذخیره‌شان ۴۰۳ می‌گیرد، پس فقط‌خواندنی‌اند.
* هم‌تراز SuperAdminProgramSettingsOverlay::SUPERADMIN_OWNED_KEYS در سرور.
*/
export const SUPERADMIN_OWNED_SETTING_KEYS = new Set([
'customer_direct_sms',
'customer_special_pricing',
'enable_conditional_order',
'enable_customer_level_profit',
'enable_product_funds',
'group_sms',
'has_page_earn_money',
'has_page_gift_card',
'has_page_notification',
'has_page_price_trigger',
'jibit_enabled',
'permision__enabled',
'show_to_users_chat',
])
export function isSuperAdminOwnedSettingKey(key?: string | null): boolean {
return SUPERADMIN_OWNED_SETTING_KEYS.has(String(key ?? '').trim())
}
/** کلیدهای legacy — در پنل نمایش داده نمی‌شوند */
export const HIDDEN_LEGACY_SETTING_KEYS = new Set([
'main_product_price',
@@ -0,0 +1,63 @@
/** کلیدهای تنظیمات ساعت کاری — فقط در صفحه «ساعت کاری» ویرایش می‌شوند */
export const TRADING_HOURS_SETTING_KEYS = [
'close_price',
'startDay',
'endDay',
'show_last_price',
'show_home_price_when_closed',
'show_gold_ounce_price',
'trading_hours_by_day',
] as const
export type TradingHoursSettingKey = (typeof TRADING_HOURS_SETTING_KEYS)[number]
export const TRADING_HOURS_SETTING_KEY_SET = new Set<string>(TRADING_HOURS_SETTING_KEYS)
export type WeekdayKey = 'sat' | 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri'
export type DaySchedule = {
enabled: boolean
start: string
end: string
}
export type WeeklyScheduleDraft = {
mode: 'uniform' | 'per_day'
days: Record<WeekdayKey, DaySchedule>
}
export const WEEKDAY_DEFS: { key: WeekdayKey; label: string; short: string }[] = [
{ key: 'sat', label: 'شنبه', short: 'ش' },
{ key: 'sun', label: 'یکشنبه', short: 'ی' },
{ key: 'mon', label: 'دوشنبه', short: 'د' },
{ key: 'tue', label: 'سه‌شنبه', short: 'س' },
{ key: 'wed', label: 'چهارشنبه', short: 'چ' },
{ key: 'thu', label: 'پنجشنبه', short: 'پ' },
{ key: 'fri', label: 'جمعه', short: 'ج' },
]
export const DEFAULT_DAY_START = '09:00:00'
export const DEFAULT_DAY_END = '22:00:00'
export function defaultDaySchedule(start = DEFAULT_DAY_START, end = DEFAULT_DAY_END): DaySchedule {
return { enabled: true, start, end }
}
export function defaultWeeklySchedule(
start = DEFAULT_DAY_START,
end = DEFAULT_DAY_END
): WeeklyScheduleDraft {
const day = defaultDaySchedule(start, end)
return {
mode: 'uniform',
days: {
sat: { ...day },
sun: { ...day },
mon: { ...day },
tue: { ...day },
wed: { ...day },
thu: { ...day },
fri: { ...day },
},
}
}