@extends('backend.settings.index') @section('setting_title', __('Site Settings')) @section('setting_content') @php $activeSection = session()->get('section', 'general_settings'); $visibleSettings = collect($settings)->except('hide_settings'); $totalEditableFields = $visibleSettings->sum( fn (array $section): int => collect($section['elements'] ?? []) ->filter(fn (array $field): bool => ($field['type'] ?? null) !== 'hidden') ->count() ); $settingFieldClass = static function (array $field): string { return $field['class'] ?? 'col-12'; }; @endphp
{{ __('Configuration Workspace') }}

{{ __('Site Settings') }}

{{ __('Manage brand, role colors, security, email, agent, cookie, and maintenance controls from one structured workspace.') }}

{{ count($settingMenus) }} {{ __('Sections') }} {{ $totalEditableFields }} {{ __('Editable Fields') }}
{{ __('Settings Menu') }} {{ __('Choose a section to configure') }}
@foreach($settingMenus as $name => $icon) @php $menu = $settings[$name] ?? []; @endphp @endforeach
@foreach($settings as $sectionKey => $fields) @php $formId = 'settings-site-form-' . $sectionKey; $elements = collect($fields['elements'] ?? []); $visibleElements = $elements->filter(fn (array $field): bool => ($field['type'] ?? null) !== 'hidden'); $elementMap = $visibleElements->keyBy('key'); $groupedFieldKeys = collect($fields['groups'] ?? [])->flatMap(fn (array $group): array => $group['fields'] ?? [])->unique(); $ungroupedElements = $visibleElements->reject(fn (array $field): bool => $groupedFieldKeys->contains($field['key'] ?? null)); @endphp
{{ __($fields['title'] ?? title($sectionKey)) }}
{{ __($fields['header_description'] ?? $fields['menu_description'] ?? 'Review and update the controls for this section.') }}
@if (isset($fields['include_partials'])) @include('backend.settings.site.partials.' . $fields['include_partials'], ['section' => $sectionKey]) @endif
@method('PUT') @csrf
@if (isset($fields['info']))
{{ __('Important') }}
{{ $fields['info'] }}
@endif @if(!empty($fields['groups']))
@foreach($fields['groups'] as $group)
{{ __($group['title']) }}
@isset($group['description'])

{{ __($group['description']) }}

@endisset
{{ count($group['fields'] ?? []) }}
@foreach($group['fields'] as $fieldKey) @php $field = $elementMap->get($fieldKey); @endphp @if($field)
@include('backend.settings.site.partials.fields.' . $field['type'], ['field' => $field])
@endif @endforeach
@endforeach @if($ungroupedElements->isNotEmpty())
@foreach($ungroupedElements as $field)
@include('backend.settings.site.partials.fields.' . $field['type'], ['field' => $field])
@endforeach
@endif
@else
@foreach($visibleElements as $field)
@include('backend.settings.site.partials.fields.' . $field['type'], ['field' => $field])
@endforeach
@endif
@endforeach
@endsection @push('scripts') @include('backend.settings.site.partials._script') @endpush