@extends('layouts.admin')
@section('title', 'Preferences')
@section('page-title', 'Settings')

@section('content')
<div class="billing-preferences">
    <div class="row g-0">
        <div class="col-lg-3 col-xl-2">
            <div class="billing-preferences__nav card border-0 shadow-sm">
                <div class="card-header bg-transparent border-0 pb-0">
                    <h6 class="mb-0 fw-semibold">Settings</h6>
                </div>
                <div class="card-body pt-2">
                    @php
                        $sections = config('preferences.sections', []);
                        $groups = collect($sections)->groupBy('group');
                    @endphp
                    @foreach($groups as $groupName => $items)
                        <div class="billing-preferences__group-label">{{ $groupName }}</div>
                        <ul class="nav flex-column billing-preferences__menu mb-3">
                            @foreach($items as $key => $section)
                                <li class="nav-item">
                                    @if(!empty($section['route']) && empty($section['disabled']))
                                        <a class="nav-link {{ ($activeSection ?? '') === $key ? 'active' : '' }}"
                                           href="{{ route($section['route']) }}">
                                            @if(!empty($section['icon']))
                                                <i class="{{ $section['icon'] }} billing-preferences__menu-icon"></i>
                                            @endif
                                            <span>{{ $section['label'] }}</span>
                                        </a>
                                    @else
                                        <span class="nav-link disabled text-muted" title="Coming soon">
                                            @if(!empty($section['icon']))
                                                <i class="{{ $section['icon'] }} billing-preferences__menu-icon"></i>
                                            @endif
                                            <span>{{ $section['label'] }}</span>
                                        </span>
                                    @endif
                                </li>
                            @endforeach
                        </ul>
                    @endforeach
                </div>
            </div>
        </div>
        <div class="col-lg-9 col-xl-10">
            <div class="billing-preferences__content ps-lg-3">
                @yield('preferences_content')
            </div>
        </div>
    </div>
</div>
@endsection

@push('styles')
<link href="{{ asset('css/billing-preferences.css') }}" rel="stylesheet">
@endpush
