update mescole and photo diagram
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?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>
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="photo-actions" style="margin-top:12px; display:flex; gap:12px;">
|
||||
<div class="photo-actions" style="margin-top:12px; display:flex; gap:12px; width:100%; align-items:center;">
|
||||
|
||||
<!-- Lotto mescola -->
|
||||
<button class="photo-btn"
|
||||
@@ -24,4 +24,17 @@
|
||||
<i class="bi bi-exclamation-triangle" style="font-size:1.8rem; color:#b91c1c;"></i>
|
||||
</button>
|
||||
|
||||
<!-- 🔥 SPAZIO PER PORTARE A DESTRA -->
|
||||
<div style="flex-grow:1;"></div>
|
||||
|
||||
<!-- 🔵 ICONA QUALITÀ -->
|
||||
<button class="photo-btn qc-btn"
|
||||
data-production="<?= $r['id'] ?>"
|
||||
title="Controlli Qualità">
|
||||
<i class="bi bi-droplet-half"></i>
|
||||
</button>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
@@ -20,24 +20,41 @@
|
||||
⚠️ Errore durante il caricamento.
|
||||
</div>
|
||||
|
||||
|
||||
<form id="photoForm" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="production_id" id="photoProductionId">
|
||||
<input type="hidden" name="photo_type" id="photoType">
|
||||
<input type="hidden" name="param_position" id="photoParamPosition">
|
||||
|
||||
<!-- ✅ input file DENTRO al form -->
|
||||
<input type="file" name="photo" id="photoInput"
|
||||
accept="image/*;capture=camera"
|
||||
style="display:none;">
|
||||
|
||||
<div class="mb-3">
|
||||
<label><strong>Carica o scatta una foto:</strong></label>
|
||||
<input type="file" name="photo" accept="image/*;capture=camera"
|
||||
class="input-big" required>
|
||||
<button type="button" class="modal-btn" id="choosePhotoBtn">Scegli foto</button>
|
||||
<span id="selectedPhotoName" style="margin-left:8px; font-size:0.85rem; color:#64748b;"></span>
|
||||
</div>
|
||||
|
||||
<!-- 🔥 loader -->
|
||||
<div id="photoLoading"
|
||||
style="display:none; margin-top:10px; font-size:0.9rem; color:#64748b;">
|
||||
⏳ Caricamento in corso...
|
||||
</div>
|
||||
|
||||
<div id="singlePhotoInfo"
|
||||
style="display:none; margin-top:10px; font-size:0.9rem; color:#b91c1c; text-align:left;">
|
||||
Per questo parametro è già presente una foto.
|
||||
Se vuoi sostituirla, chiedi all'amministratore di cancellare quella esistente.
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal-buttons" style="margin-top:1.5rem;">
|
||||
<button type="button" id="photoCancel" class="modal-btn modal-cancel">Annulla</button>
|
||||
<button type="submit" class="modal-btn modal-confirm">Carica</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<hr style="margin:1.5rem 0;">
|
||||
|
||||
<h4 style="font-size:1rem; margin-bottom:0.7rem;">Foto già registrate per questa tipologia</h4>
|
||||
@@ -46,9 +63,5 @@
|
||||
style="display:flex; flex-wrap:wrap; gap:10px; max-height:220px; overflow-y:auto; padding:4px 0;">
|
||||
<!-- thumbnails caricati via JS -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user