<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Invoice #MSN-<?php echo e(str_pad($order->id, 5, '0', STR_PAD_LEFT)); ?></title>
    <style>
        body { font-family: 'Helvetica', sans-serif; color: #333; line-height: 1.6; }
        .invoice-box { max-width: 800px; margin: auto; padding: 30px; border: 1px solid #eee; }
        .header { display: flex; justify-content: space-between; border-bottom: 2px solid #eee; padding-bottom: 20px; margin-bottom: 20px; }
        .title { font-size: 24px; font-weight: bold; color: #555; }
        table { width: 100%; border-collapse: collapse; }
        th { background: #f8f8f8; padding: 10px; text-align: left; }
        td { padding: 10px; border-bottom: 1px solid #eee; }
        .total { font-weight: bold; font-size: 18px; }
    </style>
</head>
<body>
    <div class="invoice-box">
        <div class="header">
            <div class="title">
                <?php if(!empty($siteSettings['company_logo'])): ?>
                    <!-- Using public_path to ensure the file is accessible to dompdf -->
                    <img src="<?php echo e(public_path('storage/' . $siteSettings['company_logo'])); ?>" alt="<?php echo e($siteSettings['company_name'] ?? 'Company Logo'); ?>" style="height: 50px; width: auto;">
                <?php else: ?>
                    <?php echo e($siteSettings['company_name'] ?? 'MAISON'); ?>

                <?php endif; ?>
            </div>
            <div style="text-align: right;">
                <strong><?php echo e($siteSettings['company_name'] ?? 'MAISON'); ?></strong><br>
                <?php echo e($siteSettings['shop_address'] ?? 'Address not set'); ?><br>
                Invoice #MSN-<?php echo e(str_pad($order->id, 5, '0', STR_PAD_LEFT)); ?><br>
                Date: <?php echo e($order->created_at->format('d M, Y')); ?>

            </div>
        </div>

        <div style="margin-bottom: 30px;">
            <strong>Bill To:</strong><br>
            <?php echo e($order->user->name); ?><br>
            <?php echo e($order->user->email); ?><br>
            Shipping Address: <?php echo e($order->address); ?>

        </div>

        <table>
            <thead>
                <tr>
                    <th>Product</th>
                    <th>Price</th>
                    <th>Qty</th>
                    <th>Total</th>
                </tr>
            </thead>
            <tbody>
                <?php $__currentLoopData = $order->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e($item->product->name); ?></td>
                        <td>৳<?php echo e(number_format($item->price, 2)); ?></td>
                        <td><?php echo e($item->quantity); ?></td>
                        <td>৳<?php echo e(number_format($item->price * $item->quantity, 2)); ?></td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="3" style="text-align: right;"><strong>Grand Total:</strong></td>
                    <td class="total">৳<?php echo e(number_format($order->total_amount, 2)); ?></td>
                </tr>
            </tfoot>
        </table>
    </div>
</body>
</html>
<?php /**PATH D:\Laravel\ecom\resources\views\invoices\pdf.blade.php ENDPATH**/ ?>