@extends('dashboard.admin.layouts.master') @php $social = old('social_links', $mdata->social_links ?? []); $branches = old('branches', $mdata->branches ?? []); $otherLinks = $social['other'] ?? []; $socialPlatforms = ['facebook', 'instagram', 'linkedin', 'twitter', 'youtube', 'tiktok', 'snapchat']; $socialIcons = ['facebook' => 'bi-facebook', 'instagram' => 'bi-instagram', 'linkedin' => 'bi-linkedin', 'twitter' => 'bi-twitter-x', 'youtube' => 'bi-youtube', 'tiktok' => 'bi-tiktok', 'snapchat' => 'bi-snapchat']; $primaryBranch = $branches[0] ?? []; $fallbackEmail = $mdata?->email ?: ($primaryBranch['email'] ?? ''); $fallbackPhone = $mdata?->phone ?: ($primaryBranch['phone'] ?? ''); $fallbackAddressAr = $mdata?->getTranslation('address', 'ar', false) ?: ($primaryBranch['address'] ?? ''); $fallbackAddressEn = $mdata?->getTranslation('address', 'en', false) ?: ($primaryBranch['address'] ?? ''); $fallbackMapLocation = $mdata?->maplocation ?: ($primaryBranch['location_map'] ?? ''); $visitingHours = old('visiting_hours', $mdata->visiting_hours ?? []); $days = \App\Models\Site\SiteData::DAYS; // Open the tab that holds the first server-side error, so it is not hidden behind another tab. $tabFields = [ 'contact' => ['email', 'phone', 'fax', 'address', 'maplocation', 'branches'], 'social' => array_merge($socialPlatforms, ['social_links']), 'hours' => ['visiting_hours'], 'video' => ['video', 'remove_video_file'], 'seo' => ['seo_', 'contact_seo_'], ]; $activeTab = 'general'; foreach ($errors->keys() as $errorKey) { foreach ($tabFields as $tab => $prefixes) { foreach ($prefixes as $prefix) { if (str_starts_with($errorKey, $prefix)) { $activeTab = $tab; break 3; } } } break; } @endphp @section('toolbar')

{{ trans('dash_site.site_data') }}

@endsection @section('content')
@if ($errors->any())
@endif
@csrf
{{-- General --}}
@error('name.ar')
{{ $message }}
@enderror
@error('name.en')
{{ $message }}
@enderror
@error('short_description.ar')
{{ $message }}
@enderror
@error('short_description.en')
{{ $message }}
@enderror
@include('dashboard.admin.Site.partials.image-input', [ 'name' => 'main_logo', 'id' => 'site_main_logo', 'preview' => $mdata?->main_logo_path ?? asset('assets/media/svg/files/blank-image.svg'), ]) @error('main_logo')
{{ $message }}
@enderror
@include('dashboard.admin.Site.partials.image-input', [ 'name' => 'footer_logo', 'id' => 'site_footer_logo', 'preview' => $mdata?->logo_footer_path ?? asset('assets/media/svg/files/blank-image.svg'), ]) @error('footer_logo')
{{ $message }}
@enderror
@error('profile_pdf')
{{ $message }}
@enderror @if (!empty($mdata?->profile_pdf_url)) @endif
{{-- Contact --}}
@error('email')
{{ $message }}
@enderror
@error('phone')
{{ $message }}
@enderror
@error('fax')
{{ $message }}
@enderror
@error('address.ar')
{{ $message }}
@enderror
@error('address.en')
{{ $message }}
@enderror
@error('maplocation')
{{ $message }}
@enderror

{{ trans('dash_site.branches') }}

@foreach(count($branches) ? $branches : [[]] as $branch)
@endforeach
{{-- Social --}}
@foreach($socialPlatforms as $platform)
@error($platform)
{{ $message }}
@enderror
@endforeach
{{-- Visiting hours --}}
{{ trans('dash_site.visiting_hours_hint') }}
@foreach(count($visitingHours) ? array_values($visitingHours) : [[]] as $i => $row)
@error("visiting_hours.$i.day_from")
{{ $message }}
@enderror
@error("visiting_hours.$i.day_to")
{{ $message }}
@enderror
@error("visiting_hours.$i.time_in")
{{ $message }}
@enderror
@error("visiting_hours.$i.time_out")
{{ $message }}
@enderror
@endforeach
{{-- Video (home About section) --}}
{{ trans('dash_site.video_help') }}
{{ trans('dash_site.video_file_hint') }}
@error('video_file')
{{ $message }}
@enderror @if ($mdata?->video_file_url)
@endif
{{ trans('dash_site.video_link_hint') }}
@error('video')
{{ $message }}
@enderror @if ($mdata?->video) {{ trans('dash_site.video_open_link') }} @endif
{{-- SEO --}}
@include('dashboard.admin.Site.partials.image-input', [ 'name' => 'seo_image', 'id' => 'site_seo_image', 'preview' => $mdata?->seo_image_path ?? asset('assets_web/img/hero/img1.webp'), ]) @error('seo_image')
{{ $message }}
@enderror
@foreach (['' => trans('dash_site.home_seo'), 'contact_' => trans('dash_site.contact_seo')] as $prefix => $heading)

{{ $heading }}

@foreach (['ar', 'en'] as $locale)
getTranslation("{$prefix}seo_title", $locale, false) ?? '') }}" class="form-control @error("{$prefix}seo_title.$locale") is-invalid @enderror"> @error("{$prefix}seo_title.$locale")
{{ $message }}
@enderror
@endforeach @foreach (['ar', 'en'] as $locale)
@error("{$prefix}seo_description.$locale")
{{ $message }}
@enderror
@endforeach @foreach (['ar', 'en'] as $locale)
getTranslation("{$prefix}seo_keywords", $locale, false) ?? '') }}" class="form-control @error("{$prefix}seo_keywords.$locale") is-invalid @enderror"> @error("{$prefix}seo_keywords.$locale")
{{ $message }}
@enderror
@endforeach
@endforeach
@endsection @section('js') {{-- Fields in inactive tabs are display:none, so validate hidden fields too (the default ignores them). --}} {!! JsValidator::formRequest('App\Http\Requests\Site\MainRequest', '#mainDataForm')->ignore("[contenteditable='true']") !!} @endsection