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

<section class="certificate-page">
    <div class="certificate-document">
        <div class="certificate-border">
            <p class="eyebrow">Certificado de conclusao</p>
            <h1><?= e($certificate['student_name']) ?></h1>
            <p>concluiu com sucesso o curso</p>
            <h2><?= e($certificate['course_title']) ?></h2>
            <p>Emitido por <strong><?= e($certificate['issuer_name']) ?></strong> em <?= e(format_date($certificate['issued_at'])) ?>.</p>

            <div class="certificate-meta">
                <div><span>Carga horaria</span><strong><?= e((string) $certificate['workload_hours']) ?> horas</strong></div>
                <div><span>Conclusao</span><strong><?= e((string) $certificate['completion_percentage']) ?>%</strong></div>
                <div><span>Numero</span><strong><?= e($certificate['certificate_number']) ?></strong></div>
            </div>

            <div class="validation-box">
                <div class="qr-placeholder"><?= e(substr($certificate['validation_code'], -4)) ?></div>
                <div>
                    <span>Codigo de validacao</span>
                    <strong><?= e($certificate['validation_code']) ?></strong>
                    <small><?= e($validationUrl) ?></small>
                </div>
            </div>
        </div>
    </div>

    <div class="actions">
        <a class="button" href="/certificates/pdf?id=<?= e((string) $certificate['id']) ?>">Baixar PDF</a>
        <a class="ghost-button" href="/certificates/validate?code=<?= e(urlencode($certificate['validation_code'])) ?>">Validar publicamente</a>
        <a class="ghost-button" href="/certificates">Meus certificados</a>
    </div>
</section>

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