{{--
    MÜŞTERİLERİ SEKMESİ — bu personele temsilci olarak atanmış müşteriler.

    Ortak "klasik tablo" dili (agency/partials/qv-table); satıra tıklayınca
    müşteri kartı açılır.

    Beklenen: $staff, $customers
--}}
@include('agency.partials.qv-table')

<div class="qvt-bar">
    <span class="qvt-bar-info"><i class="fas fa-users"></i>{{ $customers->count() }} müşteri</span>
</div>

<div class="qvt-box qvt-scroll">
    <table class="qvt">
        <thead>
            <tr>
                <th>Müşteri</th>
                <th class="qvt-w1">Kod</th>
                <th>Telefon</th>
                <th>Şehir</th>
                <th class="qvt-w1">Durum</th>
            </tr>
        </thead>
        <tbody>
            @forelse($customers as $customer)
                <tr class="qvt-click" data-quickview-url="{{ route('agency.customers.quick-view', $customer) }}">
                    <td class="qvt-trunc">
                        <span class="qvt-c qvt-strong" data-copy="{{ $customer->full_name }}">{{ $customer->full_name }}</span>
                    </td>
                    <td class="qvt-w1"><span class="qvt-c qvt-mono" data-copy="{{ $customer->code }}">{{ $customer->code }}</span></td>
                    <td>
                        @if($customer->phone)
                            <span class="qvt-c qvt-mono" data-copy="{{ $customer->phone }}">{{ $customer->phone }}</span>
                        @else
                            <span class="qvt-none">—</span>
                        @endif
                    </td>
                    <td>{{ $customer->city ?: '—' }}</td>
                    <td class="qvt-w1"><span class="qvt-chip">{{ $customer->status_label }}</span></td>
                </tr>
            @empty
                <tr class="qvt-empty">
                    <td colspan="5">
                        <i class="fas fa-user-group"></i>
                        <b>Atanmış müşteri yok</b>
                        <span>{{ $staff->user_id ? 'Bu personel henüz hiçbir müşteriye temsilci olarak atanmadı.' : 'Müşteri ataması için personelin sistem hesabı olmalı.' }}</span>
                    </td>
                </tr>
            @endforelse
        </tbody>
    </table>
</div>
