@extends('admin.layouts.app')
@section('title', 'Orders')
@section('content')
<div class="action-bar"><span>{{ $orders->total() }} orders</span></div>
<div class="card">
    <table>
        <tr><th>Order #</th><th>Customer</th><th>Total</th><th>Payment</th><th>Status</th><th>Date</th><th>Actions</th></tr>
        @foreach($orders as $order)
        <tr>
            <td><strong>{{ $order->order_number }}</strong></td>
            <td>{{ $order->user->name }}</td>
            <td>${{ number_format($order->total, 2) }}</td>
            <td><span class="badge badge-{{ $order->payment_status }}">{{ $order->payment_status }}</span></td>
            <td><span class="badge badge-{{ $order->status }}">{{ $order->status }}</span></td>
            <td class="text-muted">{{ $order->created_at->format('M d, Y') }}</td>
            <td class="inline-flex">
                <a href="{{ route('admin.orders.show', $order) }}" class="btn btn-primary btn-sm">View</a>
                <a href="{{ route('admin.orders.edit', $order) }}" class="btn btn-warning btn-sm">Edit</a>
            </td>
        </tr>
        @endforeach
    </table>
    <div class="pagination">{{ $orders->links() }}</div>
</div>
@endsection
