-
Notifications
You must be signed in to change notification settings - Fork 3
/
dashboard.js
144 lines (80 loc) · 2.4 KB
/
dashboard.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
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
const allSideMenu = document.querySelectorAll('#sidebar .side-menu.top li a');
allSideMenu.forEach(item=> {
const li = item.parentElement;
item.addEventListener('click', function () {
allSideMenu.forEach(i=> {
i.parentElement.classList.remove('active');
})
li.classList.add('active');
})
});
// TOGGLE SIDEBAR
const menuBar = document.querySelector('#content nav .bx.bx-menu');
const sidebar = document.getElementById('sidebar');
menuBar.addEventListener('click', function () {
sidebar.classList.toggle('hide');
})
const searchButton = document.querySelector('#content nav form .form-input button');
const searchButtonIcon = document.querySelector('#content nav form .form-input button .bx');
const searchForm = document.querySelector('#content nav form');
searchButton.addEventListener('click', function (e) {
if(window.innerWidth < 576) {
e.preventDefault();
searchForm.classList.toggle('show');
if(searchForm.classList.contains('show')) {
searchButtonIcon.classList.replace('bx-search', 'bx-x');
} else {
searchButtonIcon.classList.replace('bx-x', 'bx-search');
}
}
})
if(window.innerWidth < 768) {
sidebar.classList.add('hide');
} else if(window.innerWidth > 576) {
searchButtonIcon.classList.replace('bx-x', 'bx-search');
searchForm.classList.remove('show');
}
window.addEventListener('resize', function () {
if(this.innerWidth > 576) {
searchButtonIcon.classList.replace('bx-x', 'bx-search');
searchForm.classList.remove('show');
}
})
const switchMode = document.getElementById('switch-mode');
switchMode.addEventListener('change', function () {
if(this.checked) {
document.body.classList.add('dark');
} else {
document.body.classList.remove('dark');
}
})
/// here data comes from cart page local storage
let Name=JSON.parse(localStorage.getItem(""))||[]
let admin_arr=JSON.parse(localStorage.getItem(""))||[]
//console.log(admin_arr,"hi")
let tbod=document.querySelector("tbody")
showing(admin_arr)
function showing(admin_arr){
let datado=`
${
admin_arr.map((elem,i)=>
creatingrow(elem,i)
).join("")
}
`
tbod.innerHTML=datado
}
function creatingrow(elem,i){
console.log(elem.price)
let row=`
<tr> ${Name} </tr>
<tr> <img src=${elem.image} </tr>
<tr> ${elem.title} </tr>
<tr> ${elem.price}</tr>
`
return row
}
//
//
//
//