-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
170 lines (144 loc) · 5.95 KB
/
index.php
File metadata and controls
170 lines (144 loc) · 5.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
session_start();
require_once 'backend/config.php';
$announcementFilter = ['status' => 'active'];
$announcements = $announcementCollection->find(
['status' => 'active'],
[
'limit' => 3,
'sort' => ['date' => -1]
]
);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>BMS</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<link rel="icon" type="image/png" href="assets/img/BMS.png">
<link rel="stylesheet" href="css/style.css?v=1" />
<link rel="stylesheet" href="css/toast.css">
</head>
<body>
<?php include 'includes/nav.php'; ?>
<!-- Hero Section -->
<section class="hero">
<h5>WELCOME TO</h5>
<h1 class="fw-bold">BARANGAY <span class="text-success">GUSA</span></h1>
<p>Gusa, Cagayan de Oro City</p>
<div class="mt-3">
<a href="contact.php" class="btn btn-light me-2">Contact Us</a>
<?php if (isset($_SESSION['email'])): ?>
<a href="pages/resident/resident_dashboard.php" class="btn btn-success">
My Account
</a>
<?php else: ?>
<a href="resident_login.php" class="btn btn-success">
Login Now
</a>
<?php endif; ?>
</div>
</section>
<!-- Services Section -->
<section class="py-5 text-center">
<div class="container">
<div class="row g-4">
<div class="col-md-4">
<div class="card card-custom p-4">
<img src="assets/img/officials.png" class="mx-auto mb-3" width="150" />
<h5>Barangay Officials</h5>
<a href="officials.php" class="btn btn-success mt-3">Learn More</a>
</div>
</div>
<div class="col-md-4">
<div class="card card-custom p-4">
<img src="assets/img/announcements.png" class="mx-auto mb-3" width="150" />
<h5>Announcements</h5>
<a href="announcement.php" class="btn btn-success mt-3">Learn More</a>
</div>
</div>
<div class="col-md-4">
<div class="card card-custom p-4">
<img src="assets/img/issuance.png" class="mx-auto mb-3" width="150" />
<h5>Issuance</h5>
<a href="issuance.php" class="btn btn-success mt-3">Learn More</a>
</div>
</div>
</div>
</div>
</section>
<!-- Announcements Section -->
<section class="py-5 bg-light">
<div class="container">
<h3 class="fw-bold mb-4">Recent <span class="text-success">Announcements</span></h3>
<div class="row g-4">
<?php foreach ($announcements as $item): ?>
<div class="col-md-4 d-flex">
<div class="card home-announce-card p-3 d-flex flex-column h-100 w-100">
<!-- Image -->
<?php if (!empty($item->image)): ?>
<img src="uploads/announcements/<?= $item->image ?>" class="mb-3 w-100 home-announce-img" />
<?php else: ?>
<img src="assets/img/announcement_placeholder.png" class="mb-3 w-100 home-announce-img" />
<?php endif; ?>
<!-- TEXT CONTENT -->
<div class="d-flex flex-column flex-grow-1 text-start">
<!-- DATE + TIME -->
<span class="badge bg-success mb-2 home-date">
<?= date("d M Y", strtotime($item->date)) ?>
<?= !empty($item->time) ? " | " . date("h:i A", strtotime($item->time)) : "" ?>
</span>
<?php if (!empty($item->location)): ?>
<div class="mb-2 text-secondary home-location">
<i class="bi bi-geo-alt-fill"></i>
<?= htmlspecialchars($item->location) ?>
</div>
<?php endif; ?>
<!-- TITLE -->
<h6 class="fw-bold mt-2 home-announce-title">
<?= htmlspecialchars($item->title) ?>
</h6>
<!-- DETAILS -->
<p class="home-announce-details flex-grow-1">
<?= strlen($item->details) > 80 ? substr($item->details, 0, 80) . "..." : htmlspecialchars($item->details) ?>
</p>
<!-- SEE MORE -->
<a href="see-more-announcement.php?id=<?= $item->_id ?>" class="text-success mt-auto">
See More
</a>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="text-center mt-4">
<a href="announcement.php" class="btn btn-success">View All Announcements</a>
</div>
</div>
</section>
<?php include('includes/footer.php'); ?>
<div id="toast" class="toast"></div>
<script>
function showToast(message, type = "error") {
const t = document.getElementById("toast");
// Reset classes (VERY IMPORTANT)
t.className = "toast";
t.textContent = message;
t.classList.add(type);
t.classList.add("show");
setTimeout(() => {
t.classList.remove("show");
}, 3000);
}
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<?php if (isset($_SESSION['toast'])): ?>
<script>
showToast("<?= $_SESSION['toast']['msg'] ?>", "<?= $_SESSION['toast']['type'] ?>");
</script>
<?php unset($_SESSION['toast'], $_SESSION['toast_type']); endif; ?>
</body>
</html>