diff --git a/public/userarea/scadenzario/detail.php b/public/userarea/scadenzario/detail.php index 8bb6b0c..c6bda13 100644 --- a/public/userarea/scadenzario/detail.php +++ b/public/userarea/scadenzario/detail.php @@ -51,32 +51,46 @@ if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { $approachDate = date('Y-m-d', strtotime($today . ' + ' . (int)$deadline['notification_days'] . ' days')); $isApproaching = !$isCompleted && !$isOverdue && $deadline['due_date'] <= $approachDate; - if ($isCompleted) { $statusLabel = 'Completata'; $statusClass = 'badge-completata'; } - elseif ($isOverdue) { $statusLabel = 'Scaduta'; $statusClass = 'badge-scaduta'; } - elseif ($isApproaching) { $statusLabel = 'In scadenza'; $statusClass = 'badge-in-scadenza'; } - else { $statusLabel = 'Attiva'; $statusClass = 'badge-attiva'; } + if ($isCompleted) { + $statusLabel = 'Completata'; + $statusClass = 'badge-completata'; + } elseif ($isOverdue) { + $statusLabel = 'Scaduta'; + $statusClass = 'badge-scaduta'; + } elseif ($isApproaching) { + $statusLabel = 'In scadenza'; + $statusClass = 'badge-in-scadenza'; + } else { + $statusLabel = 'Attiva'; + $statusClass = 'badge-attiva'; + } - $recurrenceLabels = ['once'=>'Una tantum','monthly'=>'Mensile','quarterly'=>'Trimestrale','semiannual'=>'Semestrale','annual'=>'Annuale','biennial'=>'Biennale','triennial'=>'Triennale','quadriennial'=>'Quadriennale','quinquennial'=>'Quinquennale','decennial'=>'Decennale','quindecennial'=>'Quindicennale']; - $actionLabels = ['created'=>'Creata','updated'=>'Modificata','completed'=>'Completata','attachment_added'=>'Allegato aggiunto','attachment_removed'=>'Allegato rimosso','notification_sent'=>'Notifica inviata']; - $actionColors = ['created'=>'#198754','updated'=>'#5a8fd8','completed'=>'#6f42c1','attachment_added'=>'#e8930c','attachment_removed'=>'#e8930c','notification_sent'=>'#adb5bd']; - $actionIcons = ['created'=>'fa-plus','updated'=>'fa-pen','completed'=>'fa-check','attachment_added'=>'fa-paperclip','attachment_removed'=>'fa-trash','notification_sent'=>'fa-bell']; + $recurrenceLabels = ['once' => 'Una tantum', 'monthly' => 'Mensile', 'quarterly' => 'Trimestrale', 'semiannual' => 'Semestrale', 'annual' => 'Annuale', 'biennial' => 'Biennale', 'triennial' => 'Triennale', 'quadriennial' => 'Quadriennale', 'quinquennial' => 'Quinquennale', 'decennial' => 'Decennale', 'quindecennial' => 'Quindicennale']; + $actionLabels = ['created' => 'Creata', 'updated' => 'Modificata', 'completed' => 'Completata', 'attachment_added' => 'Allegato aggiunto', 'attachment_removed' => 'Allegato rimosso', 'notification_sent' => 'Notifica inviata']; + $actionColors = ['created' => '#198754', 'updated' => '#5a8fd8', 'completed' => '#6f42c1', 'attachment_added' => '#e8930c', 'attachment_removed' => '#e8930c', 'notification_sent' => '#adb5bd']; + $actionIcons = ['created' => 'fa-plus', 'updated' => 'fa-pen', 'completed' => 'fa-check', 'attachment_added' => 'fa-paperclip', 'attachment_removed' => 'fa-trash', 'notification_sent' => 'fa-bell']; } } ?> + <?= $deadline ? htmlspecialchars($deadline['topic'], ENT_QUOTES, 'UTF-8') . ' — ' : '' ?>Scadenzario - + +
@@ -247,12 +551,12 @@ if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { Torna alla lista - - + +
-
Data documento
-
+
Data documento
+
Data ultimo controllo
@@ -319,116 +630,123 @@ if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
giorni
-
Luogo archiviazione
-
+
Luogo archiviazione
+
-
Note
-
+
Note
+
-
- -
Reparti responsabili
-
- - - -
- +
+ +
Reparti responsabili
+
+ + + +
+ - -
Singoli responsabili
-
- - - - - - () - - - -
- + +
Singoli responsabili
+
+ + + + + + () + + + +
+ -
-
-
Allegati ()
-
-
- = 1024 ? round($sizeKB / 1024, 1) . ' MB' : $sizeKB . ' KB'; - ?> -
-
-
- -
·
-
+
+
+
Allegati ()
+
+
+ = 1024 ? round($sizeKB / 1024, 1) . ' MB' : $sizeKB . ' KB'; + ?> +
+
+
+ +
·
+
+
+
-
-
-
-
-
Cronologia
-
-
-
- -
-
-
- - da - -
- -
- - -
- $vals): ?> -
- : - - → - +
+
+
Cronologia
+
+
+
+ +
+
+
+ + da + +
+ +
+ + +
+ $vals): ?> +
+ : + + → + +
+ +
+
- -
- +
-
-
@@ -439,38 +757,51 @@ if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
- + - + + \ No newline at end of file diff --git a/public/userarea/scadenzario/index.php b/public/userarea/scadenzario/index.php index f4a0775..b092a9d 100644 --- a/public/userarea/scadenzario/index.php +++ b/public/userarea/scadenzario/index.php @@ -10,7 +10,9 @@ if ($filterSubjectId) { $s = $pdo->prepare("SELECT name FROM scad_subjects WHERE id = ?"); $s->execute([$filterSubjectId]); $filterSubjectName = $s->fetchColumn() ?: null; - if (!$filterSubjectName) { $filterSubjectId = null; } + if (!$filterSubjectName) { + $filterSubjectId = null; + } } // Optional filter: limit to deadlines assigned to the current user (directly OR via department) @@ -20,7 +22,9 @@ if ($filterMy) { $st = $pdo->prepare("SELECT id, department FROM employees WHERE auth_user_id = ? LIMIT 1"); $st->execute([(int)$iduserlogin]); $filterMyEmployee = $st->fetch(PDO::FETCH_ASSOC) ?: null; - if (!$filterMyEmployee) { $filterMy = false; } + if (!$filterMyEmployee) { + $filterMy = false; + } } $sql = " @@ -44,7 +48,7 @@ if ($filterSubjectId) { } if ($filterMy && $filterMyEmployee) { $where[] = "(d.id IN (SELECT deadline_id FROM scad_deadline_employee WHERE employee_id = ?)" - . " OR (? <> '' AND FIND_IN_SET(?, REPLACE(d.departments, ', ', ',')) > 0))"; + . " OR (? <> '' AND FIND_IN_SET(?, REPLACE(d.departments, ', ', ',')) > 0))"; $params[] = (int)$filterMyEmployee['id']; $params[] = (string)($filterMyEmployee['department'] ?? ''); $params[] = (string)($filterMyEmployee['department'] ?? ''); @@ -65,16 +69,46 @@ $departments = $pdo->query("SELECT DISTINCT department FROM employees WHERE depa $subjects = $pdo->query("SELECT id, name, color FROM scad_subjects ORDER BY name")->fetchAll(PDO::FETCH_ASSOC); $today = date('Y-m-d'); + +function getContrastTextColor($hexColor) +{ + $hexColor = trim($hexColor); + + if ($hexColor === '') { + return '#ffffff'; + } + + $hexColor = ltrim($hexColor, '#'); + + if (strlen($hexColor) === 3) { + $hexColor = $hexColor[0] . $hexColor[0] . + $hexColor[1] . $hexColor[1] . + $hexColor[2] . $hexColor[2]; + } + + if (strlen($hexColor) !== 6) { + return '#ffffff'; + } + + $r = hexdec(substr($hexColor, 0, 2)); + $g = hexdec(substr($hexColor, 2, 2)); + $b = hexdec(substr($hexColor, 4, 2)); + + $brightness = (($r * 299) + ($g * 587) + ($b * 114)) / 1000; + + return ($brightness > 150) ? '#000000' : '#ffffff'; +} ?> + @@ -84,7 +118,11 @@ $today = date('Y-m-d'); Scadenzario - Lista Scadenze - + +
@@ -335,30 +605,30 @@ $today = date('Y-m-d'); -
-
- - Storico per argomento: - - (tutte le scadenze — aperte e chiuse) +
+
+ + Storico per argomento: + + (tutte le scadenze — aperte e chiuse) +
+ + Rimuovi filtro +
- - Rimuovi filtro - -
-
-
- - Le mie scadenze - (assegnate a me o al reparto ) +
+
+ + Le mie scadenze + (assegnate a me o al reparto ) +
+ + Tutte le scadenze +
- - Tutte le scadenze - -
@@ -391,11 +661,11 @@ $today = date('Y-m-d');