43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
// Recupero foto esistenti
|
|
$photosSlots = [];
|
|
$stmt = $pdo->prepare("
|
|
SELECT param_position, filename
|
|
FROM production_photos
|
|
WHERE production_id = ?
|
|
AND photo_type = 'parametri_macchina'
|
|
");
|
|
$stmt->execute([$r['id']]);
|
|
|
|
foreach ($stmt->fetchAll() as $p) {
|
|
$photosSlots[(int)$p['param_position']] = $p['filename'];
|
|
}
|
|
|
|
// Slot dinamici per la linea
|
|
$slots = $r['param_slots'] ?? [];
|
|
|
|
if (empty($slots)) {
|
|
echo "<div style='color:#999; padding:8px;'>Nessun parametro configurato per questa linea.</div>";
|
|
return;
|
|
}
|
|
?>
|
|
|
|
<div class="param-grid" style="grid-template-columns: repeat(<?= count($slots) ?>, 1fr);">
|
|
<?php foreach ($slots as $slot): ?>
|
|
<?php
|
|
$pos = (int)$slot['position'];
|
|
$label = htmlspecialchars($slot['short_label']);
|
|
$img = $photosSlots[$pos] ?? null;
|
|
?>
|
|
<div class="param-slot" data-slot="<?= $pos ?>" data-production="<?= $r['id'] ?>">
|
|
<div class="thumb">
|
|
<?php if ($img): ?>
|
|
<img src="photos/<?= htmlspecialchars($img) ?>" class="thumb-img">
|
|
<?php else: ?>
|
|
<img src="assets/placeholder-photo.png" class="thumb-img">
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="param-label"><?= $label ?></div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|