<div>
    <x-title :breadcrumbs="[
        ['link' => route('clients.show', $client), 'title' => $client->name_first . ' ' . $client->name_last],
    ]">
        {{ $client->name_first }} {{ $client->name_last }}

        @can('clients.edit')
            <x-slot:buttons>
                <a href="{{ route('clients.edit', $client) }}" class="btn btn-outline-secondary">
                    Edit Client
                </a>
            </x-slot:buttons>
        @endcan
    </x-title>

    <div class="row">

        {{-- LEFT: CLIENT INFO CARD --}}
        <div class="col-12 col-md-3">
            <div class="card shadow-sm mb-3">
                <div class="card-body">
                    <h5 class="fw-bold mb-1">
                        {{ $client->name_first }}
                        @if($client->name_middle) {{ $client->name_middle }} @endif
                        {{ $client->name_last }}
                    </h5>
                    @if($client->name_preferred)
                        <div class="text-muted small mb-2">Known as: {{ $client->name_preferred }}</div>
                    @endif

                    <hr>

                    <div class="small">
                        @if($client->email_address)
                            <div class="mb-1">
                                <span class="text-muted">Email:</span>
                                <a href="mailto:{{ $client->email_address }}">{{ $client->email_address }}</a>
                            </div>
                        @endif
                        @if($client->phone_number)
                            <div class="mb-1">
                                <span class="text-muted">Phone:</span> {{ $client->phone_number }}
                            </div>
                        @endif
                        @if($client->date_of_birth)
                            <div class="mb-1">
                                <span class="text-muted">DOB:</span> {{ $client->date_of_birth->format('d/m/Y') }}
                            </div>
                        @endif
                        @if($client->reference)
                            <div class="mb-1">
                                <span class="text-muted">Ref:</span> {{ $client->reference }}
                            </div>
                        @endif
                    </div>
                </div>
            </div>
        </div>

        {{-- RIGHT: ALL CLAIM TYPES + NOTES/DOCS/ADDRESS --}}
        <div class="col-12 col-md-9">

            @if(auth()->user()->canAccessWorkspace('ha'))
                <livewire:client.profile.ha-claims :client="$client" :key="'ha-'.$client->id"/>
            @endif

            @if(auth()->user()->canAccessWorkspace('pension'))
                <livewire:client.profile.pension-cases :client="$client" :key="'pension-'.$client->id"/>
            @endif

            @if(auth()->user()->canAccessWorkspace('wills'))
                <livewire:client.profile.wills-cases :client="$client" :key="'wills-'.$client->id"/>
            @endif

            <livewire:note-manager :owner="$client" :key="'notes-'.$client->id"/>

            <livewire:document-manager :owner="$client" :key="'docs-'.$client->id"/>

            <livewire:address-book :owner="$client" :key="'address-'.$client->id"/>

        </div>

    </div>
</div>
