fixed view and multi

This commit is contained in:
2025-12-03 09:55:42 +01:00
parent dd9d109dee
commit 77e5820dcc
8 changed files with 201 additions and 60 deletions
+52 -1
View File
@@ -167,7 +167,7 @@ $rows_special = array_filter($rows, function ($r) {
</head>
<body>
<div class="wrapper">
<div class="wrapper toggled">
<?php include('include/navbar.php'); ?>
<?php include('include/topbar.php'); ?>
@@ -191,6 +191,7 @@ $rows_special = array_filter($rows, function ($r) {
<table id="tabSpecialManager" class="table table-hover align-middle mb-0">
<thead>
<tr>
<th>Conf. Ord.</th>
<th>Matrice</th>
<th>Mescola</th>
<th>Linea</th>
@@ -220,6 +221,7 @@ $rows_special = array_filter($rows, function ($r) {
data-id="<?= (int)$r['id'] ?>"
data-seconds="<?= $sec ?>"
style="--rowcolor: <?= htmlspecialchars($r['line_color']) ?>;">
<td><?= htmlspecialchars($r['conferma_ordine'] ?? '') ?></td>
<td><?= htmlspecialchars($r['matrice']) ?></td>
<?php
$mescRaw = $r['mescole_list'] ?? '';
@@ -306,6 +308,7 @@ $rows_special = array_filter($rows, function ($r) {
<table id="tabManager" class="table table-hover align-middle" style="width:100%">
<thead>
<tr>
<th>Conf. Ord.</th>
<th>Matrice</th>
<th>Mescola</th>
<th>Linea</th>
@@ -334,6 +337,7 @@ $rows_special = array_filter($rows, function ($r) {
<tr data-id="<?= (int)$r['id'] ?>"
data-status="<?= (int)$r['id_status'] ?>"
style="background-color: <?= htmlspecialchars($r['line_color']) ?>;">
<td><?= htmlspecialchars($r['conferma_ordine'] ?? '') ?></td>
<td><?= htmlspecialchars($r['matrice']) ?></td>
<?php
$mescRaw = $r['mescole_list'] ?? '';
@@ -615,7 +619,54 @@ $rows_special = array_filter($rows, function ($r) {
$("#imagePreviewModal").hide();
}
});
// ===== MODALE MESCOLE (Multi) =====
$(document).on("click", ".showMescole", function(e) {
e.preventDefault();
e.stopPropagation();
// prendo la stringa grezza dallattributo, NON .data()
const raw = $(this).attr("data-list") || "[]";
let list = [];
try {
list = JSON.parse(raw);
} catch (err) {
console.error("Errore parsing mescole:", err, raw);
list = [];
}
let html = "";
list.forEach(m => {
html += `<li style="margin:4px 0;">${m}</li>`;
});
$("#mescoleList").html(html || '<li style="margin:4px 0;">Nessuna mescola</li>');
const modalEl = document.getElementById('mescoleModal');
const modal = bootstrap.Modal.getOrCreateInstance(modalEl);
modal.show();
});
</script>
<!-- MODALE MESCOLE -->
<div class="modal fade" id="mescoleModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Mescole utilizzate</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Chiudi"></button>
</div>
<div class="modal-body">
<ul id="mescoleList" style="padding-left:1rem;"></ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Chiudi</button>
</div>
</div>
</div>
</div>
</body>
</html>