Current File : //home/tradevaly/public_html/resources/views/backend/pages/order/index.blade.php
@extends('backend.ayaan.master')
@push('title','All Orders')
@push('style')
    <link href="{{ asset('/assets/libs/datatables/datatables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush

@section('content')
`   <div class="container-fluid">
  <div class="row">
    <div class="col-md-12">
      <div class="card">
        <div class="card-header card-header-info card-header-icon">
          <h4 class="card-title">Orders Table</h4>
        </div>
        <div class="card-body">
          <div class="table-responsive">
            <table class="table">
              <thead>
                <tr>
                  <th class="text-center">#</th>
                  <th>Order Number</th>
                  <th>Quantity</th>
                  <th>Total Amount</th>
                  <th>Status</th>
                  <th>Payment Type</th>
                  <th>Payment Status</th>
                  <th>Order Date</th>
                </tr>
              </thead>
              <tbody>
                  @forelse($orders as $order)
                    <tr>
                        <td>{{$loop->iteration}}</td>
                        <td>
                            <a href="{{route('admin.order.view',$order->order_id)}}">{{$order->order_id}}</a>
                        </td>
                        <td>{{App\Models\OrderItem::where('order_id',$order->order_id)->where('vendor_id',auth()->id())->sum('quantity')}}</td>
                        <td>{{$order->total_amount}}</td>
                        <td>
                            @if($order->orderItem->status == "new")
                            <button type="button" class="btn btn-primary" style="width: 100px;text-align: center;">{{$order->orderItem->status}}</button>
                            @elseif($order->orderItem->status == "pending")
                            <button type="button" class="btn btn-warning" style="width: 100px;text-align: center;">{{$order->orderItem->status}}</button>
                            @elseif($order->orderItem->status == "cancel")
                            <button type="button" class="btn btn-danger" style="width: 100px;text-align: center;">{{$order->orderItem->status}}</button>
                            @elseif($order->orderItem->status == "delevered")
                            <button type="button" class="btn btn-success" style="width: 100px;text-align: center;">{{$order->orderItem->status}}</button>
                            @endif
                        </td>
                        <td >{{$order->order->payment_type}}</td>
                        <td >
                            <form action="{{route('admin.order.payment.status',$order->order->id)}}" method="post" class="d-flex">
                              <select name="payment_status" id="" class="{{$order->order->payment_status=="paid" ?'bg-success':'bg-warning'}} text-white form-control border border-dark">
                                <option value="paid" {{$order->order->payment_status=="paid" ?'selected':''}}>Paid</option>
                                <option value="unpaid"{{$order->order->payment_status=="unpaid" ?'selected':''}}>Un Paid</option>
                              </select>
                              <button type="submit" style="padding: 5px;border: 1px solid gray;border-radius: 15%;margin-left: 10px;"><i class="fas fa-arrow-up"></i></button>
                            </form>
                            <!--@if($order->order->payment_status == "paid")-->
                            <!--<button type="button" class="btn btn-success" style="width: 100px;text-align: center;">{{$order->order->payment_status}}</button>-->
                            <!--@else-->
                            <!--<button type="button" class="btn btn-warning" style="width: 100px;text-align: center;">{{$order->order->payment_status}}</button>-->
                            <!--@endif-->
                        </td>
                        <td >{{$order->created_at->format('d-m-Y')}}</td>
                    </tr>
                 @empty
                    <tr>
                        <td colspan="6" style="text-align: center;"><strong class="text-danger">No Orders</strong></td>
                    </tr>
                 @endforelse
              </tbody>
            </table>
          </div>
        </div>
        <div class="card-footer">
            {{$orders->links()}}
        </div>
      </div>
  </div>
</div>
@endsection