@extends('layout')

@section('title', __('store/reseller.my_clients'))

@section('content')
<div class="container py-5">
    <x-clientarea.page-header
        icon="fas fa-users"
        :title="__('store/reseller.my_clients')"
    >
        <a href="{{ route('store.auth.reseller.dashboard') }}" class="btn btn-outline-secondary">
            <i class="fas fa-arrow-left me-1"></i>{{ __('store/reseller.dashboard') }}
        </a>
    </x-clientarea.page-header>

    <div class="card shadow-sm border-0">
        <div class="card-body p-0">
            @if($clients->isEmpty())
                <div class="text-center py-5 text-muted">
                    <i class="fas fa-users fa-3x mb-3 d-block"></i>
                    {{ __('store/reseller.no_clients') }}
                </div>
            @else
                <div class="table-responsive">
                    <table class="table table-hover mb-0">
                        <thead><tr>
                            <th>{{ __('store/reseller.client_name') }}</th>
                            <th>{{ __('store/reseller.client_email') }}</th>
                            <th>{{ __('store/reseller.client_services') }}</th>
                            <th>{{ __('store/reseller.client_status') }}</th>
                            <th>{{ __('store/reseller.client_joined') }}</th>
                        </tr></thead>
                        <tbody>
                        @foreach($clients as $c)
                            <tr>
                                <td>{{ $c->first_name }} {{ $c->last_name }}</td>
                                <td>{{ $c->email }}</td>
                                <td>
                                    <span class="badge bg-primary">{{ $c->products_count }} services</span>
                                    <span class="badge bg-info">{{ $c->domains_count }} domains</span>
                                </td>
                                <td>
                                    @if($c->status === 'active')
                                        <span class="badge bg-success">Active</span>
                                    @else
                                        <span class="badge bg-secondary">{{ ucfirst($c->status) }}</span>
                                    @endif
                                </td>
                                <td>{{ $c->created_at->format('d.m.Y') }}</td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>

                <div class="d-flex justify-content-center py-3">
                    {{ $clients->links() }}
                </div>
            @endif
        </div>
    </div>
</div>
@endsection
