@php $canManageGeneral = auth()->user()?->canAny(['manage_settings_general', 'manage_settings', 'update_settings']) ?? false; $canManagePublic = auth()->user()?->canAny(['manage_settings_public_site', 'manage_settings', 'update_settings']) ?? false; $canManagePricing = auth()->user()?->canAny(['manage_settings_pricing', 'manage_pricing_settings']) ?? false; $canManageWallets = auth()->user()?->canAny(['manage_settings_wallets', 'manage_settings']) ?? false; $canManageRequests = auth()->user()?->canAny(['manage_settings_requests', 'manage_settings']) ?? false; $canManageSecurity = auth()->user()?->canAny(['manage_settings_security', 'manage_settings']) ?? false; $canManageMaintenance = auth()->user()?->canAny(['manage_system_maintenance', 'manage_sensitive_settings']) ?? false; $canManageNotifications = auth()->user()?->canAny(['manage_settings_notifications', 'manage_settings']) ?? false; $canManageLogs = auth()->user()?->canAny(['manage_settings_logs', 'manage_settings']) ?? false; $canCreateManualBackup = auth()->user()?->can('create_manual_backup') ?? false; $canManageBackupSchedule = auth()->user()?->can('manage_backup_schedule') ?? false; $canViewBackupLogs = auth()->user()?->canAny(['view_backup_logs', 'view_backup_center']) ?? false; $canDownloadBackupFiles = auth()->user()?->can('download_backup_files') ?? false; $canDeleteBackupFiles = auth()->user()?->can('delete_backup_files') ?? false; $canValidateRestore = auth()->user()?->can('validate_backup_before_restore') ?? false; $canRestoreBackup = (auth()->user()?->can('restore_backup') ?? false) && (auth()->user()?->can('approve_critical_restore') ?? false); $canRestoreDb = auth()->user()?->can('restore_database_backup') ?? false; $canRestoreFiles = auth()->user()?->can('restore_files_backup') ?? false; $canViewRestoreLogs = auth()->user()?->canAny(['view_restore_logs', 'view_restore_center']) ?? false; $canViewGoogleDrive = auth()->user()?->canAny(['view_google_drive_settings', 'manage_google_drive_backup']) ?? false; $canConnectGoogleDrive = auth()->user()?->can('connect_google_drive') ?? false; $canDisconnectGoogleDrive = auth()->user()?->can('disconnect_google_drive') ?? false; $canTestGoogleDrive = auth()->user()?->can('test_google_drive_connection') ?? false; $canViewSettingsAudit = auth()->user()?->canAny(['view_settings_audit_log', 'view_configuration_history']) ?? false; $defaultTranslations = \App\Models\SiteSetting::defaultAttributes(); $translationValue = static function (string $field, string $locale) use ($siteSettings, $defaultTranslations) { return old( "{$field}.{$locale}", data_get($siteSettings->{$field} ?? [], $locale, data_get($defaultTranslations, "{$field}.{$locale}", '')) ); }; $tabDefinitions = [ 'general' => __('messages.settings_tab_general'), 'public' => __('messages.settings_tab_public_site'), 'pricing' => __('messages.settings_tab_pricing'), 'wallets' => __('messages.settings_tab_wallets'), 'requests' => __('messages.settings_tab_requests'), 'security' => __('messages.settings_tab_security'), 'notifications' => __('messages.settings_tab_notifications'), 'logs' => __('messages.settings_tab_logs'), 'backup' => __('messages.settings_tab_backup'), ]; @endphp

{{ __('messages.settings_center_title') }}

{{ __('messages.settings_center_subtitle') }}

@foreach ($tabDefinitions as $tabKey => $tabLabel) @continue(!($tabs[$tabKey] ?? false)) @php $isActiveTab = $activeTab === $tabKey; @endphp {{ $tabLabel }} @endforeach
@if ($activeTab === 'general' && ($tabs['general'] ?? false))
@csrf @method('PUT')

{{ __('messages.trash_retention_days_hint') }}

{{ __('messages.footer_developer') }} - WhatsApp 00963994806517
@if ($canManageGeneral) {{ __('messages.save_settings') }} @endif
@endif @if ($activeTab === 'public' && ($tabs['public'] ?? false))
@csrf @method('PUT')
@foreach ($locales as $locale)

{{ strtoupper($locale) }}

@endforeach
@if ($canManagePublic) {{ __('messages.save_settings') }} @endif
@endif @if ($activeTab === 'pricing' && ($tabs['pricing'] ?? false))
@csrf @method('PUT')
@if ($canManagePricing) {{ __('messages.save_settings') }} @endif
@endif @if ($activeTab === 'wallets' && ($tabs['wallets'] ?? false))
@csrf @method('PUT')
@if ($canManageWallets) {{ __('messages.save_settings') }} @endif
@endif @if ($activeTab === 'requests' && ($tabs['requests'] ?? false))
@csrf @method('PUT')
@php $modeValue = old('requests.default_submission_mode', $system['requests.default_submission_mode'] ?? 'review'); @endphp
@if ($canManageRequests) {{ __('messages.save_settings') }} @endif
@endif @if ($activeTab === 'security' && ($tabs['security'] ?? false))
@csrf @method('PUT')
@if ($canManageSecurity) {{ __('messages.save_settings') }} @endif
@csrf @method('PUT')
@if ($canManageMaintenance) {{ __('messages.save_settings') }} @endif
@endif @if ($activeTab === 'notifications' && ($tabs['notifications'] ?? false))
@csrf @method('PUT')
@if ($canManageNotifications) {{ __('messages.save_settings') }} @endif
@endif @if ($activeTab === 'logs' && ($tabs['logs'] ?? false))
@csrf @method('PUT')
@if ($canManageLogs) {{ __('messages.save_settings') }} @endif

{{ __('messages.settings_compatibility_map') }}

@forelse($compatibilityMap as $row) @empty @endforelse
{{ __('messages.section') }} {{ __('messages.source') }} {{ __('messages.endpoint') }}
{{ $row['section'] }} {{ $row['source'] }} {{ $row['endpoint'] }}
{{ __('messages.no_data') }}
@if ($canViewSettingsAudit)

{{ __('messages.settings_audit_log_title') }}

@forelse($settingsAuditLogs as $log) @empty @endforelse
{{ __('messages.created_at') }} {{ __('messages.user') }} {{ __('messages.category') }} {{ __('messages.key') }} {{ __('messages.action') }}
{{ optional($log->created_at)->format('Y-m-d H:i') }} {{ $log->user?->name ?? __('messages.not_available') }} {{ $log->category }} {{ $log->setting_key }} {{ $log->action }}
{{ __('messages.no_data') }}
@endif
@endif @if ($activeTab === 'backup' && ($tabs['backup'] ?? false))
@if ($canCreateManualBackup)
@csrf

{{ __('messages.backup_manual_run_title') }}

{{ __('messages.backup_run_now') }}
@endif @if ($canManageBackupSchedule)
@csrf @method('PUT')

{{ __('messages.backup_settings_title') }}

@php $scheduleFrequency = old('backup.schedule_frequency', $system['backup.schedule_frequency'] ?? 'daily'); @endphp
@php $contentMode = old('backup.content_mode', $system['backup.content_mode'] ?? 'db_files'); @endphp
{{ __('messages.save_settings') }}
@endif @if ($canViewGoogleDrive)

{{ __('messages.google_drive_settings_title') }}

{{ __('messages.google_drive_connected_status') }}: {{ ($system['backup.google_drive_connected'] ?? false) ? __('messages.yes') : __('messages.no') }}

@if ($canConnectGoogleDrive)
@csrf
{{ __('messages.google_drive_connect') }}
@endif
@if ($canTestGoogleDrive)
@csrf
@endif @if ($canDisconnectGoogleDrive)
@csrf
@endif
@endif @if ($canViewBackupLogs)

{{ __('messages.backup_runs_title') }}

@forelse ($backupRuns as $run) @empty @endforelse
# {{ __('messages.type') }} {{ __('messages.status') }} {{ __('messages.created_at') }} {{ __('messages.actions') }}
{{ $run->id }} {{ $run->backup_type }} {{ $run->status }} {{ optional($run->created_at)->format('Y-m-d H:i') }}
@if ($canDownloadBackupFiles && $run->archive_path) {{ __('messages.download') }} @endif @if ($canDeleteBackupFiles)
@csrf @method('DELETE')
@endif @if ($canValidateRestore)
@csrf
@endif @if ($canRestoreBackup)
@csrf
@endif
{{ __('messages.no_data') }}
@endif @if ($canViewRestoreLogs)

{{ __('messages.restore_logs_title') }}

@forelse ($restoreLogs as $log) @empty @endforelse
# {{ __('messages.type') }} {{ __('messages.status') }} {{ __('messages.user') }} {{ __('messages.created_at') }}
{{ $log->id }} {{ $log->restore_type }} {{ $log->status }} {{ $log->restoredBy?->name ?? __('messages.not_available') }} {{ optional($log->created_at)->format('Y-m-d H:i') }}
{{ __('messages.no_data') }}
@endif
@endif