<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\Order;
use Illuminate\View\View;

class PesananController extends Controller
{
    /**
     * Tampilkan invoice printable (A4) untuk satu pesanan.
     */
    public function invoice(int $id): View
    {
        $order = Order::with([
            'items',
            'payment',
            'deliveryArea',
            'voucher',
        ])->findOrFail($id);

        return view('admin.pesanan.invoice', compact('order'));
    }
}
