@extends('layouts.store')

@section('title', 'My Orders')

@section('content')
    <section class="dashboard-head">
        <div>
            <span class="eyebrow">Purchases</span>
            <h1>My Orders</h1>
        </div>
    </section>

    <section class="panel">
        <div class="table-wrap">
            <table>
                <thead>
                    <tr>
                        <th>Order</th>
                        <th>Status</th>
                        <th>Total</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    @forelse ($orders as $order)
                        <tr>
                            <td><strong>{{ $order->order_number }}</strong></td>
                            <td><span class="status pending">{{ $order->statusLabel() }}</span></td>
                            <td>{{ \App\Models\SiteSetting::formatPrice($order->total) }}</td>
                            <td>
                                <div class="table-actions">
                                    <a class="text-button" href="{{ route('customer.orders.show', $order) }}">View</a>
                                    <a class="text-button" href="{{ route('orders.track', ['order_number' => $order->order_number, 'delivery_phone' => $order->delivery_phone]) }}">Track</a>
                                </div>
                            </td>
                        </tr>
                    @empty
                        <tr><td colspan="4">No orders yet.</td></tr>
                    @endforelse
                </tbody>
            </table>
        </div>
        {{ $orders->links() }}
    </section>
@endsection
