fixed nuovo
This commit is contained in:
@@ -12,6 +12,9 @@ try {
|
||||
$brand = $_POST['brand'] ?? '';
|
||||
$status = $_POST['status'] ?? 'active';
|
||||
$color = $_POST['color'] ?? '#dc2626';
|
||||
$maxHours = isset($_POST['max_hours_per_day']) ? (float)$_POST['max_hours_per_day'] : 24;
|
||||
if ($maxHours < 0) $maxHours = 0;
|
||||
if ($maxHours > 24) $maxHours = 24;
|
||||
|
||||
if (!$lineNumber || !$name) {
|
||||
echo json_encode(['success' => false, 'message' => 'Numero linea e nome sono obbligatori.']);
|
||||
@@ -19,10 +22,10 @@ try {
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare("
|
||||
INSERT INTO production_lines (line_number, name, model, brand, status, color)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
INSERT INTO production_lines (line_number, name, model, brand, status, color, max_hours_per_day)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
");
|
||||
$stmt->execute([$lineNumber, $name, $model, $brand, $status, $color]);
|
||||
$stmt->execute([$lineNumber, $name, $model, $brand, $status, $color, $maxHours]);
|
||||
|
||||
echo json_encode(['success' => true]);
|
||||
} catch (Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user