diff --git a/public/userarea/ajax_update_priority.php b/public/userarea/ajax_update_priority.php
index f89efa4..482c88a 100644
--- a/public/userarea/ajax_update_priority.php
+++ b/public/userarea/ajax_update_priority.php
@@ -13,11 +13,12 @@ foreach ($programmati as $p) {
$stmt->execute([$p["priority"], $p["id"]]);
}
-foreach ($daProgrammare as $id) {
- $stmt = $pdo->prepare("UPDATE productiondata SET id_status=1, priority=NULL WHERE id=?");
- $stmt->execute([$id]);
+foreach ($daProgrammare as $p) {
+ $stmt = $pdo->prepare("UPDATE productiondata SET id_status=1, priority=? WHERE id=?");
+ $stmt->execute([$p["priority"], $p["id"]]);
}
+
$pdo->commit();
echo json_encode(["success" => true]);
diff --git a/public/userarea/assets/placeholder-photo.png b/public/userarea/assets/placeholder-photo.png
new file mode 100644
index 0000000..d707a41
Binary files /dev/null and b/public/userarea/assets/placeholder-photo.png differ
diff --git a/public/userarea/components/param_grid.php b/public/userarea/components/param_grid.php
new file mode 100644
index 0000000..f136216
--- /dev/null
+++ b/public/userarea/components/param_grid.php
@@ -0,0 +1,43 @@
+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 "
Nessun parametro configurato per questa linea.
";
+ return;
+}
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
= $label ?>
+
+
+
\ No newline at end of file
diff --git a/public/userarea/components/photo_buttons.php b/public/userarea/components/photo_buttons.php
index 1264a2e..37269e7 100644
--- a/public/userarea/components/photo_buttons.php
+++ b/public/userarea/components/photo_buttons.php
@@ -1,4 +1,4 @@
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/userarea/components/photo_modal.php b/public/userarea/components/photo_modal.php
index 9cf5401..46227de 100644
--- a/public/userarea/components/photo_modal.php
+++ b/public/userarea/components/photo_modal.php
@@ -20,24 +20,41 @@
⚠️ Errore durante il caricamento.
-
+
Foto già registrate per questa tipologia
@@ -46,9 +63,5 @@
style="display:flex; flex-wrap:wrap; gap:10px; max-height:220px; overflow-y:auto; padding:4px 0;">
-
-
-
-
\ No newline at end of file
diff --git a/public/userarea/get_photos.php b/public/userarea/get_photos.php
index 22e1e99..e1a1265 100644
--- a/public/userarea/get_photos.php
+++ b/public/userarea/get_photos.php
@@ -8,22 +8,39 @@ try {
$production_id = isset($_GET['production_id']) ? (int)$_GET['production_id'] : 0;
$photo_type = $_GET['photo_type'] ?? '';
+ $slot = isset($_GET['param_position']) ? (int)$_GET['param_position'] : null;
if ($production_id <= 0 || $photo_type === '') {
throw new Exception("Parametri non validi");
}
- $stmt = $pdo->prepare("
+ // QUERY BASE
+ $sql = "
SELECT id, filename, photo_type, created_at, elaborato
FROM production_photos
- WHERE production_id = :prod AND photo_type = :ptype
- ORDER BY created_at DESC, id DESC
- ");
- $stmt->execute([
+ WHERE production_id = :prod
+ AND photo_type = :ptype
+ ";
+
+ // SE È PARAMETRO MACCHINA → FILTRO PER POSIZIONE
+ if ($photo_type === 'parametri_macchina') {
+ $sql .= " AND param_position = :slot";
+ }
+
+ $sql .= " ORDER BY created_at DESC, id DESC";
+
+ $stmt = $pdo->prepare($sql);
+
+ $params = [
':prod' => $production_id,
':ptype' => $photo_type
- ]);
+ ];
+ if ($photo_type === 'parametri_macchina') {
+ $params[':slot'] = $slot;
+ }
+
+ $stmt->execute($params);
$photos = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode([
diff --git a/public/userarea/manager_produzione.php b/public/userarea/manager_produzione.php
index bdd604b..b8ba1c9 100644
--- a/public/userarea/manager_produzione.php
+++ b/public/userarea/manager_produzione.php
@@ -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']) ?>;">