certimine/views/profile_public.php
remaster a72656f9d4 CertiMine: aplicación PHP, API DC3 Peñasquito y documentación
- Portal bilingüe (Bootstrap), biblioteca FRM, consulta y perfiles con QR.
- Integración REST penasquito.wotbi.com (Token, búsqueda por passport y polling).
- Webhook de sincronización, esquema MariaDB y semillas FRM/NOM.
- Documentación en docs/ y extracto DatosPdf.txt; ejemplo de config sin secretos locales.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 17:56:36 -06:00

73 lines
2.9 KiB
PHP

<?php
declare(strict_types=1);
use CertiMine\I18n;
use CertiMine\Util;
/** @var array<string,mixed> $row */
/** @var list<array<string,mixed>> $certs */
/** @var list<array<string,mixed>> $auths */
/** @var bool $green */
/** @var string $qrUrl */
require __DIR__ . '/partials/header.php';
$isEs = I18n::lang() === 'es';
$ptype = (string) $row['person_type'];
$name = (string) $row['display_name'];
$statusLabel = static function (string $s): string {
return I18n::t('status_' . $s);
};
?>
<div class="d-flex flex-wrap justify-content-between align-items-center gap-2 mb-3">
<h1 class="h3 mb-0"><?= Util::h($name) ?></h1>
<?php if ($ptype === 'contractor'): ?>
<span class="badge <?= $green ? 'bg-success' : 'bg-warning text-dark' ?> fs-6">
<span class="material-symbols-outlined align-middle">eco</span>
<?= Util::h(I18n::t('profile_green')) ?>: <?= Util::h($green ? I18n::t('profile_green_yes') : I18n::t('profile_green_no')) ?>
</span>
<?php endif; ?>
</div>
<p class="text-muted mb-2">
<?= $ptype === 'contractor' ? Util::h(I18n::t('lookup_contractor')) : Util::h(I18n::t('lookup_employee')) ?>
· <?= Util::h((string) ($row['employee_number'] ?? '')) ?>
</p>
<div class="mb-4">
<label class="form-label small text-muted">QR / deep link</label>
<input class="form-control form-control-sm" readonly value="<?= Util::h($qrUrl) ?>">
</div>
<h2 class="h5"><?= Util::h(I18n::t('profile_certs')) ?></h2>
<div class="table-responsive card mb-4">
<table class="table mb-0">
<thead><tr><th><?= $isEs ? 'Título' : 'Title' ?></th><th>NOM</th><th><?= Util::h(I18n::t('expires')) ?></th><th><?= $isEs ? 'Estado' : 'Status' ?></th></tr></thead>
<tbody>
<?php foreach ($certs as $c): ?>
<tr>
<td><?= Util::h((string) $c['title']) ?></td>
<td><?= Util::h((string) ($c['nom_code'] ?? '—')) ?></td>
<td><?= Util::h((string) ($c['expires_at'] ?? '—')) ?></td>
<td><span class="badge text-bg-light border"><?= Util::h($statusLabel((string) $c['status'])) ?></span></td>
</tr>
<?php endforeach; ?>
<?php if ($certs === []): ?>
<tr><td colspan="4" class="text-muted"><?= Util::h(I18n::t('no_results')) ?></td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php if ($ptype === 'contractor' && $auths !== []): ?>
<h2 class="h5"><?= Util::h(I18n::t('profile_auths')) ?></h2>
<ul class="list-group mb-4">
<?php foreach ($auths as $a): ?>
<li class="list-group-item d-flex justify-content-between">
<span><?= Util::h((string) $a['code']) ?> — <?= Util::h($isEs ? (string) $a['name_es'] : (string) $a['name_en']) ?></span>
<small class="text-muted"><?= Util::h(I18n::t('expires')) ?>: <?= Util::h((string) ($a['valid_until'] ?? '—')) ?></small>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php require __DIR__ . '/partials/footer.php'; ?>