-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin.html
407 lines (370 loc) · 16 KB
/
admin.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
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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<style>
:root {
--main-bg-color: #009d63;
--main-text-color: #009d63;
--second-text-color: #bbbec5;
--second-bg-color: #c1efde;
}
.primary-text {
color: var(--main-text-color);
}
.second-text {
color: var(--second-text-color);
}
.primary-bg {
background-color: var(--main-bg-color);
}
.secondary-bg {
background-color: var(--second-bg-color);
}
.rounded-full {
border-radius: 100%;
}
#wrapper {
overflow-x: hidden;
background-image: linear-gradient(
to right,
#baf3d7,
#c2f5de,
#cbf7e4,
#d4f8ea,
#ddfaef
);
}
#sidebar-wrapper {
min-height: 100vh;
margin-left: -15rem;
-webkit-transition: margin 0.25s ease-out;
-moz-transition: margin 0.25s ease-out;
-o-transition: margin 0.25s ease-out;
transition: margin 0.25s ease-out;
}
#sidebar-wrapper .sidebar-heading {
padding: 0.875rem 1.25rem;
font-size: 1.2rem;
}
#sidebar-wrapper .list-group {
width: 15rem;
}
#page-content-wrapper {
min-width: 100vw;
}
#wrapper.toggled #sidebar-wrapper {
margin-left: 0;
}
#menu-toggle {
cursor: pointer;
}
.list-group-item {
border: none;
padding: 20px 30px;
}
.list-group-item.active {
background-color: transparent;
color: var(--main-text-color);
font-weight: bold;
border: none;
}
@media (min-width: 768px) {
#sidebar-wrapper {
margin-left: 0;
}
#page-content-wrapper {
min-width: 0;
width: 100%;
}
#wrapper.toggled #sidebar-wrapper {
margin-left: -15rem;
}
}
</style>
<title>Admin Dashboard</title>
</head>
<body>
<div class="d-flex" id="wrapper">
<!-- Sidebar -->
<div class="bg-white" id="sidebar-wrapper">
<div class="sidebar-heading text-center py-4 primary-text fs-4 fw-bold text-uppercase border-bottom"><i
class="fas fa-user-secret me-2"></i>YUMMY PLATES</div>
<div class="list-group list-group-flush my-3">
<a href="#" class="list-group-item list-group-item-action bg-transparent second-text active"><i
class="fas fa-tachometer-alt me-2"></i>Dashboard</a>
<a href="#" class="list-group-item list-group-item-action bg-transparent second-text fw-bold"><i
class="fas fa-project-diagram me-2"></i>Projects</a>
<a href="#" class="list-group-item list-group-item-action bg-transparent second-text fw-bold"><i
class="fas fa-chart-line me-2"></i>Analytics</a>
<a href="#" class="list-group-item list-group-item-action bg-transparent second-text fw-bold"><i
class="fas fa-paperclip me-2"></i>Reports</a>
<a href="#" class="list-group-item list-group-item-action bg-transparent second-text fw-bold"><i
class="fas fa-shopping-cart me-2"></i>Store Mng</a>
<a href="#" class="list-group-item list-group-item-action bg-transparent second-text fw-bold"><i
class="fas fa-gift me-2"></i>Products</a>
<a href="#" class="list-group-item list-group-item-action bg-transparent second-text fw-bold"><i
class="fas fa-comment-dots me-2"></i>Chat</a>
<a href="#" class="list-group-item list-group-item-action bg-transparent second-text fw-bold"><i
class="fas fa-map-marker-alt me-2"></i>Outlet</a>
<a href="#" class="list-group-item list-group-item-action bg-transparent text-danger fw-bold"><i
class="fas fa-power-off me-2" id="Logout"></i>Logout</a>
</div>
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<nav class="navbar navbar-expand-lg navbar-light bg-transparent py-4 px-4">
<div class="d-flex align-items-center">
<i class="fas fa-align-left primary-text fs-4 me-3" id="menu-toggle"></i>
<h2 class="fs-2 m-0">Dashboard</h2>
</div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle second-text fw-bold" href="#" id="navbarDropdown"
role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fas fa-user me-2"></i>Admin
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="#">Profile</a></li>
<li><a class="dropdown-item" href="#">Settings</a></li>
<li><a class="dropdown-item" href="#">Logout</a></li>
</ul>
</li>
</ul>
</div>
</nav>
<div class="container-fluid px-4">
<div class="row g-3 my-2">
<div class="col-md-3">
<div class="p-3 bg-white shadow-sm d-flex justify-content-around align-items-center rounded">
<div>
<h3 class="fs-2" id="pd">720</h3>
<p class="fs-5">Products</p>
</div>
<i class="fas fa-gift fs-1 primary-text border rounded-full secondary-bg p-3"></i>
</div>
</div>
<div class="col-md-3">
<div class="p-3 bg-white shadow-sm d-flex justify-content-around align-items-center rounded">
<div>
<h3 class="fs-2" id="sales">4920</h3>
<p class="fs-5">Sales</p>
</div>
<i
class="fas fa-hand-holding-usd fs-1 primary-text border rounded-full secondary-bg p-3"></i>
</div>
</div>
<div class="col-md-3">
<div class="p-3 bg-white shadow-sm d-flex justify-content-around align-items-center rounded">
<div>
<h3 class="fs-2" id="deliver">3899</h3>
<p class="fs-5" >Delivery</p>
</div>
<i class="fas fa-truck fs-1 primary-text border rounded-full secondary-bg p-3"></i>
</div>
</div>
<div class="col-md-3">
<div class="p-3 bg-white shadow-sm d-flex justify-content-around align-items-center rounded">
<div>
<h3 class="fs-2">%25</h3>
<p class="fs-5">Increase</p>
</div>
<i class="fas fa-chart-line fs-1 primary-text border rounded-full secondary-bg p-3"></i>
</div>
</div>
</div>
<div class="row my-5">
<h3 class="fs-4 mb-3">Customer Details</h3>
<div class="col">
<table class="table bg-white rounded shadow-sm table-hover">
<thead>
<tr>
<th scope="col" width="50">#</th>
<th scope="col">Email</th>
<th scope="col">Password</th>
<th scope="col">Add To Cart</th>
<th scope="col">ATC Total Price</th>
<th scope="col">Order Details</th>
<th scope="col">OD Total Price</th>
<!-- <th scope="col">Delete</th> -->
</tr>
</thead>
<tbody>
<tr>
<th scope="row"></th>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<!-- <tr>
<th scope="row">2</th>
<td>Laptop</td>
<td>Kenny</td>
<td>$750</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Cell Phone</td>
<td>Jenny</td>
<td>$600</td>
</tr>
<tr>
<th scope="row">4</th>
<td>Fridge</td>
<td>Killy</td>
<td>$300</td>
</tr>
<tr>
<th scope="row">5</th>
<td>Books</td>
<td>Filly</td>
<td>$120</td>
</tr>
<tr>
<th scope="row">6</th>
<td>Gold</td>
<td>Bumbo</td>
<td>$1800</td>
</tr>
<tr>
<th scope="row">7</th>
<td>Pen</td>
<td>Bilbo</td>
<td>$75</td>
</tr>
<tr>
<th scope="row">8</th>
<td>Notebook</td>
<td>Frodo</td>
<td>$36</td>
</tr>
<tr>
<th scope="row">9</th>
<td>Dress</td>
<td>Kimo</td>
<td>$255</td>
</tr>
<tr>
<th scope="row">10</th>
<td>Paint</td>
<td>Zico</td>
<td>$434</td>
</tr>
<tr>
<th scope="row">11</th>
<td>Carpet</td>
<td>Jeco</td>
<td>$1236</td>
</tr>
<tr>
<th scope="row">12</th>
<td>Food</td>
<td>Haso</td>
<td>$422</td>
</tr> -->
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
var sales = 0;
var Delivery = 0;
var cart = 0;
var el = document.getElementById("wrapper");
var toggleButton = document.getElementById("menu-toggle");
toggleButton.onclick = function () {
el.classList.toggle("toggled");
};
let AdminData ;
let tbody = document.querySelector('tbody')
fetch('https://63ca391fd0ab64be2b4e8c76.mockapi.io/LoginCredientials').then((res)=>res.json()).then((a)=>{
console.log(a);
AdminData = a;
AdminData.forEach((element,index) => {
let tr = document.createElement("tr");
let td1 = document.createElement("td");
let td2 = document.createElement("td");
let td3 = document.createElement("td");
let td4 = document.createElement("td");
let td5 = document.createElement("td");
let td6 = document.createElement("td");
let td7 = document.createElement("td");
let td8 = document.createElement("td");
td1.textContent = element.email;
td2.textContent = element.password;
td3.textContent = element.AddtoCart.length || 0;
if(td3.textContent == 0){
td6.textContent = 0;
}else{
let c = 0;
element.AddtoCart.forEach((ele)=>{
c+=+ele.price.trim()
})
td6.textContent = c;
cart+=element.AddtoCart.length;
}
td4.textContent = element.OrderDetails.length || 0;
if(td4.textContent == 0){
td7.textContent = 0;
}else{
let c = 0;
element.OrderDetails.forEach((ele)=>{
c+=+ele.price
})
td7.textContent = c;
sales+=c;
Delivery+=element.OrderDetails.length;
}
td5.textContent = index+1;
td4.textContent = 0;
//console.log(index)
td8.textContent = "DELETE";
td8.addEventListener("click",()=>{
alert("del")
console.log(element.id)
let id = +element.id;
fetch(`https://63ca391fd0ab64be2b4e8c76.mockapi.io/LoginCredientials/{id}`,{
method: 'DELETE',
// headers: {
// 'Content-type': 'application/json'
// }
}).then(()=>{
// window.location.href="admin.html";
})
})
tr.append(td5,td1,td2,td3,td6,td4,td7);
tbody.append(tr)
});
let sal = document.getElementById("sales");
sal.textContent = sales
document.getElementById("deliver").textContent = Delivery;
document.getElementById("pd").textContent = cart;
}
)
let Logout = document.getElementById("Logout");
console.log(Logout)
Logout.addEventListener("click",()=>{
//alert("hey")
window.location.href = "index.html"
})
</script>
</body>
</html>