-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadminPosts.html
More file actions
310 lines (306 loc) · 10.3 KB
/
adminPosts.html
File metadata and controls
310 lines (306 loc) · 10.3 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin Posts | KrishiSeba</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
background: linear-gradient(270deg, #ffffff 50%, #a8e063 100%);
min-height: 100vh;
font-family: 'Segoe UI', Arial, sans-serif;
}
.container {
display: flex;
min-height: 100vh;
}
.sidebar {
width: 240px;
background: #388e3c;
color: #fff;
padding: 40px 0 0 0;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 2px 0 18px rgba(56,142,60,0.08);
}
.sidebar h2 {
margin-bottom: 30px;
font-size: 1.7em;
letter-spacing: 1px;
display: flex;
align-items: center;
gap: 10px;
}
.sidebar-logo {
width: 38px;
height: 38px;
border-radius: 50%;
}
.sidebar-nav {
display: flex;
flex-direction: column;
width: 100%;
margin-top: 20px;
}
.sidebar-nav a {
padding: 16px 40px;
color: #fff;
text-decoration: none;
font-weight: 600;
font-size: 1.08em;
border-left: 4px solid transparent;
transition: background 0.2s, color 0.2s;
}
.sidebar-nav a.active,
.sidebar-nav a:hover {
background: #2e7031;
color: #a8e063;
border-left: 4px solid #a8e063;
}
.main-content {
flex: 1;
padding: 48px 40px 32px 40px;
margin-left: 240px;
}
.dashboard-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 36px;
}
.dashboard-header h1 {
font-size: 2em;
color: #032433;
font-weight: 800;
letter-spacing: 1px;
}
.search-box {
margin-bottom: 24px;
}
.search-box input {
padding: 10px 18px;
border-radius: 8px;
border: 1px solid #b2dfdb;
font-size: 1em;
width: 260px;
}
table {
width: 100%;
border-collapse: collapse;
background: #fff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 18px rgba(56,142,60,0.10);
}
th, td {
padding: 14px 18px;
text-align: left;
}
th {
background: #388e3c;
color: #fff;
font-weight: 700;
}
tr:nth-child(even) {
background: #f6fff6;
}
tr:hover {
background: #e8f5e9;
}
.action-btn {
color: #fff;
border: none;
border-radius: 6px;
padding: 7px 16px;
font-size: 0.98em;
cursor: pointer;
margin-right: 6px;
transition: background 0.2s;
}
.action-btn.approve-btn {
background: #43a047;
position: relative;
transition: background 0.2s, box-shadow 0.2s;
}
.action-btn.approve-btn:before {
content: "✔";
margin-right: 7px;
font-weight: bold;
}
.action-btn.approve-btn:active {
background: #66bb6a;
box-shadow: 0 0 8px #a8e063;
}
.action-btn.delete-btn {
background: #e53935;
transition: background 0.2s, box-shadow 0.2s;
}
.action-btn.delete-btn:before {
content: "🗑";
margin-right: 7px;
}
.action-btn.delete-btn:active {
background: #ff5252;
box-shadow: 0 0 8px #e57373;
}
.toast {
position: fixed;
bottom: 32px;
right: 32px;
background: #323232;
color: #fff;
padding: 14px 28px;
border-radius: 8px;
font-size: 1.1em;
opacity: 0;
pointer-events: none;
z-index: 9999;
transition: opacity 0.4s;
}
.toast.show {
opacity: 1;
pointer-events: auto;
}
.fade-out {
animation: fadeOutRow 0.7s forwards;
}
@keyframes fadeOutRow {
to { opacity: 0; height: 0; padding: 0; margin: 0; }
}
@media (max-width: 900px) {
.main-content { padding: 18px 4px; margin-left: 0;}
.sidebar { width: 100%; height: auto; flex-direction: row; padding: 18px 0;}
.sidebar-nav { flex-direction: row; justify-content: center;}
.sidebar-nav a { padding: 12px 18px; font-size: 1em;}
}
@media (max-width: 600px) {
.dashboard-header h1 { font-size: 1.2em;}
.main-content { padding: 10px;}
.sidebar h2 { font-size: 1.1em;}
table, th, td { font-size: 0.95em;}
}
</style>
</head>
<body>
<div class="container">
<!-- Sidebar -->
<aside class="sidebar">
<h2>
<img src="1.jpg" alt="Logo" class="sidebar-logo">
Admin Panel
</h2>
<nav class="sidebar-nav">
<a href="AdminDashboard.html" data-section="dashboard">Dashboard</a>
<a href="adminUsers.html" data-section="users">Users</a>
<a href="adminPosts.html" class="active" data-section="posts">Posts</a>
<a href="adminReports.html" data-section="reports">Reports</a>
<a href="adminSettings.html" data-section="settings">Settings</a>
<a href="loginForAdmin.html" data-section="logout">Logout</a>
</nav>
</aside>
<!-- Main Content -->
<div class="main-content">
<div class="dashboard-header">
<h1>Manage Posts</h1>
</div>
<div class="search-box">
<input type="text" id="searchInput" placeholder="Search posts by title or author...">
</div>
<table id="postsTable">
<thead>
<tr>
<th>#</th>
<th>Title</th>
<th>Author</th>
<th>Status</th>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Modern Rice Cultivation</td>
<td>Rahim Uddin</td>
<td class="status">Pending</td>
<td>2025-07-30</td>
<td>
<button class="action-btn approve-btn">Approve</button>
<button class="action-btn delete-btn" style="background:#e53935;">Delete</button>
</td>
</tr>
<tr>
<td>2</td>
<td>Organic Fertilizer Tips</td>
<td>Karim Mia</td>
<td class="status">Approved</td>
<td>2025-07-28</td>
<td>
<button class="action-btn approve-btn" disabled>Approve</button>
<button class="action-btn delete-btn" style="background:#e53935;">Delete</button>
</td>
</tr>
<tr>
<td>3</td>
<td>Safe Pesticide Use</td>
<td>Shila Akter</td>
<td class="status">Pending</td>
<td>2025-07-25</td>
<td>
<button class="action-btn approve-btn">Approve</button>
<button class="action-btn delete-btn" style="background:#e53935;">Delete</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="toast" class="toast"></div>
<script>
// Sidebar active state
document.querySelectorAll('.sidebar-nav a').forEach(function(item) {
item.addEventListener('click', function() {
document.querySelectorAll('.sidebar-nav a').forEach(a => a.classList.remove('active'));
this.classList.add('active');
});
});
// Post search filter
document.getElementById('searchInput').addEventListener('keyup', function() {
const filter = this.value.toLowerCase();
const rows = document.querySelectorAll('#postsTable tbody tr');
rows.forEach(row => {
const text = row.textContent.toLowerCase();
row.style.display = text.includes(filter) ? '' : 'none';
});
});
// Toast notification
function showToast(msg) {
const toast = document.getElementById('toast');
toast.textContent = msg;
toast.classList.add('show');
setTimeout(() => toast.classList.remove('show'), 2000);
}
// Approve button
document.querySelectorAll('.approve-btn').forEach(function(btn) {
btn.addEventListener('click', function() {
const row = this.closest('tr');
row.querySelector('.status').textContent = 'Approved';
this.disabled = true;
showToast('Post approved!');
});
});
// Delete button with fade-out
document.querySelectorAll('.delete-btn').forEach(function(btn) {
btn.addEventListener('click', function() {
if (confirm('Are you sure you want to delete this post?')) {
const row = this.closest('tr');
row.classList.add('fade-out');
setTimeout(() => row.remove(), 700);
showToast('Post deleted!');
}
});
});
</script>
</body>
</html>