<x-admin-panel-layout>
        <x-slot name="title">
            لیست سفارشات
        </x-slot>
    <x-slot name="main">
        <div class="content-header">
            <div class="container-fluid">
                <div class="row mb-4">
                    <div class="col-sm-6">
                        <h3 class="m-0 text-dark">سفارشات</h3>
                    </div><!-- /.col -->
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-left">
                            <li class="breadcrumb-item"><a href="{{ route("admin.dashboard") }}">داشبورد</a></li>
                            <li class="breadcrumb-item"><a href="{{ route("admin_shop_index") }}">فروشگاه</a></li>
                            <li class="breadcrumb-item active">سفارشات</li>
                        </ol>
                    </div><!-- /.col -->
                </div>
            </div>
        </div>
        <form action="{{ route("admin_group_action") }}" method="post">
        <div class="add_item_btn mb-3">
            <a class="btn btn-sm btn-primary " href="{{ route("admin_add_order") }}">افزودن سفارش</a>
        </div>
        @csrf
    <div class="admin-order-select-box mt-3">
        <div class="admin-order-by-box">

            <label>فیلتر بر اساس وضعیت : </label>
            <a class=" btn btn-sm     @if(!isset(request()->status)) text-white  btn-dark @else btn-outline-dark @endif" href="{{ route("admin_orders") }}">همه سفارشات</a>
            @foreach($statuses as $status)
                <a class=" btn btn-sm     @if($status==request()->status) text-white btn-dark @else btn-outline-dark @endif" href="{{ route("admin_orders",["status"=>$status]) }}">{{ __($status) }}</a>
            @endforeach
        </div>
    </div>
    <table class="admin-table">
        <tr>
             <th>شناسه</th>
            <th>خریدار</th>
            <th>قیمت</th>
            <th>وضعیت</th>
            <th>محصولات</th>
            <th>تاریخ خرید</th>

        </tr>
        @foreach($orders as $order)

            <tr>
               <td><a href="">{{ $order->id }}</a>
                    <div class="admin-table-actions"><a href="{{ route("admin_order_edit",["id"=>$order->id]) }}"><span>نمایش و ویرایش</span></a>
                        <a class="admin-table-actions-delete"
                           href="{{ route("admin_delete_order",["id"=>$order->id]) }}"><span>حذف</span></a>

                    </div>
                </td>
                <td>
                    @if($order->user)

                    {{ $order->user->name}}
                    @endif
                </td>
                <td>{{ $order->formated_price}}</td>
                <td>{!!   $order->status_html !!}</td>
                <td>{{ $order->products_name }}</td>
                <td>{{ $order->created_at }}</td>
            </tr>
        @endforeach
        <tr>
            <th>شناسه</th>
            <th>خریدار</th>
            <th>قیمت</th>
            <th>وضعیت</th>
            <th>محصولات</th>
            <th>تاریخ خرید</th>
        </tr>


    </table>

    </form>

    <div class="admin-paginator">
        {{ $orders->links() }}
    </div>
    @includeIf("admin.partials.delete_modal")
    </x-slot>
</x-admin-panel-layout>
