-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.html
More file actions
114 lines (110 loc) · 2.79 KB
/
Copy pathadmin.html
File metadata and controls
114 lines (110 loc) · 2.79 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Admin Portal - Certificate Overview</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
background: #f0f0f0;
}
h1 {
text-align: center;
margin-bottom: 10px;
}
.logout-container {
text-align: right;
margin-bottom: 20px;
}
.logout-btn {
padding: 8px 15px;
background: #ef4444;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
table {
width: 100%;
background: white;
border-collapse: collapse;
margin-top: 20px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
th, td {
padding: 12px;
border: 1px solid #ccc;
text-align: left;
}
th {
background-color: #4f46e5;
color: white;
}
button {
padding: 6px 12px;
border: none;
border-radius: 5px;
color: white;
cursor: pointer;
}
.approve-btn {
background-color: #10b981;
}
.reject-btn {
background-color: #ef4444;
}
</style>
</head>
<body>
<h1>Admin Portal - Certificate Overview</h1>
<div class="logout-container">
<button class="logout-btn" onclick="logout()">Logout</button>
</div>
<table>
<thead>
<tr>
<th>Student Name</th>
<th>Title</th>
<th>Description</th>
<th>Issue Date</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="certificateTableBody"></tbody>
</table>
<script>
let certificates = JSON.parse(localStorage.getItem("certificates") || "[]");
const tbody = document.getElementById("certificateTableBody");
function updateStatus(index, newStatus) {
if (newStatus === "Rejected") {
certificates.splice(index, 1);
} else {
certificates[index].status = newStatus;
}
localStorage.setItem("certificates", JSON.stringify(certificates));
location.reload();
}
certificates.forEach((cert, index) => {
const row = document.createElement("tr");
row.innerHTML = `
<td>${cert.name}</td>
<td>${cert.title}</td>
<td>${cert.description}</td>
<td>${cert.issueDate}</td>
<td>${cert.status || "Pending"}</td>
<td>
<button class="approve-btn" onclick="updateStatus(${index}, 'Approved')">Approve</button>
<button class="reject-btn" onclick="updateStatus(${index}, 'Rejected')">Reject</button>
</td>
`;
tbody.appendChild(row);
});
function logout() {
localStorage.removeItem("rememberedUser");
window.location.href = "login.html";
}
</script>
</body>
</html>