new check for kashkol

This commit is contained in:
2026-06-12 16:09:04 +03:30
parent 433b2ed15c
commit 19064b8a50
2 changed files with 36 additions and 5 deletions
+7 -2
View File
@@ -178,6 +178,7 @@ import {
SETTING_TYPE_OPTIONS,
formatValueForSave,
helpText,
isSettingVisible,
resolveSettingFieldType
} from './settingTypes'
@@ -263,7 +264,11 @@ function matchesFilter(row: Const): boolean {
const filteredRows = computed(() =>
sortRows(
(baseData.value || []).filter(
(row) => row.id != null && isEditable(row) && matchesFilter(row)
(row) =>
row.id != null &&
isEditable(row) &&
isSettingVisible(row.key) &&
matchesFilter(row)
)
)
)
@@ -310,7 +315,7 @@ const SETTING_GROUPS: Array<{
title: 'ویژگی‌ها و صفحات',
icon: 'vuesax-linear:menu',
match: (k) =>
/^(has_page_|has_chat|display_montzar|close_price|startDay|endDay|auto_active|open_register|charge_notif|group_sms|show_last_price|product_update|product_auto_close|goldir_price|tabanGohar_price|main_product_price|is_store|store_status)/.test(k)
/^(has_page_|has_chat|display_montzar|close_price|startDay|endDay|auto_active|open_register|charge_notif|group_sms|show_last_price|product_update|product_auto_close|is_store|store_status)/.test(k)
},
{
id: 'integrations',
@@ -1,7 +1,30 @@
import type { Const } from '@/model/configuration'
import { isStoreApp } from '@/utils/config'
export type SettingFieldType = 'text' | 'number' | 'switch' | 'select' | 'longtext'
/** کلیدهای legacy — در پنل نمایش داده نمی‌شوند (جایگزین: price_provider) */
export const HIDDEN_LEGACY_SETTING_KEYS = new Set([
'tabanGohar_price',
'main_product_price',
'montzar_price',
'etehadie_api_url',
'goldir_price',
'price_primary_source',
'price_method'
])
/** فقط وقتی is_store فعال است در پنل دیده می‌شوند */
export const STORE_ONLY_SETTING_KEYS = new Set(['store_status'])
export function isSettingVisible(key: string | undefined | null): boolean {
const k = (key || '').trim()
if (!k) return false
if (HIDDEN_LEGACY_SETTING_KEYS.has(k)) return false
if (STORE_ONLY_SETTING_KEYS.has(k) && !isStoreApp()) return false
return true
}
export const SETTING_TYPE_OPTIONS = [
{ key: 'text', value: 'متن کوتاه' },
{ key: 'number', value: 'عدد' },
@@ -37,7 +60,6 @@ const KEY_TYPE_FALLBACK: Record<string, SettingFieldType> = {
close_price: 'switch',
montzar_price: 'switch',
main_product_price: 'switch',
tabanGohar_price: 'switch',
show_last_price: 'switch',
send_to_tahesab: 'switch',
profit_gold_api_enabled: 'switch',
@@ -96,7 +118,7 @@ const SELECT_LABELS_BY_KEY: Record<string, Record<string, string>> = {
}
const SELECT_OPTIONS_BY_KEY: Record<string, string> = {
price_provider: 'montzar,zaarbox,main_product,taban_gohar',
price_provider: 'montzar,zaarbox,main_product',
referral_id: 'required,',
payping_gateway_name: 'sepal,',
credit_rial_price_unit: 'gram,mesghal,unit',
@@ -127,7 +149,11 @@ export function parseSelectOptions(
source = source.split('|').pop() || ''
}
const opts = source.split(',').map((s) => s.trim())
const deprecatedOpts = new Set(['taban_gohar', 'etehadie'])
const opts = source
.split(',')
.map((s) => s.trim())
.filter((opt) => opt !== '' && !(row.key === 'price_provider' && deprecatedOpts.has(opt)))
const labels = row.key ? SELECT_LABELS_BY_KEY[row.key] : undefined
return opts.map((opt) => ({
key: opt,