82 lines
3.5 KiB
PHP
82 lines
3.5 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
require_once 'header.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->query("SELECT * FROM beasiswa ORDER BY deadline DESC");
|
|
$beasiswa_list = $stmt->fetchAll();
|
|
} catch (PDOException $e) {
|
|
// For development, show error. In production, log it.
|
|
error_log("Database error: " . $e->getMessage());
|
|
$beasiswa_list = [];
|
|
}
|
|
?>
|
|
|
|
<main class="container py-5">
|
|
<div class="row mb-4">
|
|
<div class="col">
|
|
<h1 class="text-center text-dark-blue">Daftar Beasiswa</h1>
|
|
<p class="text-center text-muted">Temukan peluang beasiswa yang sesuai dengan minat dan kualifikasimu.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filter Section -->
|
|
<div class="row mb-5">
|
|
<div class="col-md-4">
|
|
<input type="text" class="form-control" placeholder="Cari beasiswa...">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<select class="form-select">
|
|
<option selected>Semua Jenjang</option>
|
|
<option value="sma">SMA/SMK</option>
|
|
<option value="d3">D3</option>
|
|
<option value="s1">S1</option>
|
|
<option value="s2">S2</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<select class="form-select">
|
|
<option selected>Urutkan Berdasarkan</option>
|
|
<option value="deadline">Deadline Terdekat</option>
|
|
<option value="terbaru">Paling Baru</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<button class="btn btn-primary w-100" style="background-color: #0D47A1;">Filter</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Scholarship Cards -->
|
|
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
|
|
<?php if (empty($beasiswa_list)): ?>
|
|
<div class="col">
|
|
<p class="text-center">Belum ada data beasiswa yang tersedia.</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($beasiswa_list as $beasiswa): ?>
|
|
<div class="col">
|
|
<div class="card h-100 shadow-sm border-light">
|
|
<div class="card-body">
|
|
<h5 class="card-title text-dark-blue"><?php echo htmlspecialchars($beasiswa['title']); ?></h5>
|
|
<h6 class="card-subtitle mb-2 text-muted"><?php echo htmlspecialchars($beasiswa['organizer']); ?></h6>
|
|
<p class="card-text small"><?php echo htmlspecialchars(substr($beasiswa['description'], 0, 100)) . '...'; ?></p>
|
|
</div>
|
|
<div class="card-footer bg-transparent border-top-0">
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<span class="badge bg-<?php echo $beasiswa['status'] == 'Open' ? 'success' : 'danger'; ?>">
|
|
<?php echo htmlspecialchars($beasiswa['status']); ?>
|
|
</span>
|
|
<small class="text-muted">Deadline: <?php echo date('d M Y', strtotime($beasiswa['deadline'])); ?></small>
|
|
</div>
|
|
<a href="<?php echo htmlspecialchars($beasiswa['link']); ?>" class="btn btn-outline-primary btn-sm mt-3 w-100" target="_blank">Lihat Detail</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</main>
|
|
|
|
<?php require_once 'footer.php'; ?>
|