40 lines
1.6 KiB
PHP
40 lines
1.6 KiB
PHP
<?php
|
|
session_start();
|
|
require_once '../includes/db.php';
|
|
if (!isset($_SESSION['cid'])) { header("Location: register.php"); exit; }
|
|
|
|
$stmt = $pdo->prepare("SELECT * FROM leaves WHERE cid = ? ORDER BY start_date DESC");
|
|
$stmt->execute([$_SESSION['cid']]);
|
|
$leaves = $stmt->fetchAll();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="th">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>ข้อมูลวันลา</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;600&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="../assets/css/style.css">
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<h2>ข้อมูลวันลา</h2>
|
|
</div>
|
|
<div class="card" style="margin: 20px;">
|
|
<?php if (count($leaves) > 0): ?>
|
|
<?php foreach ($leaves as $leave): ?>
|
|
<div style="border-bottom: 1px solid #eee; padding: 10px 0;">
|
|
<strong>ประเภท:</strong> <?= htmlspecialchars($leave['leave_type']) ?><br>
|
|
<strong>วันที่:</strong> <?= $leave['start_date'] ?> ถึง <?= $leave['end_date'] ?><br>
|
|
<strong>สถานะ:</strong> <?= htmlspecialchars($leave['status']) ?>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<p style="text-align:center;">ไม่มีข้อมูลวันลา</p>
|
|
<?php endif; ?>
|
|
<br>
|
|
<a href="index.php" class="btn-magic" style="background: #ccc; color: #333;">กลับสู่เมนูหลัก</a>
|
|
</div>
|
|
</body>
|
|
</html>
|