diff --git a/db/migrations/20260716093425_add_variazioni_and_attiva_alert_to_scad_deadlines.php b/db/migrations/20260716093425_add_variazioni_and_attiva_alert_to_scad_deadlines.php
new file mode 100644
index 0000000..b921e1a
--- /dev/null
+++ b/db/migrations/20260716093425_add_variazioni_and_attiva_alert_to_scad_deadlines.php
@@ -0,0 +1,24 @@
+table('scad_deadlines')
+ ->addColumn('variazioni', 'text', [
+ 'null' => true,
+ 'default' => null,
+ 'after' => 'notes'
+ ])
+ ->addColumn('attiva_alert', 'boolean', [
+ 'null' => false,
+ 'default' => false,
+ 'after' => 'variazioni'
+ ])
+ ->update();
+ }
+}
diff --git a/public/userarea/ajax/employee_profile/destroy_ppe.php b/public/userarea/ajax/employee_profile/destroy_ppe.php
new file mode 100644
index 0000000..9ac849f
--- /dev/null
+++ b/public/userarea/ajax/employee_profile/destroy_ppe.php
@@ -0,0 +1,44 @@
+getConnection();
+
+ $id = (int)($_POST['id'] ?? 0);
+
+ if ($id <= 0) {
+ echo json_encode([
+ 'success' => false,
+ 'message' => 'ID DPI non valido.'
+ ]);
+ exit;
+ }
+
+ $stmt = $pdo->prepare("
+ DELETE FROM employee_ppe_items
+ WHERE id = ?
+ ");
+ $stmt->execute([$id]);
+
+ if ($stmt->rowCount() === 0) {
+ echo json_encode([
+ 'success' => false,
+ 'message' => 'Record non trovato o già eliminato.'
+ ]);
+ exit;
+ }
+
+ echo json_encode([
+ 'success' => true,
+ 'message' => 'Record DPI eliminato definitivamente.'
+ ]);
+ exit;
+} catch (Throwable $e) {
+ echo json_encode([
+ 'success' => false,
+ 'message' => $e->getMessage()
+ ]);
+ exit;
+}
diff --git a/public/userarea/employee-profile.php b/public/userarea/employee-profile.php
index f980a43..2c7abe0 100644
--- a/public/userarea/employee-profile.php
+++ b/public/userarea/employee-profile.php
@@ -1448,10 +1448,13 @@ function fmtFileSize(?int $bytes): string
data-notes="= htmlspecialchars($p['notes'] ?? '', ENT_QUOTES) ?>">✏️
-
+ data-name="= htmlspecialchars($p['ppe_name'], ENT_QUOTES) ?>">Ritira
+
@@ -1518,10 +1521,13 @@ function fmtFileSize(?int $bytes): string
data-notes="= htmlspecialchars($p['notes'] ?? '', ENT_QUOTES) ?>">✏️ Modifica
-
+ data-name="= htmlspecialchars($p['ppe_name'], ENT_QUOTES) ?>">Ritira
+
@@ -3002,19 +3008,19 @@ function fmtFileSize(?int $bytes): string
});
});
- // ---- PPE: remove / mark as returned ----
- $(document).on("click", ".delete-ppe", function() {
+ // ---- PPE: withdraw / mark as returned ----
+ $(document).on("click", ".withdraw-ppe", function() {
const id = $(this).data("id");
const name = $(this).data("name");
Swal.fire({
- title: "Confermi la rimozione?",
- text: name ? ("DPI: " + name) : "Il DPI verrà segnato come restituito.",
+ title: "Confermi il ritiro?",
+ text: name ? ("Il DPI \"" + name + "\" verrà ritirato dal dipendente.") : "Il DPI verrà ritirato dal dipendente.",
icon: "warning",
showCancelButton: true,
- confirmButtonColor: "#d33",
+ confirmButtonColor: "#e8930c",
cancelButtonColor: "#6c757d",
- confirmButtonText: "Sì, rimuovi",
+ confirmButtonText: "Sì, ritira",
cancelButtonText: "Annulla"
}).then((result) => {
if (!result.isConfirmed) return;
@@ -3034,7 +3040,7 @@ function fmtFileSize(?int $bytes): string
if (data.success) {
Swal.fire({
icon: "success",
- title: "Rimosso!",
+ title: "Ritirato!",
confirmButtonColor: "#3085d6"
})
.then(() => location.reload());
@@ -3042,7 +3048,62 @@ function fmtFileSize(?int $bytes): string
Swal.fire({
icon: "error",
title: "Errore",
- text: data.message || "Impossibile rimuovere."
+ text: data.message || "Impossibile ritirare."
+ });
+ }
+ })
+ .catch(err => {
+ Swal.fire({
+ icon: "error",
+ title: "Errore",
+ text: "Errore di comunicazione."
+ });
+ console.error(err);
+ });
+ });
+ });
+
+ // ---- PPE: destroy record (hard delete) ----
+ $(document).on("click", ".destroy-ppe", function() {
+ const id = $(this).data("id");
+ const name = $(this).data("name");
+
+ Swal.fire({
+ title: "Eliminare definitivamente il record?",
+ html: (name ? ("DPI: " + name + "
") : "") + "Questa azione elimina il record e non può essere annullata. Usala solo in caso di inserimento errato.",
+ icon: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#d33",
+ cancelButtonColor: "#6c757d",
+ confirmButtonText: "Sì, elimina",
+ cancelButtonText: "Annulla"
+ }).then((result) => {
+ if (!result.isConfirmed) return;
+
+ const p = new URLSearchParams();
+ p.append('id', id);
+
+ fetch("ajax/employee_profile/destroy_ppe.php", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded"
+ },
+ body: p.toString()
+ })
+ .then(r => r.json())
+ .then(data => {
+ if (data.success) {
+ Swal.fire({
+ icon: "success",
+ title: "Eliminato!",
+ confirmButtonColor: "#3085d6"
+ })
+ .then(() => location.reload());
+ } else {
+ Swal.fire({
+ icon: "error",
+ title: "Errore",
+ text: data.message || "Impossibile eliminare."
});
}
})
diff --git a/public/userarea/ppe-items.php b/public/userarea/ppe-items.php
index 37f61f2..ec13402 100644
--- a/public/userarea/ppe-items.php
+++ b/public/userarea/ppe-items.php
@@ -563,6 +563,15 @@ $totalCategories = count($categories);
.ppe-name {
font-weight: 800;
color: #0f172a;
+ white-space: normal;
+ word-break: break-word;
+ }
+
+ .btn-desc-popup {
+ border-radius: 8px;
+ font-weight: 700;
+ font-size: 0.78rem;
+ padding: 2px 8px;
}
.ppe-description {
@@ -819,8 +828,13 @@ $totalCategories = count($categories);
-