📁 File Manager
Editing:
/home/wvl7mof7402e/public_html/wingstourandtravels.com/admin/enquiries.php
<?php include 'sidebar.php'; ?> <?php require_once 'auth_check.php'; require_once 'db.php'; // Ensure the database connection is available to this file. $conn = $conn ?? null; if (!$conn instanceof mysqli) { die('Database connection is unavailable.'); } // Delete Enquiry Logic if (isset($_GET['delete_id'])) { $delete_id = intval($_GET['delete_id']); $stmt = mysqli_prepare($conn, "DELETE FROM enquiries WHERE id = ?"); mysqli_stmt_bind_param($stmt, "i", $delete_id); mysqli_stmt_execute($stmt); header("Location: enquiries.php?msg=deleted"); exit(); } // Fetch All Enquiries $query = "SELECT * FROM enquiries ORDER BY id DESC"; $result = mysqli_query($conn, $query); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Customer Enquiries | Wings Tour & Travels Admin</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css"> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet"> <style> :root { --brand-green: #12521f; --brand-saffron: #D4A359; --dark-navy: #0F172A; --sidebar-width: 250px; --bg-light: #F8FAFC; } * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; } body { background-color: var(--bg-light); display: flex; min-height: 100vh; } .admin-sidebar { width: var(--sidebar-width); background-color: var(--dark-navy); color: #ffffff; position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; z-index: 100; } .sidebar-brand { padding: 22px 20px; background: rgba(0, 0, 0, 0.2); text-align: center; } .sidebar-brand h2 { font-size: 20px; color: var(--brand-saffron); } .sidebar-brand p { font-size: 11px; color: #94A3B8; } .sidebar-menu { list-style: none; padding: 20px 0; flex: 1; } .sidebar-menu li a { display: flex; align-items: center; gap: 12px; padding: 12px 22px; color: #CBD5E1; text-decoration: none; font-size: 14px; font-weight: 500; transition: all 0.25s ease; } .sidebar-menu li a:hover, .sidebar-menu li.active a { background: rgba(255, 255, 255, 0.08); color: #ffffff; border-left: 4px solid var(--brand-saffron); } .admin-main { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; } .admin-topbar { background: #ffffff; height: 65px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04); position: sticky; top: 0; z-index: 99; } .admin-content { padding: 30px; } .page-title { font-size: 22px; color: var(--dark-navy); margin-bottom: 20px; font-weight: 700; } .table-container { background: #ffffff; border-radius: 12px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03); border: 1px solid #E2E8F0; overflow-x: auto; } table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13.5px; } th { background: #F1F5F9; color: var(--dark-navy); font-weight: 600; padding: 14px 18px; border-bottom: 1px solid #E2E8F0; white-space: nowrap; } td { padding: 14px 18px; border-bottom: 1px solid #E2E8F0; color: #334155; } tr:hover { background-color: #F8FAFC; } .btn-delete { color: #EF4444; background: #FEF2F2; padding: 6px 10px; border-radius: 6px; text-decoration: none; font-size: 12px; font-weight: 600; transition: all 0.2s ease; } .btn-delete:hover { background: #EF4444; color: #ffffff; } .alert-success { padding: 12px 16px; background: #DCFCE7; color: #166534; border-radius: 8px; font-size: 13px; margin-bottom: 20px; border: 1px solid #BBF7D0; } /* ===== Premium Responsive UI ===== */ html,body{overflow-x:hidden} body{-webkit-tap-highlight-color:transparent} .admin-main{min-width:0} .table-container{width:100%;-webkit-overflow-scrolling:touch} .btn-delete,.admin-topbar a,.sidebar-menu a{min-height:42px} .btn-delete{display:inline-flex;align-items:center;justify-content:center;gap:6px} .export-btn{float:none!important;display:inline-flex!important;align-items:center;gap:7px;min-height:44px;box-shadow:0 6px 18px rgba(18,82,31,.12)} .page-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px} .page-head .page-title{margin:0} @media (max-width: 992px){ :root{--sidebar-width:250px} .admin-sidebar{transform:translateX(-100%);transition:transform .25s ease;box-shadow:12px 0 30px rgba(15,23,42,.18)} .admin-sidebar.open{transform:translateX(0)} .admin-main{margin-left:0;width:100%} .admin-topbar{height:auto;min-height:62px;padding:10px 18px} .admin-content{padding:22px 18px} .mobile-menu-btn{display:inline-flex!important} table{min-width:980px} } @media (min-width:993px){ .mobile-menu-btn{display:none!important} } @media (max-width:767px){ .admin-topbar{padding:10px 14px;gap:10px} .admin-topbar strong{font-size:14px;line-height:1.3} .admin-topbar a{font-size:12px!important;padding:9px 11px} .admin-content{padding:16px 12px} .page-head{align-items:flex-start;flex-direction:column;gap:10px} .page-title{font-size:20px;margin-bottom:0} .export-btn{width:100%;justify-content:center;margin-bottom:0!important} .alert-success{font-size:12px;padding:11px 12px;margin:12px 0} .table-container{ border-radius:12px; box-shadow:0 6px 22px rgba(15,23,42,.06); overflow-x:auto; scrollbar-width:thin; } table{font-size:12px;min-width:900px} th{padding:12px 13px;font-size:11.5px} td{padding:12px 13px;vertical-align:middle} .btn-delete{font-size:11px;padding:8px 10px} .sidebar-brand{padding:18px} } @media (max-width:380px){ .admin-topbar{padding:9px 10px} .admin-topbar strong{font-size:12.5px} .admin-topbar a{font-size:11px!important;padding:8px 9px} .admin-content{padding:13px 9px} .page-title{font-size:18px} .export-btn{font-size:12px;padding:10px} table{min-width:860px} th,td{padding:10px 11px} } @media (prefers-reduced-motion:reduce){ *,*::before,*::after{scroll-behavior:auto!important;transition:none!important} } </style> </head> <body> <!-- MAIN WRAPPER --> <div class="admin-main"> <header class="admin-topbar"> <button class="mobile-menu-btn" type="button" aria-label="Open menu" onclick="toggleSidebar()" style="display:none;border:0;background:#0F172A;color:#fff;width:42px;height:42px;border-radius:10px;align-items:center;justify-content:center;font-size:17px;cursor:pointer;"><i class="fas fa-bars"></i></button> <strong>Customer Enquiries & Bookings</strong> <a href="login.php?action=logout" style="color: #EF4444; text-decoration: none; font-weight: 600; font-size: 13px;">Logout</a> </header> <main class="admin-content"> <div class="page-head"> <h1 class="page-title">Received Queries</h1> <a class="export-btn" href="export-enquiries.php" style="float: right; background: #12521f; color: #fff; padding: 8px 15px; border-radius: 6px; text-decoration: none; font-size: 13px; font-weight: 600; margin-bottom: 15px;"> <i class="fas fa-file-excel"></i> Export to Excel </a> <?php if (isset($_GET['msg']) && $_GET['msg'] === 'deleted'): ?> <div class="alert-success">Enquiry deleted successfully!</div> <?php endif; ?> <div class="table-container"> <table> <thead> <tr> <th>#ID</th> <th>Name</th> <th>Phone</th> <th>Email</th> <th>Travel Date</th> <th>Pax</th> <th>Package</th> <th>Message</th> <th>Date</th> <th>Action</th> </tr> </thead> <tbody> <?php if (mysqli_num_rows($result) > 0): ?> <?php while ($row = mysqli_fetch_assoc($result)): ?> <tr> <td>#<?php echo $row['id']; ?></td> <td><strong><?php echo htmlspecialchars($row['name']); ?></strong></td> <td><?php echo htmlspecialchars($row['phone']); ?></td> <td><?php echo htmlspecialchars($row['email']); ?></td> <td><?php echo !empty($row['travel_date']) ? date('d M Y', strtotime($row['travel_date'])) : 'N/A'; ?></td> <td><?php echo htmlspecialchars($row['passengers'] ?? '1'); ?></td> <td><strong><?php echo htmlspecialchars($row['package'] ?? 'General Query'); ?></strong></td> <td><?php echo htmlspecialchars($row['message']); ?></td> <td><?php echo date('d M Y', strtotime($row['created_at'])); ?></td> <td> <a href="enquiries.php?delete_id=<?php echo $row['id']; ?>" class="btn-delete" onclick="return confirm('Are you sure you want to delete this enquiry?');"> <i class="fas fa-trash"></i> Delete </a> </td> </tr> <?php endwhile; ?> <?php else: ?> <tr> <td colspan="10" style="text-align: center; color: #94A3B8; padding: 25px;">No enquiries found yet.</td> </tr> <?php endif; ?> </tbody> </table> </div> </main> </div> <script> function toggleSidebar(){ var sidebar=document.querySelector('.admin-sidebar'); if(sidebar) sidebar.classList.toggle('open'); } document.addEventListener('click',function(e){ var sidebar=document.querySelector('.admin-sidebar'); var btn=document.querySelector('.mobile-menu-btn'); if(window.innerWidth<=992 && sidebar && sidebar.classList.contains('open') && !sidebar.contains(e.target) && !btn.contains(e.target)){ sidebar.classList.remove('open'); } }); </script> </body> </html>
Save
Cancel