{{ $stat['label'] }}
{{ $stat['value'] }}
@extends('layouts.main_dashboard.app') @section('title', match($type) { 'email' => __('dashboard.Email Settings'), 'security' => __('dashboard.Security Settings'), default => __('dashboard.General Settings') }) @section('skip_page_hero', true) @section('content') @php $isAr = app()->getLocale() === 'ar'; $settingsCollection = collect($settings ?? []); $localSettingsMap = $settingsCollection->keyBy('key'); $cachedSettingsCollection = collect($cachedSettings ?? []); $cachedSettingsByKey = collect($cachedSettingsMap ?? []); $resolveSetting = function (string $key) use ($localSettingsMap, $cachedSettingsByKey) { return $localSettingsMap->get($key) ?? $cachedSettingsByKey->get($key); }; $pageTitle = match($type) { 'email' => __('dashboard.Email Settings'), 'security' => __('dashboard.Security Settings'), default => __('dashboard.General Settings'), }; $pageDescription = match($type) { 'email' => $isAr ? 'إدارة إعدادات الإرسال والبريد من واجهة أوضح، مع اختبار مباشر لقناة SMTP.' : 'Manage delivery and email settings from a clearer workspace with direct SMTP testing.', 'security' => $isAr ? 'ضبط طبقات الحماية ومحاولات الدخول من واجهة مستقرة وواضحة بدون تعقيد بصري.' : 'Configure protection tiers and login attempts from a stable, clearer interface.', default => $isAr ? 'إدارة إعدادات المنصة الأساسية والهوية العامة من واجهة موحّدة وبسيطة.' : 'Manage core platform settings and identity from a unified, simpler interface.', }; $typeSettings = match ($type) { 'general', 'email' => ($settingsCollection->isNotEmpty() ? $settingsCollection : $cachedSettingsCollection->where('type', $type)->values()), 'security' => collect([ $resolveSetting('login_security_enabled'), $resolveSetting('login_attempts_tier1'), $resolveSetting('login_lockout_tier1'), $resolveSetting('login_attempts_tier2'), $resolveSetting('login_lockout_tier2'), $resolveSetting('login_attempts_tier3'), $resolveSetting('login_lockout_tier3'), $resolveSetting('login_attempts_permanent'), $resolveSetting('login_repeat_window_minutes'), $resolveSetting('login_source_attempts_limit'), $resolveSetting('login_source_accounts_limit'), $resolveSetting('login_source_lockout_minutes'), $resolveSetting('trash_force_delete_password'), ])->filter()->values(), default => collect(), }; $masterSecuritySetting = $resolveSetting('login_security_enabled'); $labelMap = [ 'app_name' => $isAr ? 'اسم المنصة' : 'Platform Name', 'app_logo' => $isAr ? 'شعار المنصة' : 'Platform Logo', 'app_favicon' => $isAr ? 'أيقونة المنصة' : 'Platform Icon', 'app_description' => $isAr ? 'وصف المنصة' : 'Platform Description', 'app_phone' => $isAr ? 'هاتف المنصة' : 'Platform Phone', 'app_email' => $isAr ? 'بريد المنصة' : 'Platform Email', 'app_address' => $isAr ? 'عنوان المنصة' : 'Platform Address', 'mail_mailer' => $isAr ? 'برنامج الإرسال' : 'Mailer', 'mail_host' => $isAr ? 'خادم البريد' : 'Mail Host', 'mail_port' => $isAr ? 'منفذ البريد' : 'Mail Port', 'mail_username' => $isAr ? 'اسم مستخدم البريد' : 'Mail Username', 'mail_password' => $isAr ? 'كلمة مرور البريد' : 'Mail Password', 'mail_encryption' => $isAr ? 'تشفير البريد' : 'Mail Encryption', 'mail_from_address' => $isAr ? 'بريد المرسل' : 'From Address', 'mail_from_name' => $isAr ? 'اسم المرسل' : 'From Name', 'login_security_enabled' => $isAr ? 'حماية تسجيل الدخول' : 'Login Protection', 'login_attempts_tier1' => $isAr ? 'محاولات المستوى الأول' : 'Tier 1 Attempts', 'login_lockout_tier1' => $isAr ? 'قفل المستوى الأول' : 'Tier 1 Lockout', 'login_attempts_tier2' => $isAr ? 'محاولات المستوى الثاني' : 'Tier 2 Attempts', 'login_lockout_tier2' => $isAr ? 'قفل المستوى الثاني' : 'Tier 2 Lockout', 'login_attempts_tier3' => $isAr ? 'محاولات المستوى الثالث' : 'Tier 3 Attempts', 'login_lockout_tier3' => $isAr ? 'قفل المستوى الثالث' : 'Tier 3 Lockout', 'login_attempts_permanent' => $isAr ? 'محاولات الحظر النهائي' : 'Permanent Lock Attempts', 'login_repeat_window_minutes' => $isAr ? 'نافذة التكرار بالدقائق' : 'Repeat Window (Minutes)', 'login_source_attempts_limit' => $isAr ? 'حد المحاولات من نفس المصدر' : 'Source Attempt Limit', 'login_source_accounts_limit' => $isAr ? 'عدد الحسابات المختلفة من نفس المصدر' : 'Distinct Accounts Limit', 'login_source_lockout_minutes' => $isAr ? 'حظر المصدر بالدقائق' : 'Source Lockout (Minutes)', 'trash_force_delete_password' => $isAr ? 'كلمة سر الحذف النهائي' : 'Permanent Delete Password', ]; $stats = match ($type) { 'email' => [ ['label' => $isAr ? 'إعدادات البريد' : 'Email Settings', 'value' => $typeSettings->count()], ['label' => $isAr ? 'برنامج الإرسال' : 'Mailer', 'value' => $resolveSetting('mail_mailer')?->value ?: '—'], ['label' => $isAr ? 'عنوان الإرسال' : 'From Address', 'value' => $resolveSetting('mail_from_address')?->value ?: '—'], ], 'security' => [ ['label' => $isAr ? 'الحماية' : 'Protection', 'value' => ($masterSecuritySetting?->value ?? '0') === '1' ? ($isAr ? 'مفعلة' : 'Enabled') : ($isAr ? 'غير مفعلة' : 'Disabled')], ['label' => $isAr ? 'طبقات التقييد' : 'Protection Tiers', 'value' => 4], ['label' => $isAr ? 'الحظر النهائي' : 'Permanent Lock', 'value' => $resolveSetting('login_attempts_permanent')?->value ?: '—'], ['label' => $isAr ? 'نافذة التكرار' : 'Repeat Window', 'value' => ($resolveSetting('login_repeat_window_minutes')?->value ?: '—') . ' ' . ($isAr ? 'دقيقة' : 'min')], ['label' => $isAr ? 'حد المحاولات من المصدر' : 'Source Attempt Limit', 'value' => $resolveSetting('login_source_attempts_limit')?->value ?: '—'], ['label' => $isAr ? 'حظر المصدر' : 'Source Lockout', 'value' => ($resolveSetting('login_source_lockout_minutes')?->value ?: '—') . ' ' . ($isAr ? 'دقيقة' : 'min')], ['label' => $isAr ? 'كلمة سر الحذف النهائي' : 'Permanent Delete Password', 'value' => filled($resolveSetting('trash_force_delete_password')?->value) ? ($isAr ? 'مضبوطة' : 'Configured') : ($isAr ? 'غير مضبوطة' : 'Not configured')], ], default => [ ['label' => $isAr ? 'إجمالي الإعدادات' : 'Total Settings', 'value' => $typeSettings->count()], ['label' => $isAr ? 'حقول الملفات' : 'File Fields', 'value' => $typeSettings->where('data_type', 'file')->count()], ['label' => $isAr ? 'الخيارات المفعلة' : 'Enabled Toggles', 'value' => $typeSettings->where('data_type', 'checkbox')->where('value', '1')->count()], ], }; $securityTiers = collect([ [ 'label' => $isAr ? 'المستوى الأول' : 'Tier 1', 'description' => $isAr ? 'حظر قصير للمحاولات المتكررة الأولى.' : 'Short lockout for the first repeated attempts.', 'attempts' => $resolveSetting('login_attempts_tier1'), 'lockout' => $resolveSetting('login_lockout_tier1'), ], [ 'label' => $isAr ? 'المستوى الثاني' : 'Tier 2', 'description' => $isAr ? 'تشديد القيود عند تكرار المحاولات.' : 'Stronger restriction when attempts continue.', 'attempts' => $resolveSetting('login_attempts_tier2'), 'lockout' => $resolveSetting('login_lockout_tier2'), ], [ 'label' => $isAr ? 'المستوى الثالث' : 'Tier 3', 'description' => $isAr ? 'مدة حظر أطول للأنماط الخطرة.' : 'Longer lockout for risky patterns.', 'attempts' => $resolveSetting('login_attempts_tier3'), 'lockout' => $resolveSetting('login_lockout_tier3'), ], [ 'label' => $isAr ? 'الحظر النهائي' : 'Permanent Lock', 'description' => $isAr ? 'إيقاف دائم بعد تجاوز الحد النهائي.' : 'Permanent stop after the final threshold.', 'attempts' => $resolveSetting('login_attempts_permanent'), 'lockout' => null, ], ]); $sourceProtectionSettings = [ 'repeat_window' => $resolveSetting('login_repeat_window_minutes'), 'attempts_limit' => $resolveSetting('login_source_attempts_limit'), 'accounts_limit' => $resolveSetting('login_source_accounts_limit'), 'lockout_minutes' => $resolveSetting('login_source_lockout_minutes'), ]; @endphp
{{ $pageDescription }}
{{ $stat['label'] }}
{{ $stat['value'] }}
{{ __('dashboard.Enter an email address to receive a verification message.') }}