fix(admin): apply SuperAdmin flags on بروزرسانی and fix overlay card keys
Pull live program-settings, set menu flags from the response, and key setting cards by setting key so id-null overlay rows no longer share one toggle state. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -283,6 +283,33 @@ export function applyCustomerSpecialPricingFromRows(
|
||||
if (row) setCustomerSpecialPricingEnabledFromSettings(isSwitchOn(row.value))
|
||||
}
|
||||
|
||||
/** بعد از همگامسازی سوپرادمین — bootstrap بعدی دوباره از API میخواند */
|
||||
export function invalidateSettingsBootstrap(): void {
|
||||
settingsBootstrapped = false
|
||||
}
|
||||
|
||||
/**
|
||||
* اعمال مستقیم ۱۴ دسترسی سوپرادمین روی فلگهای منو/UI
|
||||
* (پاسخ refresh-superadmin.items یا ردیفهای get_settings).
|
||||
*/
|
||||
export function applySuperAdminAccessFlagsFromItems(
|
||||
items: Record<string, string> | Array<{ key?: string; value?: string | null }>
|
||||
): void {
|
||||
const rows = Array.isArray(items)
|
||||
? items
|
||||
: Object.entries(items).map(([key, value]) => ({ key, value }))
|
||||
applyCustomerDirectSmsFromRows(rows)
|
||||
applyGroupSmsFromRows(rows)
|
||||
applyCustomerSpecialPricingFromRows(rows)
|
||||
applyConditionalOrderEnabledFromRows(rows)
|
||||
applyAutomationEnabledFromRows(rows)
|
||||
applyProductFundsEnabledFromRows(rows)
|
||||
applyCustomerLevelProfitEnabledFromRows(rows)
|
||||
applyPriceTriggerEnabledFromRows(rows)
|
||||
applyAppNotificationEnabledFromRows(rows)
|
||||
applySupportChatMenuEnabledFromRows(rows)
|
||||
}
|
||||
|
||||
export function applyConditionalOrderEnabledFromRows(
|
||||
rows: Array<{ key?: string; value?: string | null }>
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user