update mescole and photo diagram

This commit is contained in:
2025-12-03 08:35:59 +01:00
parent a1c9d9f789
commit dd9d109dee
375 changed files with 1394 additions and 541 deletions
+63 -18
View File
@@ -8,22 +8,33 @@ $linee = $pdo->query("SELECT id, line_number, name FROM production_lines ORDER B
$status_list = $pdo->query("SELECT id, nome, badge_color, line_color FROM production_status ORDER BY ordinamento, nome")->fetchAll(PDO::FETCH_ASSOC);
// --- CARICO TUTTE LE PRODUZIONI UNA VOLTA SOLA ---
$sql = "SELECT
p.*,
m.nome AS matrice,
ms.nome AS mescola,
l.name AS linea,
c.nome AS cliente,
s.nome AS status_nome,
COALESCE(s.badge_color, '#6c757d') AS badge_color,
COALESCE(s.line_color, '#ffffff') AS line_color
FROM productiondata p
LEFT JOIN matrice m ON p.idmatrice = m.id
LEFT JOIN mescole ms ON p.idmescola = ms.id
LEFT JOIN production_lines l ON p.id_linea = l.id
LEFT JOIN clients c ON p.id_cliente = c.id
LEFT JOIN production_status s ON p.id_status = s.id
ORDER BY p.data_produzione DESC, p.Data DESC, p.id DESC";
$sql = "
SELECT
p.*,
m.nome AS matrice,
l.name AS linea,
c.nome AS cliente,
s.nome AS status_nome,
COALESCE(s.badge_color, '#6c757d') AS badge_color,
COALESCE(s.line_color, '#ffffff') AS line_color,
/* 🔥 NUOVA LISTA MESCOLE MULTI */
GROUP_CONCAT(ms.nome ORDER BY ms.nome SEPARATOR ' | ') AS mescole_list
FROM productiondata p
LEFT JOIN matrice m ON p.idmatrice = m.id
LEFT JOIN production_lines l ON p.id_linea = l.id
LEFT JOIN clients c ON p.id_cliente = c.id
LEFT JOIN production_status s ON p.id_status = s.id
/* NUOVA JOIN A TABELLA MESCOLE */
LEFT JOIN productiondata_mescole pm ON p.id = pm.id_productiondata
LEFT JOIN mescole ms ON pm.id_mescola = ms.id
GROUP BY p.id
ORDER BY p.data_produzione DESC, p.Data DESC, p.id DESC
";
$rows = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
@@ -210,7 +221,24 @@ $rows_special = array_filter($rows, function ($r) {
data-seconds="<?= $sec ?>"
style="--rowcolor: <?= htmlspecialchars($r['line_color']) ?>;">
<td><?= htmlspecialchars($r['matrice']) ?></td>
<td><?= htmlspecialchars($r['mescola']) ?></td>
<?php
$mescRaw = $r['mescole_list'] ?? '';
$mescArray = $mescRaw !== '' ? explode(' | ', $mescRaw) : [];
$mescCount = count($mescArray);
?>
<td>
<?php if ($mescCount === 0): ?>
<span style="color:#999;">N/A</span>
<?php elseif ($mescCount === 1): ?>
<?= htmlspecialchars($mescArray[0]) ?>
<?php else: ?>
<button class="btn btn-warning btn-sm showMescole"
data-list="<?= htmlspecialchars(json_encode($mescArray), ENT_QUOTES) ?>">
Multi (<?= $mescCount ?>)
</button>
<?php endif; ?>
</td>
<td><?= htmlspecialchars($r['linea']) ?></td>
<td><?= htmlspecialchars($r['cliente']) ?></td>
<td><?= htmlspecialchars($r['data_zibo']) ?></td>
@@ -307,7 +335,24 @@ $rows_special = array_filter($rows, function ($r) {
data-status="<?= (int)$r['id_status'] ?>"
style="background-color: <?= htmlspecialchars($r['line_color']) ?>;">
<td><?= htmlspecialchars($r['matrice']) ?></td>
<td><?= htmlspecialchars($r['mescola']) ?></td>
<?php
$mescRaw = $r['mescole_list'] ?? '';
$mescArray = $mescRaw !== '' ? explode(' | ', $mescRaw) : [];
$mescCount = count($mescArray);
?>
<td>
<?php if ($mescCount === 0): ?>
<span style="color:#999;">N/A</span>
<?php elseif ($mescCount === 1): ?>
<?= htmlspecialchars($mescArray[0]) ?>
<?php else: ?>
<button class="btn btn-warning btn-sm showMescole"
data-list="<?= htmlspecialchars(json_encode($mescArray), ENT_QUOTES) ?>">
Multi (<?= $mescCount ?>)
</button>
<?php endif; ?>
</td>
<td><?= htmlspecialchars($r['linea']) ?></td>
<td><?= htmlspecialchars($r['cliente']) ?></td>
<td><?= htmlspecialchars($r['data_zibo']) ?></td>