<?php include app()->basePath('app/Views/partials/header.php'); ?>

<section class="panel">
    <p class="eyebrow">Aluno</p>
    <h1>Meus certificados</h1>
    <p>Consulte os certificados emitidos e use o codigo publico para validacao.</p>

    <div class="table-wrap">
        <table>
            <thead>
                <tr>
                    <th>Numero</th>
                    <th>Curso</th>
                    <th>Emitido por</th>
                    <th>Data</th>
                    <th>Accoes</th>
                </tr>
            </thead>
            <tbody>
                <?php if (!$certificates): ?>
                    <tr><td colspan="5">Ainda nao tem certificados emitidos.</td></tr>
                <?php endif; ?>
                <?php foreach ($certificates as $certificate): ?>
                    <tr>
                        <td>
                            <strong><?= e($certificate['certificate_number']) ?></strong>
                            <span class="muted"><?= e($certificate['validation_code']) ?></span>
                        </td>
                        <td><?= e($certificate['course_title']) ?></td>
                        <td><?= e($certificate['issuer_name']) ?></td>
                        <td><?= e(format_date($certificate['issued_at'])) ?></td>
                        <td>
                            <div class="row-actions">
                                <a class="mini-button" href="/certificates/show?id=<?= e((string) $certificate['id']) ?>">Ver</a>
                                <a class="mini-button" href="/certificates/pdf?id=<?= e((string) $certificate['id']) ?>">PDF</a>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</section>

<?php include app()->basePath('app/Views/partials/footer.php'); ?>
