diff --git a/public/userarea/employee-profile.php b/public/userarea/employee-profile.php index a00ef9f..3727328 100644 --- a/public/userarea/employee-profile.php +++ b/public/userarea/employee-profile.php @@ -169,33 +169,47 @@ $rolesList = $isHrManager /* ========================================== HELPERS ========================================== */ -function statusBadge(string $status): array { +function statusBadge(string $status): array +{ switch ($status) { - case 'active': return ['label' => 'Attivo', 'class' => 'success']; - case 'inactive': return ['label' => 'Cessato', 'class' => 'secondary']; - case 'suspended': return ['label' => 'Sospeso', 'class' => 'warning']; - default: return ['label' => htmlspecialchars($status), 'class' => 'secondary']; + case 'active': + return ['label' => 'Attivo', 'class' => 'success']; + case 'inactive': + return ['label' => 'Cessato', 'class' => 'secondary']; + case 'suspended': + return ['label' => 'Sospeso', 'class' => 'warning']; + default: + return ['label' => htmlspecialchars($status), 'class' => 'secondary']; } } -function fmtDate(?string $d): string { +function fmtDate(?string $d): string +{ if (!$d || $d === '0000-00-00') return '—'; $ts = strtotime($d); return $ts ? date('d/m/Y', $ts) : '—'; } -function valOrDash($v): string { +function valOrDash($v): string +{ $v = (string)($v ?? ''); return $v !== '' ? htmlspecialchars($v) : '—'; } -function categoryLabel(string $c): string { +function categoryLabel(string $c): string +{ switch ($c) { - case 'job_description': return 'Mansionario'; - case 'contract': return 'Contratto'; - case 'rules': return 'Regolamento'; - case 'other': return 'Altro'; - default: return htmlspecialchars($c); + case 'job_description': + return 'Mansionario'; + case 'contract': + return 'Contratto'; + case 'rules': + return 'Regolamento'; + case 'other': + return 'Altro'; + default: + return htmlspecialchars($c); } } -function trainingStatus(?string $nextDue, ?int $reminderDays, ?int $topicDefaultRem): array { +function trainingStatus(?string $nextDue, ?int $reminderDays, ?int $topicDefaultRem): array +{ if (!$nextDue) { return ['code' => 'compliant', 'label' => 'Conforme', 'class' => 'success']; } @@ -208,7 +222,8 @@ function trainingStatus(?string $nextDue, ?int $reminderDays, ?int $topicDefault if ($daysLeft <= $rem) return ['code' => 'due_soon', 'label' => 'Da aggiornare', 'class' => 'warning']; return ['code' => 'compliant', 'label' => 'Conforme', 'class' => 'success']; } -function fmtFileSize(?int $bytes): string { +function fmtFileSize(?int $bytes): string +{ if ($bytes === null || $bytes <= 0) return '—'; if ($bytes < 1024) return $bytes . ' B'; if ($bytes < 1024 * 1024) return number_format($bytes / 1024, 1) . ' KB'; @@ -224,25 +239,55 @@ function fmtFileSize(?int $bytes): string { +
| Categoria | @@ -654,7 +923,7 @@ function fmtFileSize(?int $bytes): string {= categoryLabel((string)$d['category']) ?> | + class="fw-semibold text-decoration-none"> = htmlspecialchars($d['original_name']) ?> @@ -666,11 +935,11 @@ function fmtFileSize(?int $bytes): string { | = fmtDate(substr((string)$d['created_at'], 0, 10)) ?> |
⬇️ Scarica
+ href="ajax/employee_profile/download_document.php?id== $did ?>">⬇️ Scarica
@@ -696,7 +965,7 @@ function fmtFileSize(?int $bytes): string {
= fmtDate(substr((string)$d['created_at'], 0, 10)) ?>
+ class="doc-card-title">
= htmlspecialchars($d['original_name']) ?>
@@ -708,11 +977,11 @@ function fmtFileSize(?int $bytes): string {
⬇️ Scarica
+ href="ajax/employee_profile/download_document.php?id== $did ?>">⬇️ Scarica
@@ -865,7 +1134,7 @@ function fmtFileSize(?int $bytes): string {
-
|
|---|