diff --git a/public/userarea/delete_param.php b/public/userarea/delete_param.php new file mode 100644 index 0000000..689d2e9 --- /dev/null +++ b/public/userarea/delete_param.php @@ -0,0 +1,42 @@ + false, 'message' => 'Invalid parameter id.']); + exit; + } + + $db = DBHandlerSelect::getInstance(); + $pdo = $db->getConnection(); + + // Check existence + $stmt = $pdo->prepare("SELECT id FROM production_line_params WHERE id = :id"); + $stmt->execute([':id' => $id]); + + if (!$stmt->fetchColumn()) { + echo json_encode(['success' => false, 'message' => 'Parameter not found.']); + exit; + } + + // Delete + $del = $pdo->prepare("DELETE FROM production_line_params WHERE id = :id"); + $del->execute([':id' => $id]); + + echo json_encode([ + 'success' => true, + 'message' => 'Parameter deleted successfully.' + ]); +} catch (Exception $e) { + echo json_encode([ + 'success' => false, + 'message' => 'Server error: ' . $e->getMessage() + ]); +} diff --git a/public/userarea/get_param.php b/public/userarea/get_param.php new file mode 100644 index 0000000..0a4e4ce --- /dev/null +++ b/public/userarea/get_param.php @@ -0,0 +1,42 @@ + false, 'message' => 'Invalid parameter id.']); + exit; + } + + $db = DBHandlerSelect::getInstance(); + $pdo = $db->getConnection(); + + $stmt = $pdo->prepare(" + SELECT id, line_id, position, short_label, label, icon + FROM production_line_params + WHERE id = :id + "); + $stmt->execute([':id' => $id]); + $param = $stmt->fetch(PDO::FETCH_ASSOC); + + if (!$param) { + echo json_encode(['success' => false, 'message' => 'Parameter not found.']); + exit; + } + + echo json_encode([ + 'success' => true, + 'param' => $param + ]); +} catch (Exception $e) { + echo json_encode([ + 'success' => false, + 'message' => 'Server error: ' . $e->getMessage() + ]); +} diff --git a/public/userarea/line_params.php b/public/userarea/line_params.php new file mode 100644 index 0000000..f3f9646 --- /dev/null +++ b/public/userarea/line_params.php @@ -0,0 +1,381 @@ +getConnection(); + +// Read line id from GET +$lineId = isset($_GET['line_id']) ? (int)$_GET['line_id'] : 0; + +if ($lineId <= 0) { + die("Invalid line id"); +} + +// Load line data +$stmtLine = $pdo->prepare("SELECT * FROM production_lines WHERE id = :id"); +$stmtLine->execute([':id' => $lineId]); +$line = $stmtLine->fetch(PDO::FETCH_ASSOC); + +if (!$line) { + die("Production line not found"); +} + +// Load parameters for this line +$stmtParams = $pdo->prepare(" + SELECT * + FROM production_line_params + WHERE line_id = :line_id + ORDER BY position ASC, id ASC +"); +$stmtParams->execute([':line_id' => $lineId]); +$params = $stmtParams->fetchAll(PDO::FETCH_ASSOC); +?> + + + + + + + + + Parametri Linea <?= htmlspecialchars($line['name']) ?> - <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?> + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+
+ Parametri Linea: (Linea ) +
+ +
+ +
+
+
+
Elenco Parametri
+ + Linea ID: - Colore: + + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDPositionShort labelLabelIcon classPreviewActions
No parameters defined for this line.
+ + + + - + + + + +
+
+
+
+
+
+ + +
+ + + + + + + + + \ No newline at end of file diff --git a/public/userarea/linee.php b/public/userarea/linee.php index d4b7c3f..84f93bb 100644 --- a/public/userarea/linee.php +++ b/public/userarea/linee.php @@ -84,6 +84,10 @@ color: #128346; } + .btn-action.params { + color: #6f42c1; + } + .btn-action:hover { transform: scale(1.15); } @@ -114,7 +118,7 @@ -
+
@@ -134,7 +138,7 @@
- +
@@ -156,32 +160,44 @@ $stmt = $pdo->query("SELECT * FROM production_lines ORDER BY line_number ASC"); if ($stmt->rowCount() === 0) { - echo ""; + echo ""; } else { while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $badge = $row['status'] === 'active' ? "Attiva" : "Inattiva"; + $lineNameEsc = htmlspecialchars($row['name'], ENT_QUOTES, 'UTF-8'); + echo " - + - - - "; + + + + + + "; } } ?> @@ -196,7 +212,7 @@ - +
Nessuna linea di produzione presente
Nessuna linea di produzione presente
{$row['id']} {$row['line_number']}" . htmlspecialchars($row['name']) . "{$lineNameEsc} " . htmlspecialchars($row['model']) . " " . htmlspecialchars($row['brand']) . "
{$badge} - - - - -