@php $resolvePreviewImage = function ($value, $default) { if (empty($value)) { return $default; } if (\Illuminate\Support\Str::startsWith($value, ['http://', 'https://', 'data:'])) { return $value; } $normalizedValue = ltrim($value, '/'); $candidates = [$normalizedValue]; if (!\Illuminate\Support\Str::startsWith($normalizedValue, 'uploads/')) { $candidates[] = 'uploads/' . $normalizedValue; } if (!\Illuminate\Support\Str::startsWith($normalizedValue, 'storage/')) { $candidates[] = 'storage/' . $normalizedValue; } $candidates[] = 'assets/admin/images/' . $normalizedValue; foreach ($candidates as $candidate) { if (file_exists(public_path($candidate))) { return asset($candidate); } } return asset($normalizedValue); }; $websiteLogoValue = $settings->website_logo ?? null; $websiteLogoPreview = $resolvePreviewImage($websiteLogoValue, asset('assets/web/images/logo.svg')); $faviconValue = $settings->favicon ?? null; $faviconPreview = $resolvePreviewImage($faviconValue, asset('assets/web/images/logo.svg')); $generalFields = [ ['name' => 'website_name', 'type' => 'text', 'icon' => 'fal fa-globe'], ['name' => 'keywords', 'type' => 'text', 'icon' => 'fal fa-tags'], ['name' => 'meta_description', 'type' => 'text', 'icon' => 'fal fa-align-left'], ['name' => 'vat_value', 'type' => 'number', 'icon' => 'fal fa-percent', 'min' => 0, 'max' => 100], ]; $mailFields = [ ['name' => 'mail_driver', 'type' => 'text', 'icon' => 'fal fa-envelope-open-text'], ['name' => 'mail_host', 'type' => 'text', 'icon' => 'fal fa-server'], ['name' => 'mail_port', 'type' => 'number', 'icon' => 'fal fa-network-wired'], ['name' => 'mail_username', 'type' => 'text', 'icon' => 'fal fa-user'], ['name' => 'mail_password', 'type' => 'password', 'icon' => 'fal fa-lock-alt'], ['name' => 'mail_encryption', 'type' => 'text', 'icon' => 'fal fa-shield-check'], ['name' => 'mail_from_address', 'type' => 'email', 'icon' => 'fal fa-at'], ['name' => 'mail_from_name', 'type' => 'text', 'icon' => 'fal fa-signature'], ]; $contactFields = [ ['name' => 'site_phone', 'type' => 'tel', 'icon' => 'fal fa-phone-alt'], ['name' => 'site_email', 'type' => 'email', 'icon' => 'fal fa-envelope'], ['name' => 'site_address_ar', 'type' => 'text', 'icon' => 'fal fa-map-marker-alt'], ['name' => 'site_address_en', 'type' => 'text', 'icon' => 'fal fa-map-marker-alt'], ]; $socialFields = [ ['name' => 'whatsapp', 'type' => 'text', 'icon' => 'fab fa-whatsapp'], ['name' => 'instagram', 'type' => 'text', 'icon' => 'fab fa-instagram'], ['name' => 'twitter', 'type' => 'text', 'icon' => 'fab fa-x-twitter'], ['name' => 'facebook', 'type' => 'text', 'icon' => 'fab fa-facebook-f'], ]; @endphp

{{ __('settings.head') }}

{{ __('settings.overview_note') }}

{{ __('settings.edit') }}
@if ($settings) @endif @csrf

{{ __('settings.general_section') }}

{{ __('settings.general_section_note') }}

@foreach ($generalFields as $field)
@if ($errors->has($field['name']))
{{ $errors->first($field['name']) }}
@endif
@endforeach

{{ __('settings.mail_section') }}

{{ __('settings.mail_section_note') }}

@foreach ($mailFields as $field)
@if ($errors->has($field['name']))
{{ $errors->first($field['name']) }}
@endif
@endforeach

{{ __('settings.contact_section') }}

{{ __('settings.contact_section_note') }}

@foreach ($contactFields as $field)
@if ($errors->has($field['name']))
{{ $errors->first($field['name']) }}
@endif
@endforeach

{{ __('settings.social_section') }}

{{ __('settings.social_section_note') }}

@foreach ($socialFields as $field)
@if ($errors->has($field['name']))
{{ $errors->first($field['name']) }}
@endif
@endforeach

{{ __('settings.branding_section') }}

{{ __('settings.branding_section_note') }}

{{ $websiteLogoValue ? basename($websiteLogoValue) : __('settings.no_file_selected') }}
{{ __('settings.logo_help') }}
@if ($errors->has('website_logo'))
{{ $errors->first('website_logo') }}
@endif
{{ $faviconValue ? basename($faviconValue) : __('settings.no_file_selected') }}
{{ __('settings.favicon_help') }}
@if ($errors->has('favicon'))
{{ $errors->first('favicon') }}
@endif