@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-12">
            @include('commons.notifications')
            <div class="card">
                <div class="card-header">{{ __('Clients') }}</div>
                <div class="card-body">
                    @if (session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif
                    <div class="float-end">
                        <a href="{{ url('admin/create') }}" class="btn btn-primary btn-sm"><i class="bi bi-plus-circle"></i> Add Clients</a>
                    <hr>
                    </div>
                    
                    <table class="table">
                      <thead>
                        <tr>
                          <th class="col-1">#</th>
                          <th class="col-2">Name</th>
                          <th class="col-2">Email</th>
                          <th class="col-1">Phone</th>
                          <th class="col-1">Country</th>
                          <th class="col-1">Status</th>
                          <th class="col-2">Date Added</th>
                          <th class="col-2">Action</th>
                        </tr>
                      </thead>
                      <tbody>
                        <?php $count = 1; ?>
                        @if($clients)
                        @foreach($clients->content as $row)
                        <tr>
                            <th scope="row">{{ $count }}</th>
                            <td>{{ $row->name }}</td>
                            <td>{{ $row->email }}</td>
                            <td>{{ $row->phoneNumber }}</td>
                            <td>{{ $row->country }}</td>
                            <td>{{ $row->status }}</td>
                            <td>{{ $row->createdAt }}</td>
                            <td>
                                <a href="{{ url('clients', $row->id)}}" title="View Client Details" class="btn btn-info btn-sm"><i class="bi bi-eye"></i></a>
                                <a href="{{ url('clients/'. $row->id . '/edit') }}" title="Edit Client Details" class="btn btn-warning btn-sm"><i class="bi bi-pen"></i></a>
                            </td>
                        </tr>
                        <?php $count++; ?>
                        @endforeach
                        @else
                        <tr>
                            <td colspan="7">No records found</td>
                        </tr>

                        @endif
                      </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
