File size: 2,126 Bytes
5bef5b3 |
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 |
// Mobile Navigation Toggle
const navToggle = document.querySelector('.nav-toggle');
const navMenu = document.querySelector('.nav-menu');
if (navToggle && navMenu) {
navToggle.addEventListener('click', () => {
navMenu.classList.toggle('active');
navToggle.classList.toggle('is-active');
});
}
// Tracking Form Example
const trackingExamples = document.querySelectorAll('.tracking-example');
const trackingInput = document.getElementById('tracking-number');
if (trackingExamples.length > 0 && trackingInput) {
trackingExamples.forEach(button => {
button.addEventListener('click', () => {
trackingInput.value = button.getAttribute('data-tracking');
});
});
}
// Form Submission
const forms = document.querySelectorAll('form');
forms.forEach(form => {
form.addEventListener('submit', (e) => {
e.preventDefault();
// In a real app, you would submit the form data here
alert('Form submitted successfully!');
});
});
// Dashboard Stats Animation
const statCards = document.querySelectorAll('.stat-card');
statCards.forEach((card, index) => {
setTimeout(() => {
card.style.opacity = '1';
card.style.transform = 'translateY(0)';
}, 300 * index);
});
// Shipment Actions
const actionButtons = document.querySelectorAll('.table-actions button');
actionButtons.forEach(button => {
button.addEventListener('click', (e) => {
e.stopPropagation();
const action = e.currentTarget.querySelector('i').getAttribute('data-feather');
const row = e.currentTarget.closest('tr');
const trackingId = row.cells[1].textContent;
switch(action) {
case 'eye':
alert(`Viewing details for shipment ${trackingId}`);
break;
case 'edit':
alert(`Editing shipment ${trackingId}`);
break;
case 'trash':
if (confirm(`Are you sure you want to delete shipment ${trackingId}?`)) {
row.remove();
}
break;
}
});
}); |