-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreserved-items.html
93 lines (86 loc) · 3.81 KB
/
reserved-items.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reserved Items</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
.reserved-items-container {
margin-top: 50px;
}
.username-display {
margin-bottom: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container-fluid">
<a class="navbar-brand" href="#">Admin Dashboard</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="admin_dashboard.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Settings</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="reserved-items.html">Reserved Items</a>
</li>
<li class="nav-item">
<a class="nav-link" href="admin_login.html">Logout</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container reserved-items-container">
<!-- Username Display -->
<div id="usernameDisplay" class="username-display"></div>
<h2>Reserved Items</h2>
<ul id="reservedItemsList" class="list-group">
<!-- Reserved items will be displayed here -->
</ul>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Retrieve the username from localStorage
localStorage.setItem('username',' john');
const username = localStorage.getItem('username') || "Guest";
// Display the username
const usernameDisplay = document.getElementById('usernameDisplay');
usernameDisplay.textContent = `Welcome, ${username}!`;
// Retrieve reserved items from localStorage
const reservedItems = JSON.parse(localStorage.getItem('reservedItems')) || [];
const reservedItemsList = document.getElementById('reservedItemsList');
// Check if there are any reserved items
if (reservedItems.length > 0) {
// Display each reserved item in the list
reservedItems.forEach(item => {
const li = document.createElement('li');
li.textContent = `${item.item}: ${item.quantity} item(s) - Rs${(item.quantity * item.price).toFixed(2)}`;
li.classList.add('list-group-item');
reservedItemsList.appendChild(li);
});
} else {
// Display a message if no items are reserved
const li = document.createElement('li');
li.textContent = "No items have been reserved.";
li.classList.add('list-group-item');
reservedItemsList.appendChild(li);
}
});
</script>
</body>
</html>