This commit is contained in:
2026-06-12 20:30:00 +03:30
parent 19064b8a50
commit a14f1587c6
10 changed files with 92 additions and 19 deletions
+11 -2
View File
@@ -171,14 +171,16 @@ import type { FormInstance } from 'ant-design-vue'
import { message } from 'ant-design-vue'
import type { Const } from '@/model/configuration'
import { loading } from '@/utils'
import { getConfiguration, setConfiguration } from '@/api/configuration'
import { getEditableConfiguration, setConfiguration } from '@/api/configuration'
import SettingValueField from './SettingValueField.vue'
import SettingCard from './SettingCard.vue'
import { setStoreModeFromSettings } from '@/utils/config'
import {
SETTING_TYPE_OPTIONS,
formatValueForSave,
helpText,
isSettingVisible,
isSwitchOn,
resolveSettingFieldType
} from './settingTypes'
@@ -410,7 +412,11 @@ onMounted(() => {
async function initConfig() {
try {
loading.value = true
baseData.value = (await getConfiguration()) ?? []
baseData.value = (await getEditableConfiguration()) ?? []
const storeRow = baseData.value.find((row) => row.key === 'is_store')
if (storeRow) {
setStoreModeFromSettings(isSwitchOn(storeRow.value))
}
syncDraftsFromBase()
} catch (e) {
console.error(e)
@@ -481,6 +487,9 @@ async function saveSettingRow(row: Const, overrides?: { isActive?: boolean }) {
row.value = value
row.is_active = isActive
drafts.value[id] = value
if (row.key === 'is_store') {
setStoreModeFromSettings(isSwitchOn(value))
}
savedFlashIds.value.add(id)
if (saveTimers.has(id)) clearTimeout(saveTimers.get(id))
saveTimers.set(
@@ -5,7 +5,6 @@ export type SettingFieldType = 'text' | 'number' | 'switch' | 'select' | 'longte
/** کلیدهای legacy — در پنل نمایش داده نمی‌شوند (جایگزین: price_provider) */
export const HIDDEN_LEGACY_SETTING_KEYS = new Set([
'tabanGohar_price',
'main_product_price',
'montzar_price',
'etehadie_api_url',
@@ -149,7 +148,7 @@ export function parseSelectOptions(
source = source.split('|').pop() || ''
}
const deprecatedOpts = new Set(['taban_gohar', 'etehadie'])
const deprecatedOpts = new Set(['etehadie'])
const opts = source
.split(',')
.map((s) => s.trim())