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:
2026-08-29 22:42:30 +03:30
co-authored by Cursor
parent 085c024654
commit 14d2bb603e
2 changed files with 87 additions and 21 deletions
+27
View File
@@ -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 }>
) {