added foto matrice everywhere

This commit is contained in:
Claudio 2025-12-03 12:21:26 +01:00
parent 5b7a8b57d5
commit 9447f3cf00
3 changed files with 92 additions and 15 deletions

View File

@ -12,6 +12,7 @@ $sql = "
SELECT
p.*,
m.nome AS matrice,
m.photo AS matrice_photo,
l.name AS linea,
c.nome AS cliente,
s.nome AS status_nome,
@ -222,7 +223,20 @@ $rows_special = array_filter($rows, function ($r) {
data-seconds="<?= $sec ?>"
style="--rowcolor: <?= htmlspecialchars($r['line_color']) ?>;">
<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
$mescRaw = $r['mescole_list'] ?? '';
$mescArray = $mescRaw !== '' ? explode(' | ', $mescRaw) : [];
@ -338,7 +352,20 @@ $rows_special = array_filter($rows, function ($r) {
data-status="<?= (int)$r['id_status'] ?>"
style="background-color: <?= htmlspecialchars($r['line_color']) ?>;">
<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
$mescRaw = $r['mescole_list'] ?? '';
$mescArray = $mescRaw !== '' ? explode(' | ', $mescRaw) : [];
@ -565,6 +592,19 @@ $rows_special = array_filter($rows, function ($r) {
$("#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() {
$("#photoModal").hide();
});
@ -610,16 +650,19 @@ $rows_special = array_filter($rows, function ($r) {
$("#imagePreviewModal").css("display", "flex");
});
$("#previewCloseX").on("click", function() {
// ❌ Chiudi preview con la X (delegato)
$(document).on("click", "#previewCloseX", function() {
$("#imagePreviewModal").hide();
});
$("#imagePreviewModal").on("click", function(e) {
// ❌ Chiudi cliccando fuori (delegato)
$(document).on("click", "#imagePreviewModal", function(e) {
if (e.target.id === "imagePreviewModal") {
$("#imagePreviewModal").hide();
}
});
// ===== MODALE MESCOLE (Multi) =====
$(document).on("click", ".showMescole", function(e) {
e.preventDefault();

View File

@ -385,6 +385,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
$sql = "SELECT
p.*,
m.nome AS matrice,
m.photo AS matrice_photo,
GROUP_CONCAT(ms.nome SEPARATOR ', ') AS mescola,
GROUP_CONCAT(ms.id SEPARATOR ',') AS mescole_ids,
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['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 data-line-id="<?= $r['id_linea'] ?>"><?= htmlspecialchars($r['linea']) ?></td>
<td><?= htmlspecialchars($r['cliente']) ?></td>
@ -513,7 +527,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
<thead>
<tr>
<th style="width:30px;"></th>
<th>Priority</th>
<th>P.</th>
<th>Conf. Ord.</th>
<th>Matrice</th>
<th>Mescola</th>
@ -1100,18 +1114,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['action'])) {
$("#imagePreviewModal").css("display", "flex");
});
// Chiudi con X
$("#previewCloseX").on("click", function() {
// Chiudi con X (delegato)
$(document).on("click", "#previewCloseX", function() {
$("#imagePreviewModal").hide();
});
// Chiudi cliccando fuori
$("#imagePreviewModal").on("click", function(e) {
// Chiudi cliccando fuori (delegato)
$(document).on("click", "#imagePreviewModal", function(e) {
if (e.target.id === "imagePreviewModal") {
$("#imagePreviewModal").hide();
}
});
$(document).on("click", ".view-mescole-btn", function() {
let names = $(this).data("names");

View File

@ -23,13 +23,32 @@
</td>
<td>
<span class='view'><?= $r['matrice'] ?></span>
<select class='inline-edit form-select form-select-sm select2'
name='idmatrice'>
<?= selectOptions($matrici, $r['idmatrice']) ?>
</select>
<?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>
<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