<!DOCTYPE html>
<html lang="hr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Generiranje računa — izvještaj</title>
    <style>
        body { font-family: Arial, sans-serif; font-size: 14px; color: #333; }
        .container { max-width: 700px; margin: 0 auto; padding: 20px; }
        .header { border-bottom: 2px solid #0066cc; padding-bottom: 10px; margin-bottom: 20px; }
        .footer { border-top: 1px solid #ddd; margin-top: 30px; padding-top: 15px; font-size: 12px; color: #777; }
        table { width: 100%; border-collapse: collapse; margin: 15px 0; }
        th { background: #0066cc; color: white; padding: 8px 10px; text-align: left; }
        td { padding: 7px 10px; border-bottom: 1px solid #eee; }
        tr:nth-child(even) td { background: #f9f9f9; }
        .success { color: green; }
        .error { color: red; }
        .summary { background: #f4f8ff; border-left: 4px solid #0066cc; padding: 10px 15px; margin: 15px 0; }
    </style>
</head>
<body>
<div class="container">
    <div class="header">
        <h2>Izvještaj generiranja računa</h2>
    </div>

    <div class="summary">
        <strong>Datum generiranja:</strong> <?php echo e(now()->format('d.m.Y H:i')); ?><br>
        <?php if(!empty($account)): ?>
        <strong>Račun:</strong> <?php echo e($account); ?><br>
        <?php endif; ?>
        <strong>Ukupno obrađenih ugovora:</strong> <?php echo e($total ?? 0); ?><br>
        <strong>Uspješno generiranih:</strong> <span class="success"><?php echo e($generated ?? 0); ?></span><br>
        <?php if(!empty($errors)): ?>
        <strong>Greške:</strong> <span class="error"><?php echo e(count($errors)); ?></span>
        <?php endif; ?>
    </div>

    <?php if(!empty($invoices) && count($invoices) > 0): ?>
    <h3>Generirani računi</h3>
    <table>
        <thead>
            <tr>
                <th>Klijent</th>
                <th>Ugovor</th>
                <th>Račun br.</th>
                <th>Iznos</th>
            </tr>
        </thead>
        <tbody>
            <?php $__currentLoopData = $invoices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $inv): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
                <td><?php echo e($inv['customer_name'] ?? '—'); ?></td>
                <td><?php echo e($inv['contract_no'] ?? '—'); ?></td>
                <td><?php echo e($inv['invoice_number'] ?? '—'); ?></td>
                <td><?php echo e(number_format($inv['amount'] ?? 0, 2, ',', '.')); ?> EUR</td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </tbody>
    </table>
    <?php endif; ?>

    <?php if(!empty($errors) && count($errors) > 0): ?>
    <h3 style="color:red;">Greške</h3>
    <table>
        <thead>
            <tr>
                <th>Ugovor</th>
                <th>Greška</th>
            </tr>
        </thead>
        <tbody>
            <?php $__currentLoopData = $errors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $err): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
                <td><?php echo e($err['contract_no'] ?? '—'); ?></td>
                <td><?php echo e($err['message'] ?? '—'); ?></td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </tbody>
    </table>
    <?php endif; ?>

    <div class="footer">
        <p>Ova poruka je automatski generirana od strane InOffice sustava.</p>
    </div>
</div>
</body>
</html>
<?php /**PATH /var/www/html/api/resources/views/emails/issuedInvoices.blade.php ENDPATH**/ ?>