-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminFarmerVendor.js
71 lines (49 loc) · 1.83 KB
/
adminFarmerVendor.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
let list = document.querySelectorAll(".navigation_container li");
function activeLink(){
list.forEach(item => {
item.classList.remove("hovered")
})
this.classList.add("hovered")
}
list.forEach(item => item.addEventListener("mouseover", activeLink))
let toggle = document.querySelector('.toggle')
let navigation = document.querySelector('.navigation_container');
let main = document.querySelector('.main')
toggle.onclick = function(){
navigation.classList.toggle("active")
main.classList.toggle("active")
}
const subMenu = document.querySelector('.sub-menu')
const navItem = document.querySelectorAll('.nav-item')
for(let i of navItem){
i.onclick = activeLi;
}
function activeLi(){
const list = Array.from(navItem);
list.forEach(e => e.classList.remove('actives'));
this.classList.add('actives')
}
const logoutDashboard = document.getElementById('logout')
const log = document.querySelector('.main')
logoutDashboard.addEventListener('click', () => {
logoutPopup()
})
function logoutPopup(){
const logoutPopupMessage = document.createElement('div')
logoutPopupMessage.classList.add('popup')
const popUpContainer = document.createElement('div')
popUpContainer.classList.add('popcontainer')
const span = document.createElement('span')
logoutPopupMessage.appendChild(popUpContainer)
popUpContainer.appendChild(span)
span.innerHTML = `are you sure do you want to logout?
<button class="btnPopUp" onclick="logout()">Yes</button><button class="btnPopUp" id="removePop">No</button>`
log.appendChild(logoutPopupMessage)
const removepop = document.getElementById('removePop')
removepop.addEventListener('click', () => {
removepop.parentElement.parentElement.remove()
})
}
function logout(){
window.location.href = "login.html"
}