@extends('frontend.layout.dash')

@section('content')
    @include('frontend.components.accordion')

    <div class="card mp-20">
        <a href="{{ route('user.log.account-orders') }}" class="btn btn-outline btn-sm mb-3">&larr; Back to account orders</a>
        <h2 class="title">{{ $title }}</h2>
        <p><strong>Date:</strong> {{ $order->created_at?->format('Y-m-d H:i') }} &nbsp;·&nbsp; <strong>Total:</strong> {{ $currency ?? '' }}{{ number_format($order->total_amount, 2) }}</p>

        <h3 class="title" style="font-size: 1rem; margin-top: 1.5rem;">Purchased credentials</h3>
        <div class="table-responsive">
            <table class="table">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Product</th>
                        <th>Price</th>
                        <th>Credentials</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($order->orderItems as $item)
                        <tr>
                            <td>{{ $loop->iteration }}</td>
                            <td>{{ $item->product->name ?? '-' }}</td>
                            <td>{{ number_format($item->price, 2) }}</td>
                            <td><code style="word-break: break-all;">{{ $item->productDetail->details ?? '-' }}</code></td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>
@endsection
