@extends('Admin.layout.app')

@section('title','Customer Records')
@section('page-title','Customer Records')

@section('content')
<div class="container-fluid">

           <div class="card shadow-sm border-0">
               
               <div class="card-header bg-white d-flex justify-content-between align-items-center">
       
           <h4 class="mb-0">
               <i class="las la-users"></i> Customers Records
           </h4>
       
           
           </form>
       
       </div>

        <div class="card-body p-0">

            <table class="table table-hover align-middle mb-0">
                <thead class="table-light">
                    <tr>
                        <th>ID</th>
                        <th>Customer</th>
                        <th>Phone</th>
                        <th>Date</th>
                        <th>Grand Total </th>
                        <th>Payment Status</th>
                        <th width="120">Action</th>
                    </tr>
                </thead>

                <tbody>

                @forelse($orders as $order)

                    <tr>

                        <td>#{{ $order->id }}</td>

                        <td>
                            <div class="fw-semibold">
                                {{ $order->customer->name }}
                            </div>
                            <small>{{ $order->customer->urdu_name }}</small>
                        </td>

                        

                        <td>
                            {{ $order->customer->phone ?? '-' }}<br>
                            {{ $order->customer->phone2 ?? '-' }}
                        </td>

                        <td>
                            {{ $order->order_date->format('d M Y h:i A') }}
                        </td>

                        <td>
                            {{ $order->grand_total ?? '0.00' }}<br>
                           
                        </td>

                        

                        <td>
                            {{ $order->payment_status }}
                        </td>

                        <td>
                            <a href="{{route('admin.customers.Order.detail',$order->id)}}"
                               class="btn btn-sm btn-outline-primary">
                                <i class="las la-eye">Detail</i>
                            </a>
                           
                        </td>

                    </tr>

                @empty

                    <tr>
                        <td colspan="8" class="text-center py-4">
                            No customers found.
                        </td>
                    </tr>

                @endforelse

                </tbody>

            </table>

        </div>

        

    </div>

</div>


@endsection