Current File : //home/tradevaly/public_html/resources/views/user/pages/order/view.blade.php
@extends('user.ayaan.master')
@push('title','Order')
@push('style')
    
@endpush

@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header d-flex justify-content-between ">
                        <h2>Order Details</h2>
                        </div>
                    <div class="d-flex justify-content-between mt-4 px-3">
                        <div class="text-left">
                            <h5>Order Number</h5>
                            <p>{{$order->order_id}}</p>
                            <p><strong>Date : </strong>{{$order->created_at->format('d/m/Y')}}</p>
                        </div>
                        <div class="text-end">
                            <p >Payment Type :<span class="bg-success mx-2 rounded-pill text-white">{{$order->payment_type}}</span></p>
                            <p>Payment Status:
                                @if($order->payment_status == "paid")
                                <span class="bg-success mx-2 rounded-pill text-white">{{$order->payment_status}}</span>
                                @else
                                <span class="bg-warning mx-2 rounded-pill text-white">{{$order->payment_status}}</span>
                                @endif
                            </p>
                        </div>
                    </div>
                    <hr>
                    <table class="table">
                          <thead>
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">Product image</th>
                              <th scope="col">Product Title</th>
                              <th scope="col">Product Price</th>
                              <th scope="col">Total</th>
                              <th scope="col" style="text-align: center;">Status</th>
                              <th scope="col">Quantity</th>
                            </tr>
                          </thead>
                          <tbody>
                              @php
                              $total = 0;
                              $discount = 0;
                              @endphp
                              @foreach($items as $item)
                            <tr>
                              <th scope="row">{{$loop->iteration}}</th>
                              <td><img src="{{asset('storage/images/admin/product/' . (isset($item->product->image) ?$item->product->image:""))}}" height="50" alt=""></td>
                              <td>{{isset($item->product->title)?$item->product->title:$item->product_title}}</td>
                              <td>{{$item->product_price}}</td>
                              <td>{{$item->quantity}}</td>
                                <td>
                                  <form action="{{route('user.order.status',$item->id)}}" method="post" class="d-flex">
                                      <select name="status" id="" class="form-control border border-dark">
                                        <option value="new" {{$item->status=='new'?'selected':''}}>New</option>
                                        <option value="pending"{{$item->status=='pending'?'selected':''}}>Pending</option>
                                        <option value="delevered"{{$item->status=='delevered'?'selected':''}}>Delevered</option>
                                        <option value="cancel"{=='cancel'?'selected':''}}>Cancel</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>
                              </td>
                              <td>{{$item->quantity * $item->product_price}}</td>
    
                              @php
                              $total= $total + ($item->quantity * $item->product_price);
                              $discount = $discount + ($item->discount_price * $item->quantity );
                              @endphp
                            </tr>
                            @endforeach
                            <tr>
                                <td colspan="6" class="text-end"><strong>SubTotal : </strong></td>
                                <td>{{$total}}</td>
                            </tr>
                            <tr>
                                <td colspan="6" class="text-end"><strong>Discount : </strong></td>
                                <td>{{$discount}}</td>
                            </tr>
                            <tr>
                                <td colspan="6" class="text-end"><strong>Total : </strong></td>
                                <td>{{$total-$vendor_order->discount - $discount }}</td>
                            </tr>
                          </tbody>
                        </table>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card">
                    <div class="card-header">
                        <h2>Customer Details</h2>
                    </div>
                    <div class="card-body">
                        
                    <ul class="list-group list-group-flush">
                      <li class="list-group-item"><strong>Name:</strong> {{$order->name}}</li>
                      <li class="list-group-item"><strong>Email:</strong> {{$order->email}}</li>
                      <li class="list-group-item"><strong>Phone:</strong> {{$order->phone}}</li>
                      <li class="list-group-item"><strong>Address:</strong> {{$order->address_1}}</li>
                      <li class="list-group-item"><strong>Company:</strong> {{$order->user->company->name}}</li>
                </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
@stop

@push('script')
   
@endpush