141 lines
7.9 KiB
PHP
141 lines
7.9 KiB
PHP
<?php
|
|
require_once 'auth.php';
|
|
require_login('secretariat');
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>View Submission</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css">
|
|
</head>
|
|
<body class="bg-gray-100">
|
|
|
|
<nav class="bg-white shadow-md">
|
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
<div class="flex justify-between h-16">
|
|
<div class="flex">
|
|
<div class="flex-shrink-0 flex items-center">
|
|
<a href="index.php" class="text-2xl font-bold text-blue-600">SecurePort</a>
|
|
</div>
|
|
<div class="hidden sm:-my-px sm:ml-6 sm:flex sm:space-x-8">
|
|
<a href="dashboard.php" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Dashboard</a>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center">
|
|
<?php if (isset($_SESSION['user_id'])):
|
|
require_once 'auth.php';
|
|
?>
|
|
<span class="mr-4">Welcome, <?php echo htmlspecialchars($_SESSION['username']); ?>!</span>
|
|
<a href="logout.php" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:text-blue-600 hover:bg-gray-50">Logout</a>
|
|
<?php else: ?>
|
|
<a href="login.php" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:text-blue-600 hover:bg-gray-50">Login</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="container mx-auto px-6 py-8">
|
|
<?php
|
|
require_once 'db/config.php';
|
|
$pdo = db();
|
|
$submission_id = $_GET['id'] ?? null;
|
|
|
|
if ($submission_id) {
|
|
$stmt = $pdo->prepare("SELECT * FROM submissions WHERE id = ?");
|
|
$stmt->execute([$submission_id]);
|
|
$submission = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if ($submission) {
|
|
?>
|
|
<h1 class="text-3xl font-bold text-gray-800 mb-6">Submission Details</h1>
|
|
|
|
<div class="bg-white shadow-md rounded-lg p-6 mb-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 mb-4">Applicant Information</h2>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div><strong>Full Name:</strong> <?php echo htmlspecialchars($submission['full_name']); ?></div>
|
|
<div><strong>Email:</strong> <?php echo htmlspecialchars($submission['email']); ?></div>
|
|
<div><strong>National ID/Passport:</strong> <?php echo htmlspecialchars($submission['id_or_passport']); ?></div>
|
|
<div><strong>Gender:</strong> <?php echo htmlspecialchars($submission['gender']); ?></div>
|
|
<div><strong>Date of Birth:</strong> <?php echo htmlspecialchars($submission['dob']); ?></div>
|
|
<div><strong>Mobile Phone:</strong> <?php echo htmlspecialchars($submission['mobile_phone']); ?></div>
|
|
<div class="md:col-span-2"><strong>Address:</strong> <?php echo htmlspecialchars($submission['address']); ?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white shadow-md rounded-lg p-6 mb-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 mb-4">Visit Details</h2>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div><strong>Start Date:</strong> <?php echo htmlspecialchars($submission['start_date']); ?></div>
|
|
<div><strong>End Date:</strong> <?php echo htmlspecialchars($submission['end_date']); ?></div>
|
|
<div class="md:col-span-2"><strong>Purpose of Visit:</strong> <?php echo htmlspecialchars($submission['purpose_of_visit']); ?></div>
|
|
<div><strong>Visit Category:</strong> <?php echo htmlspecialchars($submission['visit_category']); ?></div>
|
|
<div><strong>Location:</strong> <?php echo htmlspecialchars($submission['location']); ?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white shadow-md rounded-lg p-6 mb-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 mb-4">Uploaded Documents</h2>
|
|
<div>
|
|
<strong>National ID/Passport Scan:</strong>
|
|
<a href="uploads/<?php echo htmlspecialchars($submission['id_scan']); ?>" target="_blank" class="text-blue-500 hover:text-blue-700">View Document</a>
|
|
</div>
|
|
<?php if (!empty($submission['official_letter_scan'])) : ?>
|
|
<div>
|
|
<strong>Official Letter/Memo:</strong>
|
|
<a href="uploads/<?php echo htmlspecialchars($submission['official_letter_scan']); ?>" target="_blank" class="text-blue-500 hover:text-blue-700">View Document</a>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="bg-white shadow-md rounded-lg p-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 mb-4">Visitors</h2>
|
|
<?php
|
|
$visitor_stmt = $pdo->prepare("SELECT * FROM visitors WHERE submission_id = ?");
|
|
$visitor_stmt->execute([$submission_id]);
|
|
while ($visitor = $visitor_stmt->fetch(PDO::FETCH_ASSOC)) {
|
|
?>
|
|
<div class="border-b pb-4 mb-4">
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div><strong>Full Name:</strong> <?php echo htmlspecialchars($visitor['full_name']); ?></div>
|
|
<div><strong>National ID/Passport:</strong> <?php echo htmlspecialchars($visitor['id_or_passport']); ?></div>
|
|
<div><strong>Mobile Phone:</strong> <?php echo htmlspecialchars($visitor['mobile_phone']); ?></div>
|
|
<div><strong>Address:</strong> <?php echo htmlspecialchars($visitor['address']); ?></div>
|
|
<div>
|
|
<strong>ID Scan:</strong>
|
|
<a href="uploads/<?php echo htmlspecialchars($visitor['id_scan']); ?>" target="_blank" class="text-blue-500 hover:text-blue-700">View Document</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<div class="bg-white shadow-md rounded-lg p-6 mt-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 mb-4">Secretariat Action</h2>
|
|
<form action="update_status.php" method="POST">
|
|
<input type="hidden" name="submission_id" value="<?php echo $submission['id']; ?>">
|
|
<div class="flex space-x-4">
|
|
<button type="submit" name="status" value="Approved" class="px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600">Approve</button>
|
|
<button type="submit" name="status" value="Rejected" class="px-4 py-2 bg-red-500 text-white rounded-md hover:bg-red-600">Reject</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<?php
|
|
} else {
|
|
echo "<p class='text-red-500'>Submission not found.</p>";
|
|
}
|
|
} else {
|
|
echo "<p class='text-red-500'>No submission ID provided.</p>";
|
|
}
|
|
?>
|
|
</main>
|
|
|
|
</body>
|
|
</html>
|