����JFIF��`�`�����Viewing File: /home/u820193700/domains/throtllr.in/public_html/admin/view_inspection.php
<?php
require_once '../includes/db.php';
require_once '../includes/functions.php';
if(!is_logged_in()) { redirect("login.php"); }

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $id = intval($_POST['id']);
    $status = $_POST['status'];
    
    $stmt = $pdo->prepare("UPDATE inspection_bookings SET status = ? WHERE id = ?");
    $stmt->execute([$status, $id]);
    
    redirect("view_inspection.php?id=$id&msg=updated");
}

$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$stmt = $pdo->prepare("
    SELECT i.*, b.model_name, b.reference_id 
    FROM inspection_bookings i 
    LEFT JOIN bikes b ON i.bike_id = b.id 
    WHERE i.id = ?
");
$stmt->execute([$id]);
$insp = $stmt->fetch();

if (!$insp) {
    die("Inspection not found.");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>View Inspection - ReOwn Admin</title>
    <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="admin.css">
</head>
<body>

<?php include 'admin_sidebar.php'; ?>

<div id="main-content">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h2>Inspection Details #<?php echo $insp['id']; ?></h2>
        <a href="manage_inspections.php" class="btn btn-outline-light"><i class="fas fa-arrow-left me-2"></i>Back to List</a>
    </div>

    <?php if(isset($_GET['msg']) && $_GET['msg'] == 'updated'): ?>
        <div class="alert alert-success">Inspection status updated successfully.</div>
    <?php endif; ?>

    <div class="row">
        <div class="col-md-8">
            <div class="glass-card p-4 mb-4">
                <h4 class="mb-4">Customer Details</h4>
                <table class="table table-dark table-borderless">
                    <tr><th style="width: 200px;">Name</th><td><?php echo htmlspecialchars($insp['name']); ?></td></tr>
                    <tr><th>Phone</th><td><?php echo htmlspecialchars($insp['phone']); ?></td></tr>
                    <tr><th>Address / Location</th><td><?php echo nl2br(htmlspecialchars($insp['address'] ?? 'Not provided')); ?></td></tr>
                    <tr><th>Notes</th><td><?php echo nl2br(htmlspecialchars($insp['additional_notes'] ?? 'None')); ?></td></tr>
                </table>
            </div>
            
            <div class="glass-card p-4">
                <h4 class="mb-4">Booking Details</h4>
                <table class="table table-dark table-borderless">
                    <tr>
                        <th style="width: 200px;">Target Bike</th>
                        <td>
                            <?php if ($insp['bike_id']): ?>
                                <a href="../bike-details.php?id=<?php echo $insp['bike_id']; ?>" target="_blank" class="text-re-red text-decoration-none">
                                    <?php echo htmlspecialchars($insp['model_name']); ?> (#<?php echo htmlspecialchars($insp['reference_id']); ?>)
                                </a>
                            <?php else: ?>
                                General Inspection
                            <?php endif; ?>
                        </td>
                    </tr>
                    <tr><th>Preferred Date</th><td><?php echo htmlspecialchars($insp['preferred_date']); ?></td></tr>
                    <tr><th>Preferred Time</th><td><?php echo htmlspecialchars($insp['preferred_time'] ?? 'Any time'); ?></td></tr>
                    <tr><th>Submitted On</th><td><?php echo date('M d, Y h:i A', strtotime($insp['created_at'])); ?></td></tr>
                </table>
            </div>
        </div>

        <div class="col-md-4">
            <div class="glass-card p-4">
                <h4 class="mb-4">Update Status</h4>
                <form action="view_inspection.php" method="POST">
                    <input type="hidden" name="id" value="<?php echo $insp['id']; ?>">
                    <div class="mb-3">
                        <label class="form-label text-muted">Current Status</label>
                        <select name="status" class="form-select bg-dark text-white border-secondary">
                            <option value="pending" <?php echo $insp['status']=='pending'?'selected':''; ?>>Pending</option>
                            <option value="assigned" <?php echo $insp['status']=='assigned'?'selected':''; ?>>Assigned</option>
                            <option value="completed" <?php echo $insp['status']=='completed'?'selected':''; ?>>Completed</option>
                            <option value="cancelled" <?php echo $insp['status']=='cancelled'?'selected':''; ?>>Cancelled</option>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-primary w-100">Save Status</button>
                </form>
            </div>
        </div>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Back to Directory �������}�!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������������� ������w�!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz������������������������������������������������������������������������ ��?��_��+��?��(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(�����