forked from neelmani0/internal-mark-2946
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdminorder.js
55 lines (44 loc) · 1.62 KB
/
Adminorder.js
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
let cartdata = JSON.parse(localStorage.getItem("cartdata")) || [];
let checkoutData = JSON.parse(localStorage.getItem("checkoutdata"))||[];
console.log(cartdata)
console.log(checkoutData)
let tbody = document.querySelector("#t1")
let tbody2 = document.querySelector("#t2")
dataappend(cartdata)
checkoutappend(checkoutData)
function dataappend(array) {
tbody.innerHTML = "";
array.forEach(element => {
let row = document.createElement("tr");
row.style.backgroundColor = "lightyellow";
row.style.color = "darkblack"
let c1 = document.createElement("td");
let c2 = document.createElement("td");
let c3 = document.createElement("td");
let c4 = document.createElement("td");
c1.innerText = element.id;
c2.innerText = element.name
c3.innerText = element.qty;
c4.innerText = "pending for payment"
row.append(c1, c2, c3, c4)
tbody.append(row)
});
}
function checkoutappend(array) {
tbody2.innerHTML = "";
array.forEach(element => {
let row = document.createElement("tr");
row.style.backgroundColor = "lightgreen"
row.style.color = "darkblack"
let c1 = document.createElement("td");
let c2 = document.createElement("td");
let c3 = document.createElement("td");
let c4 = document.createElement("td");
c1.innerText = element.id;
c2.innerText = element.name
c3.innerText = element.qty;
c4.innerText = "pending for delivery"
row.append(c1, c2, c3, c4)
tbody2.append(row)
});
}