diff --git a/public/userarea/delete_linea.php b/public/userarea/delete_linea.php new file mode 100644 index 0000000..51b8fbb --- /dev/null +++ b/public/userarea/delete_linea.php @@ -0,0 +1,28 @@ + false, 'message' => 'ID non valido.']); + exit; + } + + $id = (int)$_GET['id']; + + $db = DBHandlerSelect::getInstance(); + $pdo = $db->getConnection(); + + $stmt = $pdo->prepare("DELETE FROM production_lines WHERE id = ?"); + $stmt->execute([$id]); + + if ($stmt->rowCount() > 0) { + echo json_encode(['success' => true]); + } else { + echo json_encode(['success' => false, 'message' => 'Linea non trovata o già eliminata.']); + } +} catch (Exception $e) { + echo json_encode(['success' => false, 'message' => 'Errore: ' . $e->getMessage()]); +} diff --git a/public/userarea/delete_matrice.php b/public/userarea/delete_matrice.php new file mode 100644 index 0000000..60607a2 --- /dev/null +++ b/public/userarea/delete_matrice.php @@ -0,0 +1,26 @@ + false, 'message' => 'ID non fornito.']); + exit; + } + + $id = intval($_GET['id']); + $db = DBHandlerSelect::getInstance(); + $pdo = $db->getConnection(); + + // Cancella eventuali associazioni + $pdo->prepare("DELETE FROM matrice_lines WHERE idmatrice = ?")->execute([$id]); + $pdo->prepare("DELETE FROM matrice_mescole WHERE idmatrice = ?")->execute([$id]); + + // Cancella la matrice + $pdo->prepare("DELETE FROM matrice WHERE id = ?")->execute([$id]); + + echo json_encode(['success' => true, 'message' => 'Matrice eliminata con successo.']); +} catch (Exception $e) { + echo json_encode(['success' => false, 'message' => 'Errore: ' . $e->getMessage()]); +} diff --git a/public/userarea/edit_linea.php b/public/userarea/edit_linea.php new file mode 100644 index 0000000..90264b3 --- /dev/null +++ b/public/userarea/edit_linea.php @@ -0,0 +1,166 @@ + + + + +
+ + + + +| ID | +Numero | +Nome | +Modello | +Marca | +Stato | +Azioni | +
|---|---|---|---|---|---|---|
| Nessuna linea di produzione presente | ||||||
| {$row['id']} | +{$row['line_number']} | +" . htmlspecialchars($row['name']) . " | +" . htmlspecialchars($row['model']) . " | +" . htmlspecialchars($row['brand']) . " | +{$badge} | ++ + + + | +
| ID | +ID | Nome Matrice | +Azioni |
|---|---|---|---|
| Nessuna matrice presente | |||
| Nessuna matrice presente | |||
| " . htmlspecialchars($row['id']) . " | -" . htmlspecialchars($row['nome']) . " | -{$row['id']} | +" . htmlspecialchars($row['nome']) . " | ++ + + + + | + "; } } ?> @@ -141,16 +176,17 @@ - +