@extends('layouts.admin-layout')
@section('title', 'All Orders ')
@section('content')
    <style>
        :root {
            --white: #ffffff;
            --black: #000;
            --gary-color: #727272;
            --lightgary-color: #b2b9bd;
            --theme-color: #39b24a;
        }
        ul {
            padding: 0;
            margin: 0;
            list-style: none;
        }
        .orderContent h2 {
            font-size: 3.125rem;
            text-transform: uppercase;
            font-weight: 600;
        }

        .orderContent ul {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            margin: 0 0 2rem;
        }

        .orderContent ul li a {
            font-size: 1.375rem;
            color: #828282;
        }

        .orderContent ul li span {
            color: var(--theme-color);
            font-size: 1.3rem;
            font-weight: 500;
        }
        .orderdtlOne {
            display: flex;
            justify-content: space-between;
            margin: 0 0 3rem;
        }

        .orderDetail {
            background: #fafafa;
            padding: 5rem;
        }

        .orderdtlOne ul li strong {
            font-size: 1.25rem;
            color: #000;
            font-weight: bold;
            text-transform: uppercase;
        }

        .orderdtlOne ul li {
            font-size: 1.25rem;
            color: #000;
            font-weight: 500;
            line-height: 1.8;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 5rem;
        }

        .orderdtlOne ul li + li {
            margin: 1rem 0 0;
        }

    </style>
    
    <div class="content-wrapper">
        <section class="content">
            <div class="container-fluid">

    <div class="col-md-9 ind-tab flemember">
        <div class="row">
            <div class="col-md-12">
                <div class="orderContent">
                    <h2>Order Details</h2>
                    <ul>
                        <li><a href="#">Dashboard </a></li>
                        <li><span>></span></li>
                        <li><a href="#">Orders </a></li>
                        <li><span>></span></li>
                        <li><a href="#">Order Details</a></li>
                        <li><span>></span></li>
                        <li><a href="{{route('admin.order.list')}}"> Back</a></li>
                    </ul>
                </div>
            </div>
            <div class="col-md-12">
                <div class="recentTable table-shadow mb-5">
                    <div class="orderDetail">
                        <div class="orderdtlOne">
                            <div>
                                <ul>
                                    <li><strong>Order TO:</strong> {{$order_detail->first_name ? : 'Guest'}}</li>
                                    <li>
                                        {{-- {{$order_detail->first_name ? : 'Guest'}}<br> --}}
                                           {{-- <br> --}}
                                           <strong>Phone:</strong> + {{$order_detail->phone_number ? : ''}}
                                    </li>
                                    <li> <strong>Address:</strong> {{ $order_detail->address }}</li>
                                </ul>
                            </div>
                            <div>
                                <ul>
                                    <li><strong>ORDER No:</strong><span>{{$order_detail->tracking_no ? : ''}}</span></li>
                                    @php
                                        use Carbon\Carbon;
                                    @endphp
                                    <li><strong>Date:</strong><span>{{$formattedDate = Carbon::parse($order_detail->created_at)->format('d/m/Y')}}</span></li>
                                </ul>
                            </div>
                        </div>
                        <table class="table table-responsive-lg">
                            <thead class="thead-dark">
                            <tr>
                                <th scope="col">SL</th>
                                <th scope="col">Product Name</th>
                                <th scope="col">PRICE</th>
                                <th scope="col">QTY</th>
                                <th scope="col">TOTAL</th>
                            </tr>
                            </thead>
                            <tbody>

                                @php
                                $sub_total = 0;
                                @endphp
                            @foreach($order_detail->orderItems as $order)
                            <tr class="gray">
                                <td>{{$order->id ? : ''}}</td>

                                <td>{{$order->products->name ?? ''}}</td>

                                <td>$ {{$order->price ? : ''}}</td>
                                <td>{{$order->quantity ? : ''}}</td>
                                <td>$ {{$order->price * $order->quantity }}</td>

                                @php
                                    $sub_total += $order->price * $order->quantity;
                                @endphp

                            </tr>


                            @endforeach


                            </tbody>
                        </table>

                        <div class="paymentInfo">
                            <div>
                                <ul class="pymntList">
                                    <li><strong>Payment Info:</strong></li>
                                    <li>
                                        Account: 1234567890<br>
                                        A/C Name:<br>
                                        Bank Details: Add your details
                                    </li>
                                </ul>
                            </div>
                            <div>
                                <ul>
                                    <li><strong>SUB TOTAL:</strong><span>$ {{number_format($sub_total ? : '')}}</span></li>
                                    <li class="total">TOTAL: <span>$ {{number_format($sub_total ? : '')}} </span></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
            </div>
        </section>
    </div>
@endsection
