-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhotspot2.js
53 lines (46 loc) · 1.92 KB
/
hotspot2.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
// Popup logic
const scheduleRecyclerButtons = document.querySelectorAll('.schedule-recycler');
const recyclerPopup = document.getElementById('recyclerPopup');
const selectRecyclerButton = document.getElementById('selectRecycler');
let currentCard;
scheduleRecyclerButtons.forEach(button => {
button.addEventListener('click', () => {
recyclerPopup.style.display = 'flex';
// Save reference to the current card
currentCard = button.closest('.card');
});
});
selectRecyclerButton.addEventListener('click', () => {
const selectedRecycler = document.getElementById('recyclerSelect').value;
alert(`Recycler ${selectedRecycler} scheduled!`);
recyclerPopup.style.display = 'none';
// Show scheduled recycler name on the card
currentCard.querySelector('.scheduled-recycler').textContent = `Scheduled Recycler: ${selectedRecycler}`;
});
// Update status logic
const updateStatusButtons = document.querySelectorAll('.update-status');
updateStatusButtons.forEach(button => {
button.addEventListener('click', () => {
const card = button.closest('.card');
if (card.classList.contains('green')) {
card.classList.remove('green');
card.classList.add('orange');
alert('Status updated to Hotspot');
// Remove scheduled recycler name when status is updated
card.querySelector('.scheduled-recycler').textContent = '';
} else {
card.classList.remove('orange');
card.classList.add('green');
alert('Status updated to Recycle Scheduled');
// Send alert message to the recycler
}
});
});
// Delete card logic
const deleteButtons = document.querySelectorAll('.delete');
deleteButtons.forEach(button => {
button.addEventListener('click', () => {
const card = button.closest('.card');
card.remove();
});
});