added foto matrice everywhere

This commit is contained in:
2025-12-03 12:21:26 +01:00
parent 5b7a8b57d5
commit 9447f3cf00
3 changed files with 92 additions and 15 deletions
+47 -4
View File
@@ -12,6 +12,7 @@ $sql = "
SELECT SELECT
p.*, p.*,
m.nome AS matrice, m.nome AS matrice,
m.photo AS matrice_photo,
l.name AS linea, l.name AS linea,
c.nome AS cliente, c.nome AS cliente,
s.nome AS status_nome, s.nome AS status_nome,
@@ -222,7 +223,20 @@ $rows_special = array_filter($rows, function ($r) {
data-seconds="<?= $sec ?>" data-seconds="<?= $sec ?>"
style="--rowcolor: <?= htmlspecialchars($r['line_color']) ?>;"> style="--rowcolor: <?= htmlspecialchars($r['line_color']) ?>;">
<td><?= htmlspecialchars($r['conferma_ordine'] ?? '') ?></td> <td><?= htmlspecialchars($r['conferma_ordine'] ?? '') ?></td>
<td><?= htmlspecialchars($r['matrice']) ?></td> <td>
<?= htmlspecialchars($r['matrice']) ?>
<?php if (!empty($r['matrice_photo'])): ?>
<br>
<img src="photos/matrici/<?= htmlspecialchars($r['matrice_photo']) ?>"
data-full="photos/matrici/<?= htmlspecialchars($r['matrice_photo']) ?>"
class="photo-thumb"
style="width:42px;height:42px;object-fit:cover;
border-radius:6px;border:1px solid #ced4da;
cursor:pointer;margin-top:3px;">
<?php endif; ?>
</td>
<?php <?php
$mescRaw = $r['mescole_list'] ?? ''; $mescRaw = $r['mescole_list'] ?? '';
$mescArray = $mescRaw !== '' ? explode(' | ', $mescRaw) : []; $mescArray = $mescRaw !== '' ? explode(' | ', $mescRaw) : [];
@@ -338,7 +352,20 @@ $rows_special = array_filter($rows, function ($r) {
data-status="<?= (int)$r['id_status'] ?>" data-status="<?= (int)$r['id_status'] ?>"
style="background-color: <?= htmlspecialchars($r['line_color']) ?>;"> style="background-color: <?= htmlspecialchars($r['line_color']) ?>;">
<td><?= htmlspecialchars($r['conferma_ordine'] ?? '') ?></td> <td><?= htmlspecialchars($r['conferma_ordine'] ?? '') ?></td>
<td><?= htmlspecialchars($r['matrice']) ?></td> <td>
<?= htmlspecialchars($r['matrice']) ?>
<?php if (!empty($r['matrice_photo'])): ?>
<br>
<img src="photos/matrici/<?= htmlspecialchars($r['matrice_photo']) ?>"
data-full="photos/matrici/<?= htmlspecialchars($r['matrice_photo']) ?>"
class="photo-thumb"
style="width:42px;height:42px;object-fit:cover;
border-radius:6px;border:1px solid #ced4da;
cursor:pointer;margin-top:3px;">
<?php endif; ?>
</td>
<?php <?php
$mescRaw = $r['mescole_list'] ?? ''; $mescRaw = $r['mescole_list'] ?? '';
$mescArray = $mescRaw !== '' ? explode(' | ', $mescRaw) : []; $mescArray = $mescRaw !== '' ? explode(' | ', $mescRaw) : [];
@@ -565,6 +592,19 @@ $rows_special = array_filter($rows, function ($r) {
$("#photoModal").css("display", "flex"); $("#photoModal").css("display", "flex");
}); });
// ❌ Chiudi modale foto (delegato)
$(document).on("click", "#photoModalCloseX, #photoCancel", function() {
$("#photoModal").hide();
});
// ❌ Chiudi cliccando sul backdrop (delegato)
$(document).on("click", "#photoModal", function(e) {
if (e.target.id === "photoModal") {
$("#photoModal").hide();
}
});
$("#photoModalCloseX, #photoCancel").on("click", function() { $("#photoModalCloseX, #photoCancel").on("click", function() {
$("#photoModal").hide(); $("#photoModal").hide();
}); });
@@ -610,16 +650,19 @@ $rows_special = array_filter($rows, function ($r) {
$("#imagePreviewModal").css("display", "flex"); $("#imagePreviewModal").css("display", "flex");
}); });
$("#previewCloseX").on("click", function() { // ❌ Chiudi preview con la X (delegato)
$(document).on("click", "#previewCloseX", function() {
$("#imagePreviewModal").hide(); $("#imagePreviewModal").hide();
}); });
$("#imagePreviewModal").on("click", function(e) { // ❌ Chiudi cliccando fuori (delegato)
$(document).on("click", "#imagePreviewModal", function(e) {
if (e.target.id === "imagePreviewModal") { if (e.target.id === "imagePreviewModal") {
$("#imagePreviewModal").hide(); $("#imagePreviewModal").hide();
} }
}); });
// ===== MODALE MESCOLE (Multi) ===== // ===== MODALE MESCOLE (Multi) =====
$(document).on("click", ".showMescole", function(e) { $(document).on("click", ".showMescole", function(e) {
e.preventDefault(); e.preventDefault();
@@ -385,6 +385,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
$sql = "SELECT $sql = "SELECT
p.*, p.*,
m.nome AS matrice, m.nome AS matrice,
m.photo AS matrice_photo,
GROUP_CONCAT(ms.nome SEPARATOR ', ') AS mescola, GROUP_CONCAT(ms.nome SEPARATOR ', ') AS mescola,
GROUP_CONCAT(ms.id SEPARATOR ',') AS mescole_ids, GROUP_CONCAT(ms.id SEPARATOR ',') AS mescole_ids,
l.name AS linea, l.name AS linea,
@@ -454,7 +455,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
<td><?= htmlspecialchars($r['conferma_ordine']) ?></td> <td><?= htmlspecialchars($r['conferma_ordine']) ?></td>
<td><?= htmlspecialchars($r['matrice']) ?></td> <td>
<?= htmlspecialchars($r['matrice']) ?>
<?php if (!empty($r['matrice_photo'])): ?>
<br>
<img src="photos/matrici/<?= htmlspecialchars($r['matrice_photo']) ?>"
data-full="photos/matrici/<?= htmlspecialchars($r['matrice_photo']) ?>"
class="photo-thumb"
style="width:42px;height:42px;object-fit:cover;
border-radius:6px;border:1px solid #ced4da;
cursor:pointer;margin-top:3px;">
<?php endif; ?>
</td>
<td><?= htmlspecialchars($r['mescola']) ?></td> <td><?= htmlspecialchars($r['mescola']) ?></td>
<td data-line-id="<?= $r['id_linea'] ?>"><?= htmlspecialchars($r['linea']) ?></td> <td data-line-id="<?= $r['id_linea'] ?>"><?= htmlspecialchars($r['linea']) ?></td>
<td><?= htmlspecialchars($r['cliente']) ?></td> <td><?= htmlspecialchars($r['cliente']) ?></td>
@@ -513,7 +527,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
<thead> <thead>
<tr> <tr>
<th style="width:30px;"></th> <th style="width:30px;"></th>
<th>Priority</th> <th>P.</th>
<th>Conf. Ord.</th> <th>Conf. Ord.</th>
<th>Matrice</th> <th>Matrice</th>
<th>Mescola</th> <th>Mescola</th>
@@ -1100,18 +1114,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
$("#imagePreviewModal").css("display", "flex"); $("#imagePreviewModal").css("display", "flex");
}); });
// Chiudi con X // Chiudi con X (delegato)
$("#previewCloseX").on("click", function() { $(document).on("click", "#previewCloseX", function() {
$("#imagePreviewModal").hide(); $("#imagePreviewModal").hide();
}); });
// Chiudi cliccando fuori // Chiudi cliccando fuori (delegato)
$("#imagePreviewModal").on("click", function(e) { $(document).on("click", "#imagePreviewModal", function(e) {
if (e.target.id === "imagePreviewModal") { if (e.target.id === "imagePreviewModal") {
$("#imagePreviewModal").hide(); $("#imagePreviewModal").hide();
} }
}); });
$(document).on("click", ".view-mescole-btn", function() { $(document).on("click", ".view-mescole-btn", function() {
let names = $(this).data("names"); let names = $(this).data("names");
+24 -5
View File
@@ -23,13 +23,32 @@
</td> </td>
<td> <td>
<span class='view'><?= $r['matrice'] ?></span> <?php $matricePhoto = $r['matrice_photo'] ?? null; ?>
<select class='inline-edit form-select form-select-sm select2'
name='idmatrice'> <div class="d-flex align-items-center">
<?= selectOptions($matrici, $r['idmatrice']) ?> <div class="flex-grow-1">
</select> <span class='view'><?= htmlspecialchars($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>
<td> <td>
<?php <?php