<?php
// Start session
session_start();

// Database connection
include 'db.php';

// Redirect to login if user is not logged in
if (!isset($_SESSION['user'])) {
    header("Location: login.php");
    exit;
}

// Store user data
$user = $_SESSION['user'];

// Success message (if any)
$success = $_SESSION['success'] ?? '';
unset($_SESSION['success']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard - ICMR-NIRRCH</title>
<link rel="icon" href="assets/img/logo.png" type="image/png">
<link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

<style>
body {
    padding-top: 80px;
    font-family: "Noto Sans", sans-serif;
    background-color: #f8f9fa;
}
</style>
</head>

<body class="container mt-5">

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

<?php if ($success): ?>
<div class="alert alert-success">
    <?= $success ?>
</div>
<?php endif; ?>

<div class="card shadow-sm p-4">
    <h3>Welcome, <?= htmlspecialchars($user['full_name']); ?>!</h3>

    <div class="mt-4">
        <a href="fill-application.php" class="btn btn-primary me-2">Fill Application</a>
	<a href="userprint.php" class="btn btn-info me-2">
	    Print Application
	</a>


        <a href="logout.php" class="btn btn-danger">Logout</a>
    </div>
</div>

<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
</body>
</html>
