
@extends(ucfirst(activeGuard()).'.'.layout())
@section('pagetitle', __('trans.couponReport'))
@section('content')

<form method="GET" class="row g-3 mb-4">
    <div class="col-md-3">
        <label for="from" class="form-label">@lang('trans.from')</label>
        <input type="date" id="from" name="from" class="form-control" value="{{ request('from') }}">
    </div>

    <div class="col-md-3">
        <label for="to" class="form-label">@lang('trans.to')</label>
        <input type="date" id="to" name="to" class="form-control" value="{{ request('to') }}">
    </div>

     <div class="col-md-3 text-end d-flex justify-content-between align-items-end">
        <button type="submit" class="btn btn-primary w-50">
            <i class="fa fa-search"></i> @lang('trans.search')
        </button>
        <a href="{{ route(Route::currentRouteName()) }}" class="btn btn-secondary w-50 ms-3">
            <i class="fa fa-times"></i> @lang('trans.Clear')
        </a>
    </div>
</form>

<table class="table table-bordered table-hover table-striped data-table">
    <thead>
        <tr>
            <th>#</th>
            <th>@lang('trans.status')</th>
            <th>@lang('trans.name')</th>
            <th>@lang('trans.phone')</th>
            <th>@lang('trans.payment')</th>
            <th>@lang('trans.date')</th>
            <th>@lang('trans.time')</th>
            <th>@lang('trans.sub_total')</th>
            <th>@lang('trans.discount')</th>
            <th>@lang('trans.charge_cost')</th>
            <th>@lang('trans.vat')</th>
            <th>@lang('trans.coupon')</th>
            <th>@lang('trans.net_total')</th>
            <th>@lang('trans.date')</th>
      
        </tr>
    </thead>
   <tbody>
    @foreach ($Models as $Model)
        <tr>
            <td>{{ $Model->id }}</td>
            <td> @switch($Model->status)
                    @case(0) {{ __('trans.pending') }} @break
                    @case(1) {{ __('trans.accepted') }} @break
                    @case(2) {{ __('trans.declined') }} @break
                    @case(3) {{ __('trans.order_delivered') }} @break
                    @case(5) {{ __('trans.not_complete') }} @break
                    @default {{ __('trans.unknown') }} @endswitch 
            </td>
            <td>{{ optional($Model->Client)->name }}</td>
            <td>{{ optional($Model->Client)->phone }}</td>
            <td>{{ optional($Model->Payment)->title() }}</td>
            <td>{{ $Model->created_at->format('Y-m-d') }}</td>
            <td>{{ $Model->created_at->format('H:i') }}</td>
            <td>{{ $Model->sub_total }}</td>
            <td>{{ $Model->discount }}</td>
            <td>{{ $Model->charge_cost }}</td>
            <td>{{ $Model->vat }}</td>
            <td>{{ $Model->coupon }}</td>
            <td>{{ $Model->net_total }}</td>
            <td>{{ $Model->created_at }}</td>
        </tr>
    @endforeach
</tbody>
</table>


@endsection