fixed drag with arrows

This commit is contained in:
2025-12-03 14:23:14 +01:00
parent 329b3ffdeb
commit 86782d26b2
2 changed files with 76 additions and 27 deletions
@@ -652,7 +652,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
language: {
url: 'https://cdn.datatables.net/plug-ins/1.13.7/i18n/it-IT.json'
},
pageLength: 25
pageLength: 25,
order: [
[8, 'desc'], // prima Data Cliente
[7, 'desc'] // poi Data Zibo
]
});
@@ -845,6 +849,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
pull: true,
put: true
},
handle: ".drag-icon", // 👈 drag SOLO dallicona bi-list
forceFallback: true,
fallbackOnBody: true,
fallbackTolerance: 3,
@@ -858,6 +863,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
pull: true,
put: true
},
handle: ".drag-icon", // 👈 idem
forceFallback: true,
fallbackOnBody: true,
fallbackTolerance: 3,
@@ -866,6 +872,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
});
// disabilito sortable sulla tabella special (è sola lettura)
const specialTbody = document.querySelector("#tabSpecial tbody");
if (specialTbody) {
@@ -923,6 +931,41 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
}, "json");
}
// ==========================
// FRECCE SU / GIÙ TRA LE DUE TABELLE
// ==========================
// Da PROGRAMMATI → DA PROGRAMMARE
$(document).on("click", ".move-to-daprogrammare", function(e) {
e.preventDefault();
const $row = $(this).closest("tr");
// sposta la riga nel tbody dei "Da programmare"
$("#daProgrammareBlock").append($row);
// aggiorna lo status nel data-attribute (utile se lo usi altrove)
$row.attr("data-status", "1");
// ricalcola priorità + invia ad ajax_update_priority.php
updatePriority();
});
// Da DA PROGRAMMARE → PROGRAMMATI
$(document).on("click", ".move-to-programmati", function(e) {
e.preventDefault();
const $row = $(this).closest("tr");
// sposta la riga nel tbody dei "Programmati"
$("#programmatiBlock").append($row);
// aggiorna lo status
$row.attr("data-status", "6");
// ricalcola priorità + invia ad ajax_update_priority.php
updatePriority();
});
});