fixed drag with arrows
This commit is contained in:
parent
329b3ffdeb
commit
86782d26b2
@ -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 dall’icona 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();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
@ -1,7 +1,32 @@
|
||||
<td class="drag-handle text-center" style="cursor:grab;">
|
||||
<i class="bi bi-list" style="font-size:1.2rem;"></i>
|
||||
<td class="text-center align-middle">
|
||||
<div class="d-flex justify-content-center align-items-center gap-1">
|
||||
|
||||
<!-- Maniglia drag & drop -->
|
||||
<span class="drag-handle" style="cursor:grab;">
|
||||
<i class="bi bi-list drag-icon" style="font-size:1.2rem;"></i>
|
||||
</span>
|
||||
|
||||
<!-- Freccia sposta tra le due tabelle -->
|
||||
<?php if (!empty($is_da_programmare) && $is_da_programmare): ?>
|
||||
<!-- Siamo nella tabella PROGRAMMATI (status 6) → manda giù -->
|
||||
<button type="button"
|
||||
class="btn btn-link p-0 move-to-daprogrammare"
|
||||
title="Sposta in 'Da programmare'">
|
||||
<i class="bi bi-arrow-down-circle"></i>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<!-- Siamo nella tabella DA PROGRAMMARE (status 1) → manda su -->
|
||||
<button type="button"
|
||||
class="btn btn-link p-0 move-to-programmati"
|
||||
title="Sposta in 'Programmati'">
|
||||
<i class="bi bi-arrow-up-circle"></i>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
<?php if ($r['id_status'] == 6): ?>
|
||||
<td>
|
||||
<span class='view'><?= $r['priority'] ?></span>
|
||||
@ -23,32 +48,13 @@
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php $matricePhoto = $r['matrice_photo'] ?? null; ?>
|
||||
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="flex-grow-1">
|
||||
<span class='view'><?= htmlspecialchars($r['matrice']) ?></span>
|
||||
|
||||
<span class='view'><?= $r['matrice'] ?></span>
|
||||
<select class='inline-edit form-select form-select-sm select2'
|
||||
name='idmatrice'>
|
||||
<?= selectOptions($matrici, $r['idmatrice']) ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($matricePhoto)): ?>
|
||||
<div class="view ms-2">
|
||||
<img src="photos/matrici/<?= htmlspecialchars($matricePhoto) ?>"
|
||||
data-full="photos/matrici/<?= htmlspecialchars($matricePhoto) ?>"
|
||||
class="photo-thumb"
|
||||
style="width:42px;height:42px;object-fit:cover;
|
||||
border-radius:6px;border:1px solid #ced4da;
|
||||
cursor:pointer;">
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user