fixed add instrument

This commit is contained in:
2025-12-05 12:29:33 +01:00
parent 37909e8175
commit 824ae278d1
6 changed files with 717 additions and 51 deletions
+76 -5
View File
@@ -90,6 +90,29 @@ if ($matricePhoto) {
$mescArray = $mescRaw !== '' ? explode(' | ', $mescRaw) : [];
$mescCount = count($mescArray);
?>
<?php
// 🔧 Strumenti aggiuntivi: un badge per ogni strumento
$toolsRaw = $r['tools_list'] ?? ''; // es: "Marcatura Laser | Taglierina"
$toolsArray = [];
if ($toolsRaw !== '') {
// normalizzo i vari separatori possibili a un carattere unico
$normalized = str_replace(
[' | ', '|', ' · '], // quello che può arrivare dalla GROUP_CONCAT
'§', // separatore interno "di servizio"
$toolsRaw
);
$pieces = explode('§', $normalized);
// tolgo spazi e eventuali vuoti
$toolsArray = array_filter(array_map('trim', $pieces));
}
?>
<div>
<strong>Mescola</strong>
@@ -141,7 +164,6 @@ if ($matricePhoto) {
$paramsLinea = $r['params_linea'] ?? [];
// 🔥 Carica già anche eventuali foto di slot parametri
// (necessario perché param_grid.php usa $photosSlots)
$photosSlots = [];
$stmt = $pdo->prepare("
SELECT param_position, filename
@@ -154,13 +176,10 @@ if ($matricePhoto) {
$photosSlots[(int)$p['param_position']] = $p['filename'];
}
// 👉 Include la griglia parametri con le variabili già disponibili
$paramsLinea = $r['param_slots'] ?? [];
include __DIR__ . "/components/param_grid.php";
?>
<!-- Teorici nascosti (per modale finale) -->
<span data-field="kg_sp" style="display:none;"><?= $r['kg_sp'] ?></span>
<span data-field="metri" style="display:none;"><?= $r['metri'] ?></span>
@@ -177,15 +196,67 @@ if ($matricePhoto) {
<?php if (in_array($r['id_status'], [2, 7])): // 2 produzione, 7 pausa
?>
<?php include __DIR__ . "/components/photo_buttons.php"; ?>
<div class="photo-tools-row"
style="margin-top:0.75rem; display:flex; flex-wrap:wrap; gap:0.6rem; align-items:center;">
<!-- 👈 GRUPPO 3 ICONE FOTO -->
<div class="photo-buttons-group"
style="display:flex; flex-wrap:wrap; gap:0.4rem; align-items:center;">
<?php include __DIR__ . "/components/photo_buttons.php"; ?>
</div>
<!-- 🎯 UN BADGE PER OGNI STRUMENTO, SUBITO DOPO LE FOTO -->
<?php foreach ($toolsArray as $toolName): ?>
<span class="badge tools-badge"
style="
background:#0d6efd;
color:#ffffff;
font-size:0.78rem;
font-weight:600;
border-radius:999px;
padding:0.30rem 0.85rem;
white-space:nowrap;
">
<?= htmlspecialchars($toolName) ?>
</span>
<?php endforeach; ?>
<!-- l'icona qualità (.qc-btn) resta dove l'hai già messa e viene spostata tutta a destra dal JS -->
</div>
<?php endif; ?>
<?php else: ?>
<button class="action-btn start-btn" data-id="<?= $r['id'] ?>">AVVIA PRODUZIONE</button>
<?php foreach ($toolsArray as $toolName): ?>
<span class="badge tools-badge"
style="
display:inline-block;
margin-left:0.5rem;
background:#0d6efd;
color:#ffffff;
font-size:0.78rem;
font-weight:600;
border-radius:999px;
padding:0.30rem 0.85rem;
white-space:nowrap;
">
<?= htmlspecialchars($toolName) ?>
</span>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>