-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhistory.html
More file actions
45 lines (43 loc) · 1.39 KB
/
history.html
File metadata and controls
45 lines (43 loc) · 1.39 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Order History</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" rel="stylesheet" />
<link href="assets/styles.css" rel="stylesheet" />
</head>
<body class="bg-light">
<nav class="navbar navbar-dark bg-dark mb-4 px-4">
<span class="navbar-brand">📦 Order History</span>
<a href="index.html" class="btn btn-outline-light btn-sm">Dashboard</a>
</nav>
<div class="container">
<table class="table table-striped" id="history-table">
<thead class="table-dark">
<tr>
<th>ID</th>
<th>Date</th>
<th>Total (AUD)</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<script>
fetch("https://workshop-order.onrender.com/api/history")
.then(r => r.json())
.then(data => {
const tbody = document.querySelector('#history-table tbody');
data.forEach(o => {
tbody.innerHTML += `<tr>
<td>${o.id}</td>
<td>${o.date}</td>
<td>$${o.total.toFixed(2)}</td>
</tr>`;
});
});
</script>
</body>
</html>