@extends('layouts.franchise', ['heading' => 'Sales / बिक्री'])

@section('content')
    <div class="grid grid-cols-1 gap-3">
        @forelse($orders as $order)
            <div class="rounded-2xl bg-white p-4 shadow">
                <div class="flex items-center justify-between">
                    <div class="font-semibold">{{ $order->order_number }}</div>
                    <div class="text-xs text-slate-500">{{ $order->status }}</div>
                </div>
                <div class="mt-1 text-sm text-slate-600">₹ {{ number_format((float) $order->total, 2) }} | BV {{ number_format((float) $order->total_bv, 2) }}</div>
                <div class="text-xs text-slate-500">Date: {{ \Illuminate\Support\Carbon::parse($order->created_at)->format('d M Y') }}</div>
                <a href="{{ route('franchise.sales.invoice', $order) }}" class="mt-2 inline-block text-xs text-emerald-600">Print Invoice</a>
            </div>
        @empty
            <div class="rounded-2xl bg-white p-4 text-center text-slate-500">No sales found.</div>
        @endforelse
    </div>

    <div class="mt-4">{{ $orders->links() }}</div>
@endsection

