Index: app/Http/Controllers/DashboardController.php
===================================================================
--- app/Http/Controllers/DashboardController.php	(revision 99b0ca3cb6693d65d404ff94fba81fdfca07f8ee)
+++ app/Http/Controllers/DashboardController.php	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
@@ -16,9 +16,19 @@
     public function index()
     {
-        // Existing revenue metrics
-        $currentRevenue = Payment::whereMonth('payment_date', now()->month)
-            ->whereYear('payment_date', now()->year)
-            ->where('payment_status', 'paid')
+        $currentMonth = now()->month;
+        $currentYear = now()->year;
+        $previousMonth = now()->subMonth()->month;
+        $previousYear = now()->subYear()->year;
+
+        // Debug: Check if we have any payments
+        $totalPayments = Payment::where('payment_status', 'paid')->count();
+        $allPayments = Payment::where('payment_status', 'paid')->get();
+        $currentRevenue = Payment::where('payment_status', 'paid')
+            ->where(function($query) use ($currentMonth, $currentYear) {
+                $query->whereYear('payment_date', $currentYear)
+                    ->whereMonth('payment_date', $currentMonth);
+            })
             ->sum('amount');
+
 
         $previousRevenue = Payment::whereMonth('payment_date', now()->subMonth()->month)
@@ -40,5 +50,4 @@
             ]);
 
-        // Updated Reports - No Invoice model references
 
         // 1. Top Buyers - Calculate from orders and order_batches
Index: app/Http/Controllers/GenericModelController.php
===================================================================
--- app/Http/Controllers/GenericModelController.php	(revision 99b0ca3cb6693d65d404ff94fba81fdfca07f8ee)
+++ app/Http/Controllers/GenericModelController.php	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
@@ -7,4 +7,5 @@
 use Illuminate\Support\Str;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
+
 class GenericModelController extends Controller
 {
@@ -27,7 +28,8 @@
     public function index(Request $request, string $model)
     {
-        if ($model === 'orders') {
-            return app(OrderController::class)->index($request);
-        }
+        // Remove the orders redirect - orders are now handled by OrderController directly
+        // if ($model === 'orders') {
+        //     return app(OrderController::class)->index($request);
+        // }
 
         $modelClass = $this->getModelClass($model);
@@ -77,5 +79,5 @@
         ]);
     }
-//
+
     public function store(Request $request, string $model)
     {
@@ -112,19 +114,10 @@
             $created = $modelClass::create($data);
             \Log::info('STORE - created record', ['id' => $created->id ?? null, 'model' => $model]);
-            // Return JSON so you can see success in the Network tab without redirect issues
-//            return response()->json([
-//                'status' => 'ok',
-//                'created_id' => $created->id ?? null,
-//                'data' => $data,
-//            ], 201);
+
             return redirect()->route('generic.index', ['model' => $model])
                 ->with('success', Str::singular($model) . ' created successfully.');
         } catch (\Throwable $e) {
             \Log::error('STORE - DB error: ' . $e->getMessage(), ['exception' => $e]);
-//            return response()->json([
-//                'status' => 'error',
-//                'message' => $e->getMessage(),
-//                'data' => $data,
-//            ], 500);
+
             return redirect()->back()
                 ->withErrors(['error' => 'Failed to create ' . $model . ': ' . $e->getMessage()])
@@ -165,18 +158,10 @@
             $item->update($data);
             \Log::info('UPDATE - updated record', ['id' => $item->id]);
-//            return response()->json([
-//                'status' => 'ok',
-//                'updated_id' => $item->id,
-//                'data' => $data,
-//            ], 200);
+
             return redirect()->route('generic.index', ['model' => $model])
                 ->with('success', Str::singular($model) . ' updated successfully.');
         } catch (\Throwable $e) {
             \Log::error('UPDATE - DB error: ' . $e->getMessage(), ['exception' => $e]);
-//            return response()->json([
-//                'status' => 'error',
-//                'message' => $e->getMessage(),
-//                'data' => $data,
-//            ], 500);
+
             return redirect()->back()
                 ->withErrors(['error' => 'Failed to update ' . $model . ': ' . $e->getMessage()])
@@ -184,5 +169,4 @@
         }
     }
-
 
     public function destroy(string $model, string $id)
Index: app/Http/Controllers/OrderController.php
===================================================================
--- app/Http/Controllers/OrderController.php	(revision 99b0ca3cb6693d65d404ff94fba81fdfca07f8ee)
+++ app/Http/Controllers/OrderController.php	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
@@ -8,4 +8,5 @@
 use App\Models\Transport;
 use App\Models\Batch;
+use Barryvdh\DomPDF\Facade\Pdf;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
@@ -15,5 +16,5 @@
 {
     /**
-     * Display a listing of the resource.
+     * Display a listing of orders - This is called from GenericModelController
      */
     public function index(Request $request)
@@ -21,5 +22,4 @@
         $model = 'Order';
 
-        // Get paginated orders with all necessary relationships
         $query = Order::with([
             'buyer',
@@ -32,5 +32,4 @@
         ]);
 
-        // Search functionality
         if ($request->has('search') && $request->search) {
             $search = $request->search;
@@ -47,22 +46,17 @@
         }
 
-        // Sorting
         $sortBy = $request->get('sort_by', 'date');
         $sortDirection = $request->get('sort_direction', 'desc');
         $query->orderBy($sortBy, $sortDirection);
 
-        // Pagination
         $perPage = $request->get('per_page', 10);
         $items = $query->paginate($perPage);
 
-        // Foreign key map for the frontend
         $fkMap = [
             'buyer_id' => 'clients',
             'receiver_id' => 'clients',
             'transport_id' => 'transports',
-            'payment_id' => 'payments',
         ];
 
-        // Related options for form dropdowns
         $relatedOptions = [
             'buyer_id' => Client::select('id', 'name')->get()->toArray(),
@@ -71,23 +65,16 @@
         ];
 
-        // If the request is for the OrderPage (custom view)
-        if ($request->wantsJson() || $request->header('X-Inertia')) {
-            return Inertia::render('OrderPage', [
-                'model' => $model,
-                'items' => $items,
-                'filters' => [
-                    'search' => $request->search,
-                    'sort_by' => $sortBy,
-                    'sort_direction' => $sortDirection,
-                    'per_page' => $perPage,
-                    'open_id' => $request->open_id,
-                ],
-                'fkMap' => $fkMap,
-                'relatedOptions' => $relatedOptions,
-            ]);
-        }
-
-        // Fallback to generic model page
-        return Inertia::render('GenericModelPage', [
+        // Get available batches for the create form
+        $availableBatches = Batch::with('product')->get()->map(function($batch) {
+            return [
+                'id' => $batch->id,
+                'batch_code' => $batch->batch_code,
+                'product_name' => $batch->product->name ?? 'N/A',
+                'units_per_batch' => $batch->units_per_batch,
+                'net_weight' => $batch->net_weight,
+            ];
+        });
+
+        return Inertia::render('OrderPage', [
             'model' => $model,
             'items' => $items,
@@ -101,17 +88,10 @@
             'fkMap' => $fkMap,
             'relatedOptions' => $relatedOptions,
+            'availableBatches' => $availableBatches,
         ]);
     }
 
     /**
-     * Show the form for creating a new resource.
-     */
-    public function create()
-    {
-        //
-    }
-
-    /**
-     * Store a newly created resource in storage.
+     * Store a newly created order
      */
     public function store(Request $request)
@@ -124,6 +104,6 @@
             $order = Order::create($validated);
 
-            // If batches are provided, attach them to the order
-            if ($request->has('batches')) {
+            // Add batches if provided
+            if ($request->has('batches') && is_array($request->batches)) {
                 foreach ($request->batches as $batchData) {
                     $order->batches()->attach($batchData['batch_id'], [
@@ -135,7 +115,28 @@
             }
 
+            // Create payment if requested
+            if ($request->boolean('create_payment')) {
+                $totalAmount = 0;
+                if ($request->has('batches') && is_array($request->batches)) {
+                    foreach ($request->batches as $batchData) {
+                        $totalAmount += $batchData['quantity'] * $batchData['price_per_unit'];
+                    }
+                }
+
+                Payment::create([
+                    'order_id' => $order->id,
+                    'amount' => $totalAmount,
+                    'currency' => $request->get('payment_currency', 'USD'),
+                    'due_date' => $request->get('payment_due_date', now()->addDays(30)),
+                    'exchange_rate' => $request->get('payment_exchange_rate', 1.0),
+                    'payment_date' => null,
+                    'payment_method' => $request->get('payment_method', 'bank_transfer'),
+                    'payment_status' => 'pending'
+                ]);
+            }
+
             DB::commit();
 
-            return redirect()->route('orders.index')
+            return redirect()->route('generic.index', ['model' => 'orders'])
                 ->with('success', 'Order created successfully.');
 
@@ -147,35 +148,5 @@
 
     /**
-     * Display the specified resource.
-     */
-    public function show(Order $order)
-    {
-        $order->load([
-            'buyer',
-            'receiver',
-            'transport',
-            'payment',
-            'invoice',
-            'packingList',
-            'batches' => function($query) {
-                $query->with('product');
-            }
-        ]);
-
-        return Inertia::render('OrderShow', [
-            'order' => $order,
-        ]);
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     */
-    public function edit(Order $order)
-    {
-        //
-    }
-
-    /**
-     * Update the specified resource in storage.
+     * Update an existing order
      */
     public function update(Request $request, Order $order)
@@ -202,5 +173,5 @@
             DB::commit();
 
-            return redirect()->route('orders.index')
+            return redirect()->route('generic.index', ['model' => 'orders'])
                 ->with('success', 'Order updated successfully.');
 
@@ -212,5 +183,5 @@
 
     /**
-     * Remove the specified resource from storage.
+     * Delete an order
      */
     public function destroy(Order $order)
@@ -219,13 +190,10 @@
             DB::beginTransaction();
 
-            // Delete related records first
             $order->batches()->detach();
-
-            // Delete the order
             $order->delete();
 
             DB::commit();
 
-            return redirect()->route('orders.index')
+            return redirect()->route('generic.index', ['model' => 'orders'])
                 ->with('success', 'Order deleted successfully.');
 
@@ -237,138 +205,181 @@
 
     /**
-     * Generate invoice for an order
+     * Generate and download invoice PDF for an order
      */
     public function generateInvoice(Order $order)
     {
         try {
-            DB::beginTransaction();
-
-            // Check if invoice already exists
-            if ($order->invoice) {
-                return back()->with('error', 'Invoice already exists for this order.');
-            }
-
-            // Calculate total amount from batches
-            $totalAmount = $order->batches->sum(function($batch) {
+            // Load all necessary relationships
+            $order->load([
+                'buyer',
+                'receiver',
+                'transport',
+                'payment',
+                'batches.product'
+            ]);
+
+            // Calculate totals
+            $subtotal = $order->batches->sum(function($batch) {
                 return $batch->pivot->quantity * $batch->pivot->price_per_unit;
             });
 
-            // Create payment record if it doesn't exist
-            if (!$order->payment) {
-                $payment = Payment::create([
-                    'order_id' => $order->id,
-                    'amount' => $totalAmount,
-                    'currency' => 'USD', // Default currency
-                    'due_date' => now()->addDays(30),
-                    'exchange_rate' => 1.0,
-                    'payment_date' => null,
-                    'payment_method' => 'bank_transfer',
-                    'payment_status' => 'pending'
-                ]);
-
-                // Update order with payment_id
-                $order->update(['payment_id' => $payment->id]);
-            }
-
-            DB::commit();
-
-            return back()->with('success', 'Invoice generated successfully.');
-
-        } catch (\Exception $e) {
-            DB::rollBack();
-            return back()->with('error', 'Failed to generate invoice: ' . $e->getMessage());
-        }
-    }
-
-    /**
-     * Generate packing list for an order
+            $taxRate = 18; // 18% tax - adjust as needed
+            $taxAmount = $subtotal * ($taxRate / 100);
+            $totalAmount = $subtotal + $taxAmount;
+
+            // Generate invoice number
+            $invoiceNumber = 'INV-' . date('Y') . '-' . str_pad($order->id, 6, '0', STR_PAD_LEFT);
+
+            // Prepare data for PDF
+            $data = [
+                'order' => $order,
+                'invoiceNumber' => $invoiceNumber,
+                'invoiceDate' => now()->format('Y-m-d'),
+                'dueDate' => now()->addDays(30)->format('Y-m-d'),
+                'subtotal' => number_format($subtotal, 2),
+                'taxRate' => $taxRate,
+                'taxAmount' => number_format($taxAmount, 2),
+                'totalAmount' => number_format($totalAmount, 2),
+                'currency' => $order->payment->currency ?? 'USD',
+            ];
+
+            // Generate PDF with proper headers for download
+            $pdf = Pdf::loadView('pdfs.invoice', $data)
+                ->setPaper('a4', 'portrait')
+                ->setOption('margin-top', 10)
+                ->setOption('margin-bottom', 10)
+                ->setOption('margin-left', 10)
+                ->setOption('margin-right', 10);
+
+            // Use download method with proper filename
+            return $pdf->download("invoice-{$invoiceNumber}.pdf");
+
+        } catch (\Exception $e) {
+            // If there's an error, redirect back with error message
+            return redirect()->back()->with('error', 'Failed to generate invoice: ' . $e->getMessage());
+        }
+    }
+
+    /**
+     * Generate and download packing list PDF for an order
      */
     public function generatePackingList(Order $order)
     {
         try {
-            DB::beginTransaction();
-
-            // Check if packing list already exists
-            if ($order->packingList) {
-                return back()->with('error', 'Packing list already exists for this order.');
-            }
-
-            DB::commit();
-
-            return back()->with('success', 'Packing list generated successfully.');
-
-        } catch (\Exception $e) {
-            DB::rollBack();
-            return back()->with('error', 'Failed to generate packing list: ' . $e->getMessage());
-        }
-    }
-
-    /**
-     * Add batch to order
-     */
-    public function addBatch(Request $request, Order $order)
-    {
-        $validated = $request->validate([
-            'batch_id' => 'required|exists:batches,id',
-            'quantity' => 'required|integer|min:1',
-            'price_per_unit' => 'required|numeric|min:0',
-        ]);
-        try {
-            $order->batches()->attach($validated['batch_id'], [
-                'quantity' => $validated['quantity'],
-                'price_per_unit' => $validated['price_per_unit'],
-                'total_price' => $validated['quantity'] * $validated['price_per_unit']
+            // Load all necessary relationships
+            $order->load([
+                'buyer',
+                'receiver',
+                'transport',
+                'batches.product'
             ]);
 
-            return back()->with('success', 'Batch added to order successfully.');
-
-        } catch (\Exception $e) {
-            return back()->with('error', 'Failed to add batch to order: ' . $e->getMessage());
-        }
-    }
-
-    /**
-     * Remove batch from order
-     */
-    public function removeBatch(Order $order, Batch $batch)
-    {
-        try {
-            $order->batches()->detach($batch->id);
-
-            return back()->with('success', 'Batch removed from order successfully.');
-
-        } catch (\Exception $e) {
-            return back()->with('error', 'Failed to remove batch from order: ' . $e->getMessage());
-        }
-    }
-
-    /**
-     * Get available batches for order
-     */
-    public function getAvailableBatches(Order $order)
-    {
-        $availableBatches = Batch::whereDoesntHave('orders', function($query) use ($order) {
-            $query->where('order_id', $order->id);
-        })->with('product')->get();
-
-        return response()->json($availableBatches);
-    }
-
-    /**
-     * Update order status
-     */
-    public function updateStatus(Request $request, Order $order)
-    {
-        $validated = $request->validate([
-            'status' => 'required|in:pending,confirmed,processing,shipped,delivered,cancelled'
-        ]);
-
-        try {
-            $order->update(['status' => $validated['status']]);
-
-            return back()->with('success', 'Order status updated successfully.');
-
-        } catch (\Exception $e) {
-            return back()->with('error', 'Failed to update order status: ' . $e->getMessage());
+            // Calculate total weight and units
+            $totalNetWeight = $order->batches->sum('net_weight');
+            $totalGrossWeight = $order->batches->sum('gross_weight');
+            $totalUnits = $order->batches->sum(function($batch) {
+                return $batch->pivot->quantity;
+            });
+            $totalPackages = $order->batches->count();
+
+            // Generate packing list number
+            $packingListNumber = 'PL-' . date('Y') . '-' . str_pad($order->id, 6, '0', STR_PAD_LEFT);
+
+            // Prepare data for PDF
+            $data = [
+                'order' => $order,
+                'packingListNumber' => $packingListNumber,
+                'packingDate' => now()->format('Y-m-d'),
+                'totalNetWeight' => number_format($totalNetWeight, 2),
+                'totalGrossWeight' => number_format($totalGrossWeight, 2),
+                'totalUnits' => $totalUnits,
+                'totalPackages' => $totalPackages,
+            ];
+
+            // Generate PDF
+            $pdf = Pdf::loadView('pdfs.packing-list', $data)
+                ->setPaper('a4', 'portrait')
+                ->setOption('margin-top', 10)
+                ->setOption('margin-bottom', 10)
+                ->setOption('margin-left', 10)
+                ->setOption('margin-right', 10);
+
+            // Download PDF
+            return $pdf->download("packing-list-{$packingListNumber}.pdf");
+
+        } catch (\Exception $e) {
+            return redirect()->back()->with('error', 'Failed to generate packing list: ' . $e->getMessage());
+        }
+    }
+
+    /**
+     * Preview invoice in browser (optional)
+     */
+    public function previewInvoice(Order $order)
+    {
+        try {
+            $order->load(['buyer', 'receiver', 'transport', 'payment', 'batches.product']);
+
+            $subtotal = $order->batches->sum(function($batch) {
+                return $batch->pivot->quantity * $batch->pivot->price_per_unit;
+            });
+
+            $taxRate = 18;
+            $taxAmount = $subtotal * ($taxRate / 100);
+            $totalAmount = $subtotal + $taxAmount;
+
+            $invoiceNumber = 'INV-' . date('Y') . '-' . str_pad($order->id, 6, '0', STR_PAD_LEFT);
+
+            $data = [
+                'order' => $order,
+                'invoiceNumber' => $invoiceNumber,
+                'invoiceDate' => now()->format('Y-m-d'),
+                'dueDate' => now()->addDays(30)->format('Y-m-d'),
+                'subtotal' => number_format($subtotal, 2),
+                'taxRate' => $taxRate,
+                'taxAmount' => number_format($taxAmount, 2),
+                'totalAmount' => number_format($totalAmount, 2),
+                'currency' => $order->payment->currency ?? 'USD',
+            ];
+
+            $pdf = Pdf::loadView('pdfs.invoice', $data);
+            return $pdf->stream("invoice-{$invoiceNumber}.pdf");
+
+        } catch (\Exception $e) {
+            return redirect()->back()->with('error', 'Failed to preview invoice: ' . $e->getMessage());
+        }
+    }
+
+    /**
+     * Preview packing list in browser (optional)
+     */
+    public function previewPackingList(Order $order)
+    {
+        try {
+            $order->load(['buyer', 'receiver', 'transport', 'batches.product']);
+
+            $totalNetWeight = $order->batches->sum('net_weight');
+            $totalGrossWeight = $order->batches->sum('gross_weight');
+            $totalUnits = $order->batches->sum(function($batch) {
+                return $batch->pivot->quantity;
+            });
+
+            $packingListNumber = 'PL-' . date('Y') . '-' . str_pad($order->id, 6, '0', STR_PAD_LEFT);
+
+            $data = [
+                'order' => $order,
+                'packingListNumber' => $packingListNumber,
+                'packingDate' => now()->format('Y-m-d'),
+                'totalNetWeight' => number_format($totalNetWeight, 2),
+                'totalGrossWeight' => number_format($totalGrossWeight, 2),
+                'totalUnits' => $totalUnits,
+                'totalPackages' => $order->batches->count(),
+            ];
+
+            $pdf = Pdf::loadView('pdfs.packing-list', $data);
+            return $pdf->stream("packing-list-{$packingListNumber}.pdf");
+
+        } catch (\Exception $e) {
+            return redirect()->back()->with('error', 'Failed to preview packing list: ' . $e->getMessage());
         }
     }
Index: app/Models/Order.php
===================================================================
--- app/Models/Order.php	(revision 99b0ca3cb6693d65d404ff94fba81fdfca07f8ee)
+++ app/Models/Order.php	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
@@ -23,8 +23,7 @@
         'receiver_id',
         'transport_id',
-        'payment_id',
+        // Remove payment_id from here
     ];
 
-    // Add this to ensure status is never null
     protected $attributes = [
         'status' => 'pending',
@@ -45,5 +44,4 @@
             'receiver_id' => 'required|string|exists:clients,id',
             'transport_id' => 'nullable|string|exists:transports,id',
-            'payment_id' => 'nullable|string|exists:payments,id',
         ];
     }
@@ -59,7 +57,8 @@
     }
 
-    public function payment(): BelongsTo
+    // Simple one-to-one relationship
+    public function payment(): HasOne
     {
-        return $this->belongsTo(Payment::class, 'payment_id');
+        return $this->hasOne(Payment::class, 'order_id');
     }
 
Index: app/Models/Payment.php
===================================================================
--- app/Models/Payment.php	(revision 99b0ca3cb6693d65d404ff94fba81fdfca07f8ee)
+++ app/Models/Payment.php	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
@@ -10,9 +10,10 @@
 {
     use HasUuids;
+
     protected $primaryKey = 'id';
     public $incrementing = false;
     protected $keyType = 'string';
     protected $fillable = [
-        'order_id',
+        'order_id', // This is the only foreign key we need
         'amount',
         'currency',
@@ -32,10 +33,12 @@
             'due_date' => 'required|date|after_or_equal:today',
             'exchange_rate' => 'required|numeric|min:0.0001|max:9999.9999',
-            'payment_date' => 'required|date|before_or_equal:today',
+            'payment_date' => 'nullable|date|before_or_equal:today',
             'payment_method' => 'required|string|in:bank_transfer,credit_card,cash,check,wire_transfer',
             'payment_status' => 'required|string|in:pending,paid,failed,refunded,cancelled',
         ];
     }
-    public function order(): BelongsTo {
+
+    public function order(): BelongsTo
+    {
         return $this->belongsTo(Order::class, 'order_id');
     }
Index: composer.json
===================================================================
--- composer.json	(revision 99b0ca3cb6693d65d404ff94fba81fdfca07f8ee)
+++ composer.json	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
@@ -8,8 +8,10 @@
     "require": {
         "php": "^8.2",
+        "barryvdh/laravel-dompdf": "^3.1",
         "inertiajs/inertia-laravel": "^2.0",
         "laravel/framework": "^12.0",
         "laravel/sanctum": "^4.0",
         "laravel/tinker": "^2.10.1",
+        "symfony/polyfill-iconv": "^1.33",
         "tightenco/ziggy": "^2.0"
     },
Index: resources/js/Pages/OrderPage.vue
===================================================================
--- resources/js/Pages/OrderPage.vue	(revision 99b0ca3cb6693d65d404ff94fba81fdfca07f8ee)
+++ resources/js/Pages/OrderPage.vue	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
@@ -19,10 +19,30 @@
 const generateInvoice = (order: any) => {
     if (confirm('Generate invoice for this order?')) {
+        // Use window.location for direct download
+        window.location.href = `/orders/${order.id}/generate-invoice`;
+    }
+};
+
+const generatePackingList = (order: any) => {
+    if (confirm('Generate packing list for this order?')) {
+        window.location.href = `/orders/${order.id}/generate-packing-list`;
+    }
+};
+const viewInvoice = (order: any) => {
+    window.open(`/orders/${order.id}/preview-invoice`, '_blank');
+};
+
+const viewPackingList = (order: any) => {
+    window.open(`/orders/${order.id}/preview-packing-list`, '_blank');
+};
+
+// Payment management
+const createPayment = (order: any) => {
+    if (confirm('Create payment for this order?')) {
         router.post(
-            `/orders/${order.id}/generate-invoice`,
+            `/orders/${order.id}/create-payment`,
             {},
             {
                 onSuccess: () => {
-                    // Refresh the page to show the new invoice
                     router.reload();
                 },
@@ -32,29 +52,15 @@
 };
 
-const generatePackingList = (order: any) => {
-    if (confirm('Generate packing list for this order?')) {
-        router.post(
-            `/orders/${order.id}/generate-packing-list`,
-            {},
-            {
-                onSuccess: () => {
-                    // Refresh the page to show the new packing list
-                    router.reload();
-                },
-            },
-        );
-    }
-};
-
-const viewInvoice = (order: any) => {
-    if (order.invoice) {
-        router.get(`/invoices?open_id=${order.invoice.id}`);
-    }
-};
-
-const viewPackingList = (order: any) => {
-    if (order.packing_list) {
-        router.get(`/packing-lists?open_id=${order.packing_list.id}`);
-    }
+const editPayment = (order: any) => {
+    // Check both payment relationships
+    const payment = order.payment || order.payments?.[0];
+    if (payment) {
+        router.get(`/payments?open_id=${payment.id}`);
+    }
+};
+
+// Helper to get payment from order (checking both relationships)
+const getOrderPayment = (order: any) => {
+    return order.payment || order.payments?.[0] || null;
 };
 
@@ -71,9 +77,45 @@
             return 'default';
         case 'delivered':
-            return 'success';
+            return 'default';
         case 'cancelled':
             return 'destructive';
         default:
             return 'secondary';
+    }
+};
+
+// Format payment status with colors
+const getPaymentStatusBadgeVariant = (status: string) => {
+    switch (status) {
+        case 'paid':
+            return 'default';
+        case 'pending':
+            return 'secondary';
+        case 'failed':
+            return 'destructive';
+        case 'refunded':
+            return 'outline';
+        case 'cancelled':
+            return 'destructive';
+        default:
+            return 'secondary';
+    }
+};
+
+// Additional class mapping for visual styling
+const getPaymentStatusBadgeClass = (status: string) => {
+    switch (status) {
+        case 'paid':
+            return 'bg-green-100 text-green-800 border-green-200';
+        case 'pending':
+            return 'bg-yellow-100 text-yellow-800 border-yellow-200';
+        case 'failed':
+            return 'bg-red-100 text-red-800 border-red-200';
+        case 'refunded':
+            return 'bg-blue-100 text-blue-800 border-blue-200';
+        case 'cancelled':
+            return 'bg-gray-100 text-gray-800 border-gray-200';
+        default:
+            return '';
     }
 };
@@ -267,26 +309,43 @@
                         <!-- Payment Information -->
                         <div class="rounded-lg border p-4">
-                            <h5 class="mb-3 font-semibold">
-                                Payment Information
-                            </h5>
-                            <div v-if="item.payment">
+                            <div class="flex items-center justify-between mb-3">
+                                <h5 class="font-semibold">
+                                    Payment Information
+                                </h5>
+                                <div class="flex space-x-2">
+                                    <Button
+                                        v-if="!getOrderPayment(item)"
+                                        variant="outline"
+                                        size="sm"
+                                        @click="createPayment(item)"
+                                    >
+                                        Create Payment
+                                    </Button>
+                                    <Button
+                                        v-else
+                                        variant="outline"
+                                        size="sm"
+                                        @click="editPayment(item)"
+                                    >
+                                        Edit Payment
+                                    </Button>
+                                </div>
+                            </div>
+                            <div v-if="getOrderPayment(item)">
                                 <div class="grid grid-cols-2 gap-4 text-sm">
                                     <div>
                                         <strong>Status:</strong>
                                         <Badge
-                                            :variant="
-                                                item.payment.payment_status ===
-                                                'paid'
-                                                    ? 'success'
-                                                    : 'secondary'
-                                            "
+                                            :variant="getPaymentStatusBadgeVariant(getOrderPayment(item).payment_status)"
+                                            :class="getPaymentStatusBadgeClass(getOrderPayment(item).payment_status)"
+                                            class="ml-2"
                                         >
-                                            {{ item.payment.payment_status }}
+                                            {{ getOrderPayment(item).payment_status }}
                                         </Badge>
                                     </div>
                                     <div>
                                         <strong>Amount:</strong> ${{
-                                            item.payment.amount
-                                        }}
+                                            getOrderPayment(item).amount
+                                        }} {{ getOrderPayment(item).currency }}
                                     </div>
                                     <div>
@@ -294,5 +353,5 @@
                                         {{
                                             new Date(
-                                                item.payment.due_date,
+                                                getOrderPayment(item).due_date,
                                             ).toLocaleDateString()
                                         }}
@@ -301,15 +360,23 @@
                                         <strong>Payment Date:</strong>
                                         {{
-                                            item.payment.payment_date
+                                            getOrderPayment(item).payment_date
                                                 ? new Date(
-                                                      item.payment.payment_date,
-                                                  ).toLocaleDateString()
+                                                    getOrderPayment(item).payment_date,
+                                                ).toLocaleDateString()
                                                 : 'Not paid'
                                         }}
                                     </div>
+                                    <div>
+                                        <strong>Payment Method:</strong>
+                                        {{ getOrderPayment(item).payment_method }}
+                                    </div>
+                                    <div>
+                                        <strong>Exchange Rate:</strong>
+                                        {{ getOrderPayment(item).exchange_rate }}
+                                    </div>
                                 </div>
                             </div>
                             <div v-else class="text-muted-foreground">
-                                No payment information available.
+                                No payment information available. Click "Create Payment" to add payment details.
                             </div>
                         </div>
@@ -388,3 +455,54 @@
     border-radius: 0.25rem;
 }
+
+/* Custom badge styles for better visual indication */
+:deep(.bg-green-100) {
+    background-color: #dcfce7;
+}
+:deep(.text-green-800) {
+    color: #166534;
+}
+:deep(.border-green-200) {
+    border-color: #bbf7d0;
+}
+
+:deep(.bg-yellow-100) {
+    background-color: #fef9c3;
+}
+:deep(.text-yellow-800) {
+    color: #854d0e;
+}
+:deep(.border-yellow-200) {
+    border-color: #fef08a;
+}
+
+:deep(.bg-red-100) {
+    background-color: #fee2e2;
+}
+:deep(.text-red-800) {
+    color: #991b1b;
+}
+:deep(.border-red-200) {
+    border-color: #fecaca;
+}
+
+:deep(.bg-blue-100) {
+    background-color: #dbeafe;
+}
+:deep(.text-blue-800) {
+    color: #1e40af;
+}
+:deep(.border-blue-200) {
+    border-color: #bfdbfe;
+}
+
+:deep(.bg-gray-100) {
+    background-color: #f3f4f6;
+}
+:deep(.text-gray-800) {
+    color: #374151;
+}
+:deep(.border-gray-200) {
+    border-color: #e5e7eb;
+}
 </style>
Index: resources/views/pdfs/invoice.blade.php
===================================================================
--- resources/views/pdfs/invoice.blade.php	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
+++ resources/views/pdfs/invoice.blade.php	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
@@ -0,0 +1,280 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>Invoice {{ $invoiceNumber }}</title>
+    <style>
+        * {
+            margin: 0;
+            padding: 0;
+            box-sizing: border-box;
+        }
+        body {
+            font-family: 'DejaVu Sans', sans-serif;
+            font-size: 12px;
+            color: #333;
+            line-height: 1.5;
+        }
+        .header {
+            margin-bottom: 30px;
+            border-bottom: 3px solid #2563eb;
+            padding-bottom: 20px;
+        }
+        .header h1 {
+            font-size: 32px;
+            color: #2563eb;
+            margin-bottom: 5px;
+        }
+        .header .invoice-details {
+            text-align: right;
+            font-size: 11px;
+        }
+        .company-info {
+            margin-bottom: 10px;
+        }
+        .company-info h2 {
+            font-size: 16px;
+            margin-bottom: 5px;
+        }
+        .section {
+            margin-bottom: 20px;
+        }
+        .section-title {
+            font-size: 14px;
+            font-weight: bold;
+            color: #2563eb;
+            margin-bottom: 10px;
+            padding-bottom: 5px;
+            border-bottom: 1px solid #e5e7eb;
+        }
+        .two-column {
+            display: table;
+            width: 100%;
+            margin-bottom: 20px;
+        }
+        .column {
+            display: table-cell;
+            width: 48%;
+            vertical-align: top;
+        }
+        .column:first-child {
+            padding-right: 4%;
+        }
+        .info-box {
+            background: #f9fafb;
+            padding: 15px;
+            border-radius: 5px;
+            margin-bottom: 10px;
+        }
+        .info-box p {
+            margin-bottom: 3px;
+        }
+        .info-box strong {
+            display: inline-block;
+            min-width: 100px;
+        }
+        table {
+            width: 100%;
+            border-collapse: collapse;
+            margin-bottom: 20px;
+        }
+        table thead {
+            background: #2563eb;
+            color: white;
+        }
+        table th {
+            padding: 10px;
+            text-align: left;
+            font-weight: bold;
+            font-size: 11px;
+        }
+        table td {
+            padding: 8px 10px;
+            border-bottom: 1px solid #e5e7eb;
+        }
+        table tbody tr:hover {
+            background: #f9fafb;
+        }
+        .text-right {
+            text-align: right;
+        }
+        .text-center {
+            text-align: center;
+        }
+        .totals-section {
+            margin-top: 20px;
+            float: right;
+            width: 300px;
+        }
+        .totals-row {
+            display: table;
+            width: 100%;
+            padding: 8px 0;
+            border-bottom: 1px solid #e5e7eb;
+        }
+        .totals-row.total {
+            background: #2563eb;
+            color: white;
+            font-size: 16px;
+            font-weight: bold;
+            padding: 12px 10px;
+            margin-top: 5px;
+            border-radius: 5px;
+        }
+        .totals-label {
+            display: table-cell;
+            width: 60%;
+            font-weight: bold;
+        }
+        .totals-amount {
+            display: table-cell;
+            width: 40%;
+            text-align: right;
+        }
+        .notes {
+            clear: both;
+            margin-top: 30px;
+            padding-top: 20px;
+            border-top: 1px solid #e5e7eb;
+        }
+        .footer {
+            margin-top: 50px;
+            padding-top: 20px;
+            border-top: 2px solid #e5e7eb;
+            text-align: center;
+            font-size: 10px;
+            color: #6b7280;
+        }
+        .status-badge {
+            display: inline-block;
+            padding: 4px 12px;
+            border-radius: 12px;
+            font-size: 10px;
+            font-weight: bold;
+        }
+        .status-pending { background: #fef3c7; color: #92400e; }
+        .status-paid { background: #d1fae5; color: #065f46; }
+        .status-overdue { background: #fee2e2; color: #991b1b; }
+    </style>
+</head>
+<body>
+<div class="header">
+    <div style="display: table; width: 100%;">
+        <div style="display: table-cell; width: 50%;">
+            <div class="company-info">
+                <h2>Your Company Name</h2>
+                <p>123 Business Street</p>
+                <p>Skopje, North Macedonia</p>
+                <p>Email: info@company.com</p>
+                <p>Phone: +389 XX XXX XXX</p>
+            </div>
+        </div>
+        <div style="display: table-cell; width: 50%; text-align: right;">
+            <h1>INVOICE</h1>
+            <div class="invoice-details">
+                <p><strong>Invoice #:</strong> {{ $invoiceNumber }}</p>
+                <p><strong>Date:</strong> {{ $invoiceDate }}</p>
+                <p><strong>Due Date:</strong> {{ $dueDate }}</p>
+                <p><strong>Order ID:</strong> {{ $order->id }}</p>
+            </div>
+        </div>
+    </div>
+</div>
+
+<div class="two-column">
+    <div class="column">
+        <div class="section-title">Bill To</div>
+        <div class="info-box">
+            <p><strong>{{ $order->buyer->name }}</strong></p>
+            <p>{{ $order->buyer->address ?? 'N/A' }}</p>
+            <p>{{ $order->buyer->city ?? '' }}, {{ $order->buyer->country ?? '' }}</p>
+            <p>Email: {{ $order->buyer->email ?? 'N/A' }}</p>
+            <p>Phone: {{ $order->buyer->phone ?? 'N/A' }}</p>
+        </div>
+    </div>
+    <div class="column">
+        <div class="section-title">Ship To</div>
+        <div class="info-box">
+            <p><strong>{{ $order->receiver->name }}</strong></p>
+            <p>{{ $order->receiver->address ?? 'N/A' }}</p>
+            <p>{{ $order->receiver->city ?? '' }}, {{ $order->receiver->country ?? '' }}</p>
+            <p>Email: {{ $order->receiver->email ?? 'N/A' }}</p>
+            <p>Phone: {{ $order->receiver->phone ?? 'N/A' }}</p>
+        </div>
+    </div>
+</div>
+
+<div class="section">
+    <div class="section-title">Order Details</div>
+    <table>
+        <thead>
+        <tr>
+            <th>#</th>
+            <th>Batch Code</th>
+            <th>Product</th>
+            <th class="text-center">Quantity</th>
+            <th class="text-right">Unit Price</th>
+            <th class="text-right">Total</th>
+        </tr>
+        </thead>
+        <tbody>
+        @foreach($order->batches as $index => $batch)
+            <tr>
+                <td>{{ $index + 1 }}</td>
+                <td>{{ $batch->batch_code }}</td>
+                <td>{{ $batch->product->name ?? 'N/A' }}</td>
+                <td class="text-center">{{ $batch->pivot->quantity }}</td>
+                <td class="text-right">{{ $currency }} {{ number_format($batch->pivot->price_per_unit, 2) }}</td>
+                <td class="text-right">{{ $currency }} {{ number_format($batch->pivot->total_price, 2) }}</td>
+            </tr>
+        @endforeach
+        </tbody>
+    </table>
+</div>
+
+<div class="totals-section">
+    <div class="totals-row">
+        <div class="totals-label">Subtotal:</div>
+        <div class="totals-amount">{{ $currency }} {{ $subtotal }}</div>
+    </div>
+    <div class="totals-row">
+        <div class="totals-label">Tax ({{ $taxRate }}%):</div>
+        <div class="totals-amount">{{ $currency }} {{ $taxAmount }}</div>
+    </div>
+    <div class="totals-row total">
+        <div class="totals-label">Total Amount:</div>
+        <div class="totals-amount">{{ $currency }} {{ $totalAmount }}</div>
+    </div>
+</div>
+
+<div class="notes">
+    @if($order->payment)
+        <div class="section-title">Payment Information</div>
+        <div class="info-box">
+            <p><strong>Status:</strong>
+                <span class="status-badge status-{{ $order->payment->payment_status }}">
+                    {{ strtoupper($order->payment->payment_status) }}
+                </span>
+            </p>
+            <p><strong>Payment Method:</strong> {{ ucwords(str_replace('_', ' ', $order->payment->payment_method)) }}</p>
+            <p><strong>Due Date:</strong> {{ \Carbon\Carbon::parse($order->payment->due_date)->format('Y-m-d') }}</p>
+            @if($order->payment->payment_date)
+                <p><strong>Payment Date:</strong> {{ \Carbon\Carbon::parse($order->payment->payment_date)->format('Y-m-d') }}</p>
+            @endif
+        </div>
+    @endif
+
+    <div class="section-title" style="margin-top: 20px;">Payment Instructions</div>
+    <p>Please make payment to:</p>
+    <p><strong>Bank Name:</strong> Your Bank Name</p>
+    <p><strong>Account Number:</strong> XXXX-XXXX-XXXX</p>
+    <p><strong>SWIFT/BIC:</strong> XXXXXXXX</p>
+    <p><strong>Reference:</strong> {{ $invoiceNumber }}</p>
+</div>
+
+<div class="footer">
+    <p>Thank you for your business!</p>
+    <p>This is a computer-generated invoice. For any queries, please contact us at info@company.com</p>
+</div>
+</body>
+</html>
Index: resources/views/pdfs/packing-list.blade.php
===================================================================
--- resources/views/pdfs/packing-list.blade.php	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
+++ resources/views/pdfs/packing-list.blade.php	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
@@ -0,0 +1,332 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>Packing List {{ $packingListNumber }}</title>
+    <style>
+        * {
+            margin: 0;
+            padding: 0;
+            box-sizing: border-box;
+        }
+        body {
+            font-family: 'DejaVu Sans', sans-serif;
+            font-size: 12px;
+            color: #333;
+            line-height: 1.5;
+        }
+        .header {
+            margin-bottom: 30px;
+            border-bottom: 3px solid #059669;
+            padding-bottom: 20px;
+        }
+        .header h1 {
+            font-size: 32px;
+            color: #059669;
+            margin-bottom: 5px;
+        }
+        .header .packing-details {
+            text-align: right;
+            font-size: 11px;
+        }
+        .company-info {
+            margin-bottom: 10px;
+        }
+        .company-info h2 {
+            font-size: 16px;
+            margin-bottom: 5px;
+        }
+        .section {
+            margin-bottom: 20px;
+        }
+        .section-title {
+            font-size: 14px;
+            font-weight: bold;
+            color: #059669;
+            margin-bottom: 10px;
+            padding-bottom: 5px;
+            border-bottom: 1px solid #e5e7eb;
+        }
+        .two-column {
+            display: table;
+            width: 100%;
+            margin-bottom: 20px;
+        }
+        .column {
+            display: table-cell;
+            width: 48%;
+            vertical-align: top;
+        }
+        .column:first-child {
+            padding-right: 4%;
+        }
+        .info-box {
+            background: #f0fdf4;
+            padding: 15px;
+            border-radius: 5px;
+            margin-bottom: 10px;
+            border: 1px solid #bbf7d0;
+        }
+        .info-box p {
+            margin-bottom: 3px;
+        }
+        .info-box strong {
+            display: inline-block;
+            min-width: 100px;
+        }
+        table {
+            width: 100%;
+            border-collapse: collapse;
+            margin-bottom: 20px;
+        }
+        table thead {
+            background: #059669;
+            color: white;
+        }
+        table th {
+            padding: 10px;
+            text-align: left;
+            font-weight: bold;
+            font-size: 11px;
+        }
+        table td {
+            padding: 8px 10px;
+            border-bottom: 1px solid #e5e7eb;
+        }
+        table tbody tr:hover {
+            background: #f0fdf4;
+        }
+        .text-right {
+            text-align: right;
+        }
+        .text-center {
+            text-align: center;
+        }
+        .summary-section {
+            margin-top: 30px;
+            background: #f0fdf4;
+            padding: 20px;
+            border-radius: 5px;
+            border: 2px solid #059669;
+        }
+        .summary-grid {
+            display: table;
+            width: 100%;
+        }
+        .summary-item {
+            display: table-cell;
+            width: 25%;
+            text-align: center;
+            padding: 10px;
+        }
+        .summary-item .label {
+            font-size: 11px;
+            color: #6b7280;
+            margin-bottom: 5px;
+        }
+        .summary-item .value {
+            font-size: 20px;
+            font-weight: bold;
+            color: #059669;
+        }
+        .notes {
+            margin-top: 30px;
+            padding: 15px;
+            background: #fef3c7;
+            border-left: 4px solid #f59e0b;
+            border-radius: 5px;
+        }
+        .notes strong {
+            color: #92400e;
+        }
+        .footer {
+            margin-top: 50px;
+            padding-top: 20px;
+            border-top: 2px solid #e5e7eb;
+            text-align: center;
+            font-size: 10px;
+            color: #6b7280;
+        }
+        .weight-badge {
+            display: inline-block;
+            padding: 2px 8px;
+            background: #dbeafe;
+            color: #1e40af;
+            border-radius: 4px;
+            font-size: 10px;
+            font-weight: bold;
+        }
+        .batch-details {
+            font-size: 10px;
+            color: #6b7280;
+            margin-top: 2px;
+        }
+    </style>
+</head>
+<body>
+<div class="header">
+    <div style="display: table; width: 100%;">
+        <div style="display: table-cell; width: 50%;">
+            <div class="company-info">
+                <h2>Your Company Name</h2>
+                <p>123 Business Street</p>
+                <p>Skopje, North Macedonia</p>
+                <p>Email: info@company.com</p>
+                <p>Phone: +389 XX XXX XXX</p>
+            </div>
+        </div>
+        <div style="display: table-cell; width: 50%; text-align: right;">
+            <h1>PACKING LIST</h1>
+            <div class="packing-details">
+                <p><strong>Packing List #:</strong> {{ $packingListNumber }}</p>
+                <p><strong>Date:</strong> {{ $packingDate }}</p>
+                <p><strong>Order ID:</strong> {{ $order->id }}</p>
+                <p><strong>Order Date:</strong> {{ $order->date->format('Y-m-d') }}</p>
+            </div>
+        </div>
+    </div>
+</div>
+
+<div class="two-column">
+    <div class="column">
+        <div class="section-title">Shipper (From)</div>
+        <div class="info-box">
+            <p><strong>{{ $order->buyer->name }}</strong></p>
+            <p>{{ $order->buyer->address ?? 'N/A' }}</p>
+            <p>{{ $order->buyer->city ?? '' }}, {{ $order->buyer->country ?? '' }}</p>
+            <p>Contact: {{ $order->buyer->phone ?? 'N/A' }}</p>
+            <p>Email: {{ $order->buyer->email ?? 'N/A' }}</p>
+        </div>
+    </div>
+    <div class="column">
+        <div class="section-title">Consignee (To)</div>
+        <div class="info-box">
+            <p><strong>{{ $order->receiver->name }}</strong></p>
+            <p>{{ $order->receiver->address ?? 'N/A' }}</p>
+            <p>{{ $order->receiver->city ?? '' }}, {{ $order->receiver->country ?? '' }}</p>
+            <p>Contact: {{ $order->receiver->phone ?? 'N/A' }}</p>
+            <p>Email: {{ $order->receiver->email ?? 'N/A' }}</p>
+        </div>
+    </div>
+</div>
+
+@if($order->transport)
+    <div class="section">
+        <div class="section-title">Transport Information</div>
+        <div class="info-box">
+            <p><strong>Transport Company:</strong> {{ $order->transport->name }}</p>
+            @if(isset($order->transport->vehicle_type))
+                <p><strong>Vehicle Type:</strong> {{ $order->transport->vehicle_type }}</p>
+            @endif
+            @if(isset($order->transport->driver))
+                <p><strong>Driver:</strong> {{ $order->transport->driver }}</p>
+            @endif
+            @if(isset($order->transport->contact))
+                <p><strong>Contact:</strong> {{ $order->transport->contact }}</p>
+            @endif
+        </div>
+    </div>
+@endif
+
+<div class="section">
+    <div class="section-title">Package Contents</div>
+    <table>
+        <thead>
+        <tr>
+            <th>Package #</th>
+            <th>Batch Code</th>
+            <th>Product Description</th>
+            <th class="text-center">Quantity</th>
+            <th class="text-right">Net Weight (kg)</th>
+            <th class="text-right">Gross Weight (kg)</th>
+        </tr>
+        </thead>
+        <tbody>
+        @foreach($order->batches as $index => $batch)
+            <tr>
+                <td><strong>{{ $index + 1 }}</strong></td>
+                <td>
+                    <strong>{{ $batch->batch_code }}</strong>
+                    <div class="batch-details">
+                        Prod: {{ \Carbon\Carbon::parse($batch->production_date)->format('Y-m-d') }}
+                        | Exp: {{ \Carbon\Carbon::parse($batch->expiration_date)->format('Y-m-d') }}
+                    </div>
+                </td>
+                <td>
+                    <strong>{{ $batch->product->name ?? 'N/A' }}</strong>
+                    @if(isset($batch->product->description))
+                        <div class="batch-details">{{ $batch->product->description }}</div>
+                    @endif
+                </td>
+                <td class="text-center">
+                    <span class="weight-badge">{{ $batch->pivot->quantity }} units</span>
+                </td>
+                <td class="text-right">{{ number_format($batch->net_weight, 2) }}</td>
+                <td class="text-right">{{ number_format($batch->gross_weight, 2) }}</td>
+            </tr>
+        @endforeach
+        </tbody>
+        <tfoot>
+        <tr style="background: #f0fdf4; font-weight: bold;">
+            <td colspan="3" class="text-right"><strong>TOTALS:</strong></td>
+            <td class="text-center">{{ $totalUnits }} units</td>
+            <td class="text-right">{{ $totalNetWeight }} kg</td>
+            <td class="text-right">{{ $totalGrossWeight }} kg</td>
+        </tr>
+        </tfoot>
+    </table>
+</div>
+
+<div class="summary-section">
+    <div class="summary-grid">
+        <div class="summary-item">
+            <div class="label">Total Packages</div>
+            <div class="value">{{ $totalPackages }}</div>
+        </div>
+        <div class="summary-item">
+            <div class="label">Total Units</div>
+            <div class="value">{{ $totalUnits }}</div>
+        </div>
+        <div class="summary-item">
+            <div class="label">Net Weight</div>
+            <div class="value">{{ $totalNetWeight }} kg</div>
+        </div>
+        <div class="summary-item">
+            <div class="label">Gross Weight</div>
+            <div class="value">{{ $totalGrossWeight }} kg</div>
+        </div>
+    </div>
+</div>
+
+<div class="notes">
+    <strong>⚠ Handling Instructions:</strong>
+    <ul style="margin-left: 20px; margin-top: 10px;">
+        <li>Handle with care - fragile contents</li>
+        <li>Keep dry and store in cool place</li>
+        <li>Do not stack more than 3 pallets high</li>
+        <li>Check batch codes and expiration dates upon receipt</li>
+        <li>Report any damage or discrepancies immediately</li>
+    </ul>
+</div>
+
+<div style="margin-top: 50px; border-top: 1px solid #e5e7eb; padding-top: 20px;">
+    <div style="display: table; width: 100%;">
+        <div style="display: table-cell; width: 50%;">
+            <p><strong>Prepared By:</strong></p>
+            <p style="margin-top: 30px; border-top: 1px solid #333; width: 200px; padding-top: 5px;">Signature</p>
+            <p>Date: {{ $packingDate }}</p>
+        </div>
+        <div style="display: table-cell; width: 50%;">
+            <p><strong>Received By:</strong></p>
+            <p style="margin-top: 30px; border-top: 1px solid #333; width: 200px; padding-top: 5px;">Signature</p>
+            <p>Date: _______________</p>
+        </div>
+    </div>
+</div>
+
+<div class="footer">
+    <p>This packing list is for reference purposes only and does not serve as a commercial invoice.</p>
+    <p>For any discrepancies or questions, please contact us immediately at info@company.com</p>
+</div>
+</body>
+</html>
Index: routes/web.php
===================================================================
--- routes/web.php	(revision 99b0ca3cb6693d65d404ff94fba81fdfca07f8ee)
+++ routes/web.php	(revision 715ed4b68b57bdef5a2503bfc72c78f785137c05)
@@ -1,9 +1,9 @@
 <?php
 
+use App\Http\Controllers\OrderController;
 use Illuminate\Support\Facades\Route;
 use App\Http\Controllers\GenericModelController;
 use App\Http\Controllers\DashboardController;
 use App\Http\Controllers\AuthController;
-use App\Http\Controllers\OrderController;
 use Illuminate\Http\Request;
 
@@ -18,24 +18,66 @@
     Route::post('/logout', [AuthController::class, 'logout'])->name('logout');
 
+    // Users routes with admin middleware
     Route::prefix('users')->middleware('admin')->group(function () {
         Route::get('/', function (Request $request) {
             return app(GenericModelController::class)->index($request, 'users');
-        })->name('generic.index');
+        })->name('users.index');
 
         Route::post('/', function (Request $request) {
             return app(GenericModelController::class)->store($request, 'users');
-        })->name('generic.store');
+        })->name('users.store');
 
         Route::put('/{id}', function (Request $request, $id) {
             return app(GenericModelController::class)->update($request, 'users', $id);
-        })->name('generic.update');
+        })->name('users.update');
 
         Route::delete('/{id}', function (Request $request, $id) {
             return app(GenericModelController::class)->destroy('users', $id);
-        })->name('generic.destroy');
+        })->name('users.destroy');
     });
 
-    Route::prefix('{model}')
-        ->group(function () {
+    // Order-specific routes (MUST come BEFORE generic routes)
+    Route::prefix('orders')->group(function () {
+        // Batch operations for select options (no order parameter) - MUST BE FIRST
+        Route::get('batches/select-options', [OrderController::class, 'getBatchesForSelect'])
+            ->name('orders.batches.select-options');
+
+        // CRUD operations for orders
+        Route::get('/', [OrderController::class, 'index'])->name('orders.index');
+        Route::post('/', [OrderController::class, 'store'])->name('orders.store');
+
+        // Order-specific operations (with order parameter)
+        Route::post('{order}/create-payment', [OrderController::class, 'createPayment'])
+            ->name('orders.create-payment');
+
+        Route::post('{order}/add-batch', [OrderController::class, 'addBatch'])
+            ->name('orders.add-batch');
+
+        Route::delete('{order}/remove-batch/{batch}', [OrderController::class, 'removeBatch'])
+            ->name('orders.remove-batch');
+
+        Route::get('{order}/available-batches', [OrderController::class, 'getAvailableBatches'])
+            ->name('orders.available-batches');
+
+        // PDF generation routes
+        Route::get('{order}/generate-invoice', [OrderController::class, 'generateInvoice'])
+            ->name('orders.generate-invoice');
+
+        Route::get('{order}/generate-packing-list', [OrderController::class, 'generatePackingList'])
+            ->name('orders.generate-packing-list');
+
+        // Preview routes (GET)
+        Route::get('{order}/preview-invoice', [OrderController::class, 'previewInvoice'])
+            ->name('orders.preview-invoice');
+
+        Route::get('{order}/preview-packing-list', [OrderController::class, 'previewPackingList'])
+            ->name('orders.preview-packing-list');
+        // Update and Delete (must come after specific routes to avoid conflicts)
+        Route::put('{order}', [OrderController::class, 'update'])->name('orders.update');
+        Route::delete('{order}', [OrderController::class, 'destroy'])->name('orders.destroy');
+    });
+
+    // Generic model routes (MUST come LAST as catch-all)
+    Route::prefix('{model}')->group(function () {
         Route::get('/', [GenericModelController::class, 'index'])->name('generic.index');
         Route::post('/', [GenericModelController::class, 'store'])->name('generic.store');
