-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.html
198 lines (180 loc) · 8.15 KB
/
dashboard.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard - Bike Website</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/dashboard.css">
</head>
<body class="dashboard-page">
<nav class="dashboard-sidebar">
<div class="sidebar-header">
<img src="image/logo.png" alt="Bike Shop Logo" class="logo">
<h2>Bike Shop</h2>
</div>
<ul class="sidebar-menu">
<li><a href="#" data-section="overview" class="active"><i class="fas fa-tachometer-alt"></i> Overview</a></li>
<li><a href="order.html" data-section="orders"><i class="fas fa-shopping-cart"></i> Orders</a></li>
<li><a href="#" data-section="orderItems"><i class="fas fa-box-open"></i> Order Items</a></li>
<li><a href="profile-edit.html" data-section="profile"><i class="fas fa-user"></i> Profile</a></li>
<li><a href="#" data-section="settings"><i class="fas fa-cog"></i> Settings</a></li>
<li><a href="#" data-section="orderDetails"><i class="fas fa-dolly"></i> Order Details</a></li>
<li><a href="order.html"><i class="fas fa-list-alt"></i> Order History</a></li>
</ul>
<div class="sidebar-footer">
<a href="index.html"><i class="fas fa-home"></i> Home</a>
<a href="#" id="logoutBtn"><i class="fas fa-sign-out-alt"></i> Logout</a>
</div>
</nav>
<main class="dashboard-main">
<header class="dashboard-header">
<div class="header-search">
<input type="text" placeholder="Search...">
<i class="fas fa-search"></i>
</div>
<div class="header-user">
<img src="image/user-avatar.png" alt="User Avatar" class="user-avatar">
<span id="username">John Doe</span>
</div>
</header>
<div class="dashboard-content">
<section id="overview" class="dashboard-section active">
<h2>Overview</h2>
<div class="dashboard-cards">
<div class="card">
<i class="fas fa-shopping-bag"></i>
<div class="card-content">
<h3>Total Orders</h3>
<p class="card-value" id="totalOrders">0</p>
</div>
</div>
<div class="card">
<i class="fas fa-dollar-sign"></i>
<div class="card-content">
<h3>Total Spent</h3>
<p class="card-value" id="totalSpent">$0</p>
</div>
</div>
<div class="card">
<i class="fas fa-bicycle"></i>
<div class="card-content">
<h3>Favorite Product</h3>
<p class="card-value" id="favoriteProduct">N/A</p>
</div>
</div>
</div>
<div class="recent-activity">
<h3>Recent Activity</h3>
<ul id="activityList">
<!-- Activity items will be populated here -->
</ul>
</div>
</section>
<section id="orders" class="dashboard-section">
<h2>Your Orders</h2>
<table id="ordersTable">
<thead>
<tr>
<th>Order ID</th>
<th>Date</th>
<th>Total</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<!-- Orders will be populated here -->
</tbody>
</table>
</section>
<section id="orderItems" class="dashboard-section">
<h2>Order Items</h2>
<div class="order-items-controls">
<input type="text" id="searchInput" placeholder="Search items...">
<select id="sortSelect">
<option value="name">Sort by Name</option>
<option value="price-asc">Price: Low to High</option>
<option value="price-desc">Price: High to Low</option>
</select>
</div>
<div class="order-items-container">
<!-- Order items will be populated here -->
</div>
</section>
<section id="profile" class="dashboard-section">
<h2>Your Profile</h2>
<div id="profile-info"></div>
<a href="profile-edit.html" class="btn btn-primary">Edit Profile</a>
</section>
<section id="settings" class="dashboard-section">
<h2>Settings</h2>
<div class="form-group">
<label for="darkMode">Dark Mode</label>
<div class="toggle-switch">
<input type="checkbox" id="darkMode" name="darkMode">
<label for="darkMode" class="toggle-label"></label>
</div>
</div>
</section>
<section id="orderDetails" class="dashboard-section">
<h2>Order Details</h2>
<div id="orderInfo"></div>
<div id="trackingInfo">
<h3>Order Tracking</h3>
<ul id="trackingList" class="tracking-list"></ul>
</div>
</section>
</div>
</main>
<button id="darkModeToggle" onclick="toggleDarkMode()">Toggle Dark Mode</button>
<script src="js/dashboard.js"></script>
<script src="js/darkmode.js"></script>
<script>
function loadOrderHistory() {
const ordersTable = document.getElementById('ordersTable').getElementsByTagName('tbody')[0];
const orders = JSON.parse(localStorage.getItem('orders')) || [];
ordersTable.innerHTML = ''; // Clear existing rows
orders.forEach(order => {
const row = ordersTable.insertRow();
row.innerHTML = `
<td>${order.id}</td>
<td>${order.date}</td>
<td>$${order.total.toFixed(2)}</td>
<td>${order.status}</td>
<td><button onclick="viewOrderDetails('${order.id}')">View Details</button></td>
`;
});
// Update total orders in the overview
updateTotalOrders(orders.length);
}
function updateTotalOrders(count) {
const totalOrdersElement = document.getElementById('totalOrders');
totalOrdersElement.textContent = count;
}
function viewOrderDetails(orderId) {
// Implement this function to show order details
console.log(`Viewing details for order ${orderId}`);
// You can navigate to a new page or show a modal with order details
}
// Function to check for new orders
function checkForNewOrders() {
const orders = JSON.parse(localStorage.getItem('orders')) || [];
updateTotalOrders(orders.length);
}
document.addEventListener('DOMContentLoaded', () => {
loadOrderHistory();
// Check for new orders every 5 seconds
setInterval(checkForNewOrders, 5000);
});
// Listen for storage events to update in real-time across tabs
window.addEventListener('storage', (event) => {
if (event.key === 'orders') {
loadOrderHistory();
}
});
</script>
</body>
</html>