Job Management
Components & Operations
= htmlspecialchars($comp['name']) ?>
| Op Name | Process | Prio | Status |
|---|---|---|---|
| No operations defined. | |||
| = htmlspecialchars($op['name']) ?> | = strtoupper($op['process_type']) ?> | = $op['priority'] ?> | = $op['status'] ?> |
prepare("INSERT INTO jobs (name, quantity, due_date, serial_number) VALUES (?, ?, ?, ?)"); $stmt->execute([$name, $qty, $due, $sn]); $jobId = $db->lastInsertId(); header("Location: jobs.php?id=$jobId"); exit; } catch (Exception $e) { $error = "Error: " . $e->getMessage(); } } // Handle Component Addition if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_component'])) { $jobId = $_POST['job_id']; $compName = $_POST['comp_name']; $stmt = $db->prepare("INSERT INTO components (job_id, name) VALUES (?, ?)"); $stmt->execute([$jobId, $compName]); header("Location: jobs.php?id=$jobId"); exit; } // Handle Operation Addition if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_op'])) { $jobId = $_POST['job_id']; $compId = $_POST['comp_id']; $opName = $_POST['op_name']; $proc = $_POST['process_type']; $prio = $_POST['priority']; $stmt = $db->prepare("INSERT INTO operations (component_id, name, process_type, priority) VALUES (?, ?, ?, ?)"); $stmt->execute([$compId, $opName, $proc, $prio]); header("Location: jobs.php?id=$jobId"); exit; } $jobs = $db->query("SELECT * FROM jobs ORDER BY created_at DESC")->fetchAll(); $currentJobId = $_GET['id'] ?? null; $currentJob = null; $components = []; if ($currentJobId) { $stmt = $db->prepare("SELECT * FROM jobs WHERE id = ?"); $stmt->execute([$currentJobId]); $currentJob = $stmt->fetch(); if ($currentJob) { $stmt = $db->prepare("SELECT * FROM components WHERE job_id = ?"); $stmt->execute([$currentJobId]); $components = $stmt->fetchAll(); foreach ($components as &$comp) { $stmt = $db->prepare("SELECT * FROM operations WHERE component_id = ?"); $stmt->execute([$comp['id']]); $comp['ops'] = $stmt->fetchAll(); } } } ?>
| Op Name | Process | Prio | Status |
|---|---|---|---|
| No operations defined. | |||
| = htmlspecialchars($op['name']) ?> | = strtoupper($op['process_type']) ?> | = $op['priority'] ?> | = $op['status'] ?> |