Current File : //home/tradevaly/public_html/resources/views/backend/pages/order/view.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">
        <div class="row">
            <div class="col-md-8">
                <div class="d-flex justify-content-between ">
                    <div class="text-left">
                        <h3>Order Number</h3>
                        <p>{{$order->order_id}}</p>
                        <p><strong>Date : </strong>{{$order->created_at->format('d/m/Y')}}</p>
                    </div>
                    <div class="text-end">
                        <button class="btn btn-success" onclick="window.print()"><i class="fas fa-print"></i> Print</button>
                        <p class="mt-4">Payment Method :{{$order->payment_type}}</p>
                        <p>Payment Status:{{$order->payment_status}}</p>
                    </div>
                </div>
                <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">Quantity</th>
                          <th scope="col">Total</th>
                          <th scope="col" style="text-align: center;">Status</th>
                        </tr>
                      </thead>
                      <tbody>
                          @php
                          $total = 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="{{$item->product_title}}"></td>
                          <td>{{isset($item->product->title)?$item->product->title:$item->product_title}}</td>
                          <td>{{$item->product_price}}</td>
                          <td>{{$item->quantity}}</td>
                          <td>{{$item->quantity * $item->product_price}}</td>
                          <td>
                               @if($item->status == "new")
                            <button type="button" class="btn btn-primary" style="width: 100px;text-align: center;">{{$item->status}}</button>
                            @elseif($item->status == "pending")
                            <button type="button" class="btn btn-warning" style="width: 100px;text-align: center;">{{$item->status}}</button>
                            @elseif($item->status == "cancel")
                            <button type="button" class="btn btn-danger" style="width: 100px;text-align: center;">{{$item->status}}</button>
                            @elseif($item->status == "delevered")
                            <button type="button" class="btn btn-success" style="width: 100px;text-align: center;">{{$item->status}}</button>
                            @endif
                          </td>

                          @php
                          $total= $total + ($item->quantity * $item->product_price);
                          @endphp
                        </tr>
                        @endforeach
                        <tr>
                            <td colspan="6" class="text-end"><strong>Total : </strong></td>
                            <td>{{$total}}</td>
                        </tr>
                        <tr>
                            <td colspan="6" class="text-end"><strong>Discount : </strong></td>
                            <td>{{isset($vendor_order->discount)?$vendor_order->discount:00}}</td>
                        </tr>
                        <tr>
                            <td colspan="6" class="text-end"><strong>SubTotal : </strong></td>
                            <td>{{$total-$vendor_order->discount }}</td>
                        </tr>
                      </tbody>
                    </table>
            </div>
            <div class="col-md-4">
                <h2>Customer Details</h2>
                <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>
@endsection