@extends('layouts.public') @section('content') <div class="flex items-center justify-between mb-6"> <h1 class="text-2xl font-bold">Orders</h1> <div class="flex gap-2"> <a class="px-3 py-2 rounded border text-sm" href="{{ route('admin.orders.index') }}">All</a> <a class="px-3 py-2 rounded border text-sm" href="{{ route('admin.orders.index', ['status' => 'payment_pending']) }}">Payment Pending</a> <a class="px-3 py-2 rounded border text-sm" href="{{ route('admin.orders.index', ['status' => 'paid']) }}">Paid</a> <a class="px-3 py-2 rounded border text-sm" href="{{ route('admin.orders.index', ['status' => 'failed']) }}">Failed</a> </div> </div> <div class="bg-white rounded-xl shadow overflow-hidden"> <table class="w-full text-sm"> <thead class="bg-gray-50"> <tr> <th class="p-4 text-left">Order No</th> <th class="p-4 text-left">Customer</th> <th class="p-4 text-left">Total</th> <th class="p-4 text-left">Status</th> <th class="p-4 text-left">Payment</th> <th class="p-4 text-right">Action</th> </tr> </thead> <tbody> @forelse($orders as $o) <tr class="border-t"> <td class="p-4 font-medium">{{ $o->order_no }}</td> <td class="p-4"> <div class="font-medium">{{ $o->customer_name ?? '-' }}</div> <div class="text-xs text-gray-500">{{ $o->customer_phone ?? '-' }}</div> </td> <td class="p-4">RM {{ number_format($o->total_cents/100, 2) }}</td> <td class="p-4"> <span class="px-2 py-1 rounded text-xs bg-gray-100">{{ $o->status }}</span> </td> <td class="p-4"> <span class="px-2 py-1 rounded text-xs bg-gray-100"> {{ $o->payment->status ?? 'no payment row' }} </span> </td> <td class="p-4 text-right"> <a class="underline" href="{{ route('admin.orders.show', $o) }}">View</a> </td> </tr> @empty <tr> <td class="p-6 text-gray-600" colspan="6">No orders yet.</td> </tr> @endforelse </tbody> </table> </div> <div class="mt-6"> {{ $orders->links() }} </div> @endsection