added params crud lines
This commit is contained in:
+39
-17
@@ -84,6 +84,10 @@
|
||||
color: #128346;
|
||||
}
|
||||
|
||||
.btn-action.params {
|
||||
color: #6f42c1;
|
||||
}
|
||||
|
||||
.btn-action:hover {
|
||||
transform: scale(1.15);
|
||||
}
|
||||
@@ -114,7 +118,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<div class="wrapper toggled">
|
||||
<?php include('include/navbar.php'); ?>
|
||||
<?php include('include/topbar.php'); ?>
|
||||
|
||||
@@ -134,7 +138,7 @@
|
||||
<button class="btn btn-add" data-bs-toggle="modal" data-bs-target="#addLineaModal">➕ Aggiungi Linea</button>
|
||||
</div>
|
||||
|
||||
<!-- TABELLA -->
|
||||
<!-- TABLE -->
|
||||
<div class="table-responsive">
|
||||
<table id="tabellaLinee" class="table table-striped align-middle text-center" style="width:100%;">
|
||||
<thead>
|
||||
@@ -156,32 +160,44 @@
|
||||
$stmt = $pdo->query("SELECT * FROM production_lines ORDER BY line_number ASC");
|
||||
|
||||
if ($stmt->rowCount() === 0) {
|
||||
echo "<tr><td colspan='7' class='text-muted'>Nessuna linea di produzione presente</td></tr>";
|
||||
echo "<tr><td colspan='8' class='text-muted'>Nessuna linea di produzione presente</td></tr>";
|
||||
} else {
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$badge = $row['status'] === 'active'
|
||||
? "<span class='badge-active'>Attiva</span>"
|
||||
: "<span class='badge-inactive'>Inattiva</span>";
|
||||
|
||||
$lineNameEsc = htmlspecialchars($row['name'], ENT_QUOTES, 'UTF-8');
|
||||
|
||||
echo "<tr>
|
||||
<td>{$row['id']}</td>
|
||||
<td>{$row['line_number']}</td>
|
||||
<td>" . htmlspecialchars($row['name']) . "</td>
|
||||
<td>{$lineNameEsc}</td>
|
||||
<td>" . htmlspecialchars($row['model']) . "</td>
|
||||
<td>" . htmlspecialchars($row['brand']) . "</td>
|
||||
|
||||
<td>
|
||||
<div style='width:28px; height:28px; border-radius:6px; border:1px solid #999; background: {$row['color']}; margin:auto;'></div>
|
||||
</td>
|
||||
|
||||
<td>{$badge}</td>
|
||||
<td>
|
||||
|
||||
<button class='btn-action edit' title='Modifica' data-id='{$row['id']}'><i class='fas fa-edit'></i></button>
|
||||
<button class='btn-action delete' title='Elimina' data-id='{$row['id']}'><i class='fas fa-trash'></i></button>
|
||||
<button class='btn-action toggle' title='Cambia stato' data-id='{$row['id']}' data-status='{$row['status']}'><i class='fas fa-power-off'></i></button>
|
||||
</td>
|
||||
</tr>";
|
||||
<button class='btn-action params' title='Parametri linea'
|
||||
data-id='{$row['id']}'
|
||||
data-name='{$lineNameEsc}'>
|
||||
<i class='fas fa-sliders-h'></i>
|
||||
</button>
|
||||
<button class='btn-action edit' title='Modifica' data-id='{$row['id']}'>
|
||||
<i class='fas fa-edit'></i>
|
||||
</button>
|
||||
<button class='btn-action delete' title='Elimina' data-id='{$row['id']}'>
|
||||
<i class='fas fa-trash'></i>
|
||||
</button>
|
||||
<button class='btn-action toggle' title='Cambia stato'
|
||||
data-id='{$row['id']}'
|
||||
data-status='{$row['status']}'>
|
||||
<i class='fas fa-power-off'></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -196,7 +212,7 @@
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
|
||||
<!-- MODALE AGGIUNTA LINEA -->
|
||||
<!-- ADD LINE MODAL -->
|
||||
<div class="modal fade" id="addLineaModal" tabindex="-1" aria-labelledby="addLineaLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
@@ -250,7 +266,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
// ➕ Aggiungi linea
|
||||
// ➕ Add line
|
||||
$("#addLineaForm").on("submit", function(e) {
|
||||
e.preventDefault();
|
||||
const formData = new FormData(this);
|
||||
@@ -271,13 +287,19 @@
|
||||
.catch(() => Swal.fire("Errore", "Impossibile contattare il server.", "error"));
|
||||
});
|
||||
|
||||
// ✏️ Modifica
|
||||
// ✏️ Edit line
|
||||
$(document).on("click", ".edit", function() {
|
||||
const id = $(this).data("id");
|
||||
location.href = "edit_linea.php?id=" + id;
|
||||
});
|
||||
|
||||
// 🗑️ Elimina
|
||||
// 🧩 Parameters management
|
||||
$(document).on("click", ".params", function() {
|
||||
const id = $(this).data("id");
|
||||
location.href = "line_params.php?line_id=" + id;
|
||||
});
|
||||
|
||||
// 🗑️ Delete line
|
||||
$(document).on("click", ".delete", function() {
|
||||
const id = $(this).data("id");
|
||||
Swal.fire({
|
||||
@@ -304,7 +326,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
// 🔘 Toggle stato
|
||||
// 🔘 Toggle status
|
||||
$(document).on("click", ".toggle", function() {
|
||||
const id = $(this).data("id");
|
||||
const currentStatus = $(this).data("status");
|
||||
|
||||
Reference in New Issue
Block a user