@extends('front.layout.app')
@section('title', 'Success')
@section('content')
    <section class="inner-banner">
        <img src="{{ asset('front/images/mainBanner.webp') }}" alt="image" class="img-fluid w-100 h-100">
        <div class="container">
            <div class="inner-banner__content">
                <h1>Payment Success</h1>
            </div>
        </div>
    </section>
    <section class="payment-section padd-y my-5">
        <div class="container my-5">
            <div class="row justify-content-center mt-5">
                <div class="col-sm-10 my-5">
                    <div class="payment-title text-center">
                        <h4>Payment Success!</h4>
                        <p>Your payment has been successfully done.</p>
                    </div>
                </div>
            </div>
        </div>
    </section>
    @if (isset($order))
        <section class="payment-section">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-sm-10">
                        <table class="table">
                            <thead>
                                <tr>
                                    <th>User Name</th>
                                    <th>Product Name</th>
                                    <th>Quantity</th>
                                    <th>Tracking No</th>

                                </tr>
                            </thead>
                            <tbody>
                                @forelse ($order->orderItems as $item)
                                    <tr>
                                        <td>{{ $order->first_name ?? 'Guest' }}</td>
                                        <td>{{ $item->products->name }}</td>
                                        <td>{{ $item->quantity ?? '' }}</td>
                                        <td>{{ $order->tracking_no }}</td>

                                    </tr>
                                @empty
                                    <td colspan="4"> Data Not Found</td>
                                @endforelse
                                <tr>
                                    <th colspan="4"></th>
                                </tr>
                                <tr>
                                    <th colspan="4"></th>
                                </tr>
                                <tr>
                                    <th colspan="4"></th>
                                </tr>
                                <tr>
                                    <th colspan="4"></th>
                                </tr>
                            </tbody>
                            <tfoot>
                                <tr>
                                    <th colspan="3">Total Amount</th>
                                    <td>${{ number_format($order->total_price, 2) ?? '00' }}</td>
                                </tr>

                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </section>
    @endif
@endsection
