<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Devis <?php echo e($quote->number); ?></title>
    <style>
        body {
            font-family: Arial, sans-serif;
            font-size: 12px;
            line-height: 1.4;
            color: #333;
        }
        .header {
            border-bottom: 2px solid #007bff;
            padding-bottom: 20px;
            margin-bottom: 30px;
        }
        .company-info {
            float: left;
            width: 50%;
        }
        .quote-info {
            float: right;
            width: 45%;
            text-align: right;
        }
        .client-info {
            margin: 30px 0;
            clear: both;
        }
        .table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
        }
        .table th, .table td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        .table th {
            background-color: #f8f9fa;
            font-weight: bold;
        }
        .text-right {
            text-align: right;
        }
        .text-center {
            text-align: center;
        }
        .total {
            float: right;
            width: 300px;
            margin-top: 20px;
        }
        .total-row {
            display: flex;
            justify-content: space-between;
            padding: 5px 0;
        }
        .total-row.final {
            border-top: 2px solid #333;
            font-weight: bold;
            font-size: 14px;
        }
        .footer {
            margin-top: 50px;
            padding-top: 20px;
            border-top: 1px solid #ddd;
            clear: both;
            font-size: 11px;
            color: #666;
        }
        .footer-fixed {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 60px;
            background: white;
            border-top: 1px solid #ddd;
            padding: 10px 20px;
            font-size: 10px;
            color: #666;
            z-index: 1000;
        }
        @page {
            margin-bottom: 80px;
        }
        body {
            margin-bottom: 80px;
        }
        .clearfix::after {
            content: "";
            display: table;
            clear: both;
        }
    </style>
</head>
<body>
    <div class="header clearfix">
        <div class="company-info">
            <p>
                <strong><?php echo e($company ? $company->name : 'Mon Entreprise'); ?></strong><br>
                <?php if($company && $company->address): ?><?php echo e($company->address); ?><?php else: ?> Ville <?php endif; ?><br>
                <?php if($company && $company->phone): ?><?php echo e($company->phone); ?><?php else: ?> Téléphone <?php endif; ?><br>
                <strong>Devis N°:</strong> <?php echo e($quote->number); ?><br>
                <strong>Date devis:</strong> <?php echo e($quote->date->format('d/m/Y')); ?>

            </p>
        </div>
        <div class="quote-info">
            <p>
                <strong>Devis pour:</strong><br>
                <strong><?php echo e($quote->client->name); ?></strong><br>
                <?php echo e($quote->client->address); ?><br>
                <?php if($quote->client->ice): ?>ICE: <?php echo e($quote->client->ice); ?><br><?php endif; ?>
                <?php if($quote->client->phone): ?>Tél: <?php echo e($quote->client->phone); ?><br><?php endif; ?>
                <?php if($quote->client->email): ?>Email: <?php echo e($quote->client->email); ?><?php endif; ?>
            </p>
        </div>
    </div>

    <table class="table">
        <thead>
            <tr>
                <th>Produit/Service</th>
                <th>Description</th>
                <th class="text-center">Qté</th>
                <th class="text-right">Prix unitaire</th>
                <th class="text-center">TVA</th>
                <th class="text-right">Total HT</th>
                <th class="text-right">Total TTC</th>
            </tr>
        </thead>
        <tbody>
            <?php $__currentLoopData = $quote->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($item->description); ?></td>
                <td class="text-center"><?php echo e($item->quantity); ?> <?php echo e($item->unit); ?></td>
                <td class="text-right"><?php echo e(number_format($item->unit_price, 2)); ?> MAD</td>
                <td class="text-center"><?php echo e($item->vat_rate); ?>%</td>
                <td class="text-right"><?php echo e(number_format($item->total_ht, 2)); ?> MAD</td>
                <td class="text-right"><?php echo e(number_format($item->total_ttc, 2)); ?> MAD</td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </tbody>
    </table>

    <div class="total">
        <div class="total-row">
            <span>Sous-total HT:</span>
            <span><?php echo e(number_format($quote->subtotal_ht, 2)); ?> MAD</span>
        </div>
        <div class="total-row">
            <span>TVA:</span>
            <span><?php echo e(number_format($quote->total_vat, 2)); ?> MAD</span>
        </div>
        <div class="total-row final">
            <span>Total TTC:</span>
            <span><?php echo e(number_format($quote->total_ttc, 2)); ?> MAD</span>
        </div>
    </div>

    <div class="amount-in-words" style="margin-top: 20px; clear: both; border: 1px solid #ddd; padding: 10px; background-color: #f9f9f9;">
        <strong>ARRÊTÉ LE PRÉSENT DEVIS À LA SOMME DE :</strong><br>
        <strong><?php echo e(\App\Helpers\NumberToWords::convert($quote->total_ttc)); ?></strong>
    </div>

    <?php if($quote->notes || $quote->terms): ?>
    <div class="notes" style="margin-top: 40px; clear: both;">
        <?php if($quote->notes): ?>
        <h4>Notes:</h4>
        <p><?php echo e($quote->notes); ?></p>
        <?php endif; ?>
        
        <?php if($quote->terms): ?>
        <h4>Conditions:</h4>
        <p><?php echo e($quote->terms); ?></p>
        <?php endif; ?>
    </div>
    <?php endif; ?>

    <?php if($company && $company->footer_template): ?>
    <div class="footer-fixed">
        <?php echo nl2br(e($company->footer_template)); ?>

    </div>
    <?php endif; ?>
</body>
</html><?php /**PATH /Users/macbook/Documents/gstock/backend/resources/views/quotes/pdf.blade.php ENDPATH**/ ?>