📁 File Manager
Editing:
/home/wvl7mof7402e/public_html/remindyourdata.live/emply/visalist.php
<?php session_start(); include "dbconnect.php"; // Pagination $limit = 10; $page = isset($_GET['page']) ? (int)$_GET['page'] : 1; $offset = ($page - 1) * $limit; // Search $search = isset($_POST['search']) ? $_POST['search'] : (isset($_GET['search']) ? $_GET['search'] : ''); $search_query = !empty($search) ? "AND ja.passport_no LIKE '%$search%'" : ''; // Fetch data $sql = "SELECT vm.id, vm.visa_status, ja.name AS applicant_name, ja.passport_no, vm.visa_type, vm.visa_issue_date, vm.visa_expiry_date, vm.visa_upload, ja.job_country, ja.reference FROM visa_management vm JOIN job_applicants ja ON vm.applicant_id = ja.id WHERE 1=1 $search_query LIMIT $limit OFFSET $offset"; $result = $con->query($sql); // Count total for pagination $count_sql = "SELECT COUNT(vm.id) AS total FROM visa_management vm JOIN job_applicants ja ON vm.applicant_id = ja.id WHERE 1=1 $search_query"; $count_result = $con->query($count_sql); $total_rows = $count_result->fetch_assoc()['total']; $total_pages = ceil($total_rows / $limit); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Visa List</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> <style> body { background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%); font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; color: #222; min-height: 100vh; padding-bottom: 40px; } .logout-btn { position: fixed; top: 20px; right: 20px; z-index: 999; background-color: #e63946; color: white; padding: 10px 18px; border: none; border-radius: 8px; font-weight: 600; transition: background-color 0.3s ease; } .logout-btn:hover { background-color: #b22234; } h3 { font-size: 2.2rem; color: #1a237e; font-weight: 800; text-align: center; margin-bottom: 30px; text-shadow: 1px 1px 2px #c5cae9; } .form-control { border-radius: 10px; box-shadow: 0 2px 6px rgb(0 0 0 / 0.1); border: 1.5px solid #90caf9; transition: border-color 0.3s ease; } .form-control:focus { border-color: #0d47a1; box-shadow: 0 0 8px #0d47a1; outline: none; } .btn-primary { background-color: #1a237e; border: none; border-radius: 10px; font-weight: 700; padding: 10px 20px; transition: background-color 0.3s ease; } .btn-primary:hover { background-color: #0d1544; } .btn-success { background-color: #2e7d32; border-radius: 10px; font-weight: 600; padding: 8px 18px; } .btn-success:hover { background-color: #1b4d20; } .btn-info { background-color: #0288d1; border-radius: 10px; font-weight: 600; padding: 8px 18px; } .btn-info:hover { background-color: #01579b; } .table { border-radius: 12px; overflow: hidden; box-shadow: 0 8px 24px rgb(0 0 0 / 0.15); background: white; } .table thead { background: linear-gradient(90deg, #1a237e, #3949ab); color: white; font-weight: 700; font-size: 1rem; } .table th, .table td { text-align: center; vertical-align: middle; font-size: 0.95rem; padding: 12px 10px; } .table tbody tr:hover { background-color: #e8eaf6; } .table-responsive { border-radius: 12px; overflow-x: auto; } .pagination { justify-content: center; margin-top: 25px; } .pagination .page-item.active .page-link { background-color: #3949ab; color: white; border: none; box-shadow: 0 0 8px #3949ab; font-weight: 700; } .pagination .page-link { color: #3949ab; border-radius: 8px; margin: 0 4px; font-weight: 600; transition: background-color 0.3s ease; } .pagination .page-link:hover { background-color: #283593; color: white; } @media (max-width: 768px) { .logout-btn { top: 10px; right: 10px; padding: 8px 14px; font-size: 14px; } h3 { font-size: 1.6rem; margin-bottom: 20px; } .btn, .form-control { font-size: 14px; } .table th, .table td { font-size: 12px; padding: 8px 5px; } .btn-success, .btn-info { padding: 6px 12px; font-size: 13px; } .pagination .page-link { padding: 6px 10px; font-size: 13px; .table thead th span { font-weight: bold; letter-spacing: 0.5px; text-shadow: 0px 0px 1px rgba(0,0,0,0.1); font-size: 0.95rem; } .table tbody td { font-size: 0.93rem; font-weight: 500; color: #333; transition: background 0.3s ease; } .table tbody tr:hover td { background-color: #f1f8ff; color: #000; cursor: pointer; } } } </style> </head> <body> <!-- Logout Button --> <form action="logout.php" method="post"> <button class="logout-btn">Logout</button> </form> <div class="container mt-5"> <h3>Visa Management List</h3> <!-- Search --> <form method="POST" class="d-flex justify-content-center mb-4 flex-wrap gap-2"> <input type="text" name="search" class="form-control" placeholder="Search by Passport No" value="<?= htmlspecialchars($search) ?>" style="max-width: 300px;"> <button type="submit" class="btn btn-primary">Search</button> </form> <!-- Excel & Print Buttons --> <div class="text-end mb-3"> <button onClick="exportToExcel()" class="btn btn-success me-2">Export to Excel</button> <button onClick="window.print()" class="btn btn-info">Print</button> </div> <!-- Table --> <div class="table-responsive shadow-sm rounded"> <table class="table table-striped table-bordered mb-0"> <thead> <thead> <tr> <th><span style="color:#FFD700;">#</span></th> <th><span style="color:#4caf50;">👤 Name</span></th> <th><span style="color:#00bcd4;">🛂 Passport No</span></th> <th><span style="color:#673ab7;">📝 Visa Type</span></th> <th><span style="color:#f57c00;">📅 Issue Date</span></th> <th><span style="color:#f44336;">📅 Expiry Date</span></th> <th><span style="color:#009688;">🌍 Job Country</span></th> <th><span style="color:#3f51b5;">📞 Agent</span></th> <th><span style="color:#9c27b0;">📄 Document</span></th> </tr> </thead> <tbody> <?php if ($result->num_rows > 0): while ($row = $result->fetch_assoc()): ?> <tr> <td><?= $row['id'] ?></td> <td><?= htmlspecialchars($row['applicant_name']) ?></td> <td><?= htmlspecialchars($row['passport_no']) ?></td> <td><?= htmlspecialchars($row['visa_type']) ?></td> <td><?= htmlspecialchars($row['visa_issue_date']) ?></td> <td><?= htmlspecialchars($row['visa_expiry_date']) ?></td> <td><?= htmlspecialchars($row['job_country']) ?></td> <td><?= htmlspecialchars($row['reference']) ?></td> <td> <?php if ($row['visa_upload']): ?> <a href="<?= $row['visa_upload'] ?>" class="btn btn-primary btn-sm" download>Download</a> <?php else: ?> <span class="text-muted">No File</span> <?php endif; ?> </td> </tr> <?php endwhile; else: ?> <tr><td colspan="9" class="text-center">No records found.</td></tr> <?php endif; ?> </tbody> </table> </div> <!-- Pagination --> <nav> <ul class="pagination"> <?php for ($i = 1; $i <= $total_pages; $i++): ?> <li class="page-item <?= ($i == $page) ? 'active' : '' ?>"> <a class="page-link" href="?page=<?= $i ?>&search=<?= urlencode($search) ?>"><?= $i ?></a> </li> <?php endfor; ?> </ul> </nav> </div> <script> // Export to CSV function exportToExcel() { let table = document.querySelector("table"); let rows = table.querySelectorAll("tr"); let csv = []; rows.forEach(row => { let cells = row.querySelectorAll("th, td"); let rowData = []; cells.forEach(cell => rowData.push(cell.innerText.replace(/,/g, ""))); csv.push(rowData.join(",")); }); let csvFile = new Blob([csv.join("\n")], { type: "text/csv" }); let downloadLink = document.createElement("a"); downloadLink.href = URL.createObjectURL(csvFile); downloadLink.download = "visa_management_list.csv"; downloadLink.click(); } </script> </body> </html>
Save
Cancel