all customer fixing added

This commit is contained in:
2026-07-22 00:10:29 +03:30
parent 2f64c6cce7
commit 21dbaa1e31
10 changed files with 398 additions and 92 deletions
+16
View File
@@ -40,6 +40,9 @@ export const pargarEnabledSetting = ref(false)
/** reactive — دکمه پیامک تکی در لیست مشتریان */
export const customerDirectSmsEnabledSetting = ref(false)
/** reactive — منو و UI سفارش شرطی (ادمین + کنترل‌های مشتری) */
export const conditionalOrderEnabledSetting = ref(false)
export const accountingProviderSetting = ref<AccountingProvider>('none')
let tahesabEnabledFromSettings: boolean | null = null
@@ -112,6 +115,10 @@ export function setCustomerDirectSmsEnabledFromSettings(value: boolean): void {
customerDirectSmsEnabledSetting.value = value
}
export function setConditionalOrderEnabledFromSettings(value: boolean): void {
conditionalOrderEnabledSetting.value = value
}
export function applyBannerEnabledFromRows(rows: Array<{ key?: string; value?: string | null }>) {
const row = rows.find((item) => item.key === 'banner_enabled')
setBannerEnabledFromSettings(row ? isSwitchOn(row.value) : false)
@@ -129,6 +136,13 @@ export function applyCustomerDirectSmsFromRows(rows: Array<{ key?: string; value
setCustomerDirectSmsEnabledFromSettings(row ? isSwitchOn(row.value) : false)
}
export function applyConditionalOrderEnabledFromRows(
rows: Array<{ key?: string; value?: string | null }>
) {
const row = rows.find((item) => item.key === 'enable_conditional_order')
setConditionalOrderEnabledFromSettings(row ? isSwitchOn(row.value) : false)
}
async function bootstrapSettingsFromApi(): Promise<void> {
if (settingsBootstrapped) return
@@ -145,6 +159,7 @@ async function bootstrapSettingsFromApi(): Promise<void> {
applyBannerEnabledFromRows(list)
applyTrackingSystemsEnabledFromRows(list)
applyCustomerDirectSmsFromRows(list)
applyConditionalOrderEnabledFromRows(list)
setCachedMainMetal(mainMetalRow?.value)
const { setCachedMainWalletProductIds } = await import('@/components/mobile/utils/wallet')
setCachedMainWalletProductIds(parseMainWalletProductIds(mainWalletRow?.value))
@@ -153,6 +168,7 @@ async function bootstrapSettingsFromApi(): Promise<void> {
setBannerEnabledFromSettings(false)
setTrackingSystemsEnabledFromSettings(false)
setCustomerDirectSmsEnabledFromSettings(false)
setConditionalOrderEnabledFromSettings(false)
applyAccountingProviderFromRows([])
setCachedMainMetal(null)
const { setCachedMainWalletProductIds } = await import('@/components/mobile/utils/wallet')