added chat 2
This commit is contained in:
@@ -174,7 +174,7 @@ import SettingValueField from './SettingValueField.vue'
|
||||
import SettingCard from './SettingCard.vue'
|
||||
import { refreshAppModeMenu } from '@/router'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import { applyBannerEnabledFromRows, applyTrackingSystemsEnabledFromRows, applyConditionalOrderEnabledFromRows, applyPriceTriggerEnabledFromRows, applyAppNotificationEnabledFromRows, applyPriceProviderFromRows, setBannerEnabledFromSettings, setConditionalOrderEnabledFromSettings, setPriceTriggerEnabledFromSettings, setAppNotificationEnabledFromSettings, setPriceProviderFromSettings, setStoreModeFromSettings, setTrackingSystemsEnabledFromSettings } from '@/utils/config'
|
||||
import { applyBannerEnabledFromRows, applyTrackingSystemsEnabledFromRows, applyConditionalOrderEnabledFromRows, applyPriceTriggerEnabledFromRows, applyAppNotificationEnabledFromRows, applyPriceProviderFromRows, applySupportChatMenuEnabledFromRows, setBannerEnabledFromSettings, setConditionalOrderEnabledFromSettings, setPriceTriggerEnabledFromSettings, setAppNotificationEnabledFromSettings, setPriceProviderFromSettings, setStoreModeFromSettings, setTrackingSystemsEnabledFromSettings } from '@/utils/config'
|
||||
import {
|
||||
EDITABLE_SETTING_GROUPS,
|
||||
SYSTEM_SETTING_GROUPS,
|
||||
@@ -426,12 +426,14 @@ async function initConfig() {
|
||||
applyPriceTriggerEnabledFromRows(baseData.value)
|
||||
applyAppNotificationEnabledFromRows(baseData.value)
|
||||
applyPriceProviderFromRows(baseData.value)
|
||||
applySupportChatMenuEnabledFromRows(baseData.value)
|
||||
// در صفحهٔ عادی price_provider (can_edit=0) نیست — از کل تنظیمات بخوان
|
||||
if (!baseData.value.some((row) => row.key === 'price_provider')) {
|
||||
try {
|
||||
const { getConfiguration } = await import('@/api/configuration')
|
||||
const all = await getConfiguration()
|
||||
applyPriceProviderFromRows(Array.isArray(all) ? all : [])
|
||||
applySupportChatMenuEnabledFromRows(Array.isArray(all) ? all : [])
|
||||
} catch {
|
||||
/* کش قبلی میماند */
|
||||
}
|
||||
@@ -483,6 +485,16 @@ function syncMenuFlagsFromSetting(key: string | undefined, value: string) {
|
||||
}
|
||||
if (key === 'has_page_notification') {
|
||||
setAppNotificationEnabledFromSettings(isSwitchOn(value))
|
||||
return
|
||||
}
|
||||
if (key === 'show_to_users_chat' || key === 'has_chat' || key === 'chat_api') {
|
||||
applySupportChatMenuEnabledFromRows([{ key, value }])
|
||||
// همگام با settings داخل userInfo تا گیت روت/هدر بعد از رفرش هم درست باشد
|
||||
const list = userStore.userInfo?.settings
|
||||
if (Array.isArray(list)) {
|
||||
const row = list.find((s: any) => s?.key === key)
|
||||
if (row) row.value = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user