93 lines
3.3 KiB
PHP
93 lines
3.3 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
|
|
$mission_id = $_GET['id'] ?? null;
|
|
$mission = null;
|
|
$error = '';
|
|
|
|
if ($mission_id) {
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare("SELECT * FROM missions WHERE id = ?");
|
|
$stmt->execute([$mission_id]);
|
|
$mission = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (!$mission) {
|
|
$error = "Mission not found.";
|
|
}
|
|
} catch (PDOException $e) {
|
|
$error = "Database error: " . $e->getMessage();
|
|
}
|
|
} else {
|
|
$error = "No mission ID provided.";
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Mission Details - AgroDrone Control</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.css">
|
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css">
|
|
</head>
|
|
<body>
|
|
|
|
<header class="header text-white">
|
|
<div class="container d-flex justify-content-between align-items-center">
|
|
<h1 class="logo">AgroDrone</h1>
|
|
<nav>
|
|
<a href="index.php" class="nav-link">Dashboard</a>
|
|
</nav>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="container mt-5">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h2>Mission Details</h2>
|
|
<a href="index.php" class="btn btn-secondary">
|
|
<i data-feather="arrow-left" class="me-2"></i>Back to Dashboard
|
|
</a>
|
|
</div>
|
|
|
|
<?php if ($error): ?>
|
|
<div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div>
|
|
<?php elseif ($mission): ?>
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4 class="card-title mb-0">Mission: <?php echo htmlspecialchars($mission['name']); ?></h4>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<p><strong>Drone:</strong> <?php echo htmlspecialchars($mission['drone']); ?></p>
|
|
<p><strong>Status:</strong> <span class="badge bg-primary"><?php echo htmlspecialchars($mission['status']); ?></span></p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<p><strong>Date:</strong> <?php echo htmlspecialchars(date('F j, Y', strtotime($mission['mission_date']))); ?></p>
|
|
<p><strong>Created At:</strong> <?php echo htmlspecialchars(date('F j, Y, g:i a', strtotime($mission['created_at']))); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
</main>
|
|
|
|
<footer class="footer mt-auto py-3 bg-light">
|
|
<div class="container text-center">
|
|
<span class="text-muted">© <?php echo date("Y"); ?> AgroDrone Control. All rights reserved.</span>
|
|
</div>
|
|
</footer>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
|
<script>
|
|
feather.replace();
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|