File size: 2,572 Bytes
1d3e07e
219d3b2
 
4bd66c6
 
219d3b2
4bd66c6
 
 
 
 
 
 
 
219d3b2
 
4bd66c6
 
 
219d3b2
4bd66c6
219d3b2
 
4bd66c6
 
 
 
 
 
 
 
 
 
 
 
 
1d3e07e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4bd66c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

// Theme management
document.addEventListener('DOMContentLoaded', () => {
    // Initialize feather icons
    feather.replace();
    
    // Mobile menu toggle
    const mobileMenuToggle = document.querySelector('.mobile-menu-toggle');
    const mobileMenu = document.querySelector('.mobile-menu');
    
    if (mobileMenuToggle && mobileMenu) {
        mobileMenuToggle.addEventListener('click', () => {
            mobileMenu.classList.toggle('hidden');
        });
    }

    // WhatsApp button functionality
    const whatsappButtons = document.querySelectorAll('.whatsapp-button');
    whatsappButtons.forEach(button => {
        button.addEventListener('click', () => {
            window.open('https://wa.me/212600000000', '_blank');
        });
    });

    // Tracking form submission
    const trackingForms = document.querySelectorAll('.tracking-form');
    trackingForms.forEach(form => {
        form.addEventListener('submit', (e) => {
            e.preventDefault();
            const trackingNumber = form.querySelector('input').value;
            if (trackingNumber) {
                window.location.href = `track.html?number=${trackingNumber}`;
            }
        });
    });

    // Login/Register form submission
    const authForms = document.querySelectorAll('.auth-form');
    authForms.forEach(form => {
        form.addEventListener('submit', (e) => {
            e.preventDefault();
            // In a real app, this would validate and send to backend
            window.location.href = 'dashboard.html';
        });
    });

    // Contact form submission
    const contactForm = document.querySelector('.contact-form');
    if (contactForm) {
        contactForm.addEventListener('submit', (e) => {
            e.preventDefault();
            alert('Thank you for your message! We will contact you soon.');
            contactForm.reset();
        });
    }
});
// Simulate tracking data (would be replaced with real API calls)
function getTrackingStatus(trackingNumber) {
    const statuses = [
        { status: 'pending', location: 'Casablanca Hub', time: new Date() },
        { status: 'in-transit', location: 'Rabat Distribution Center', time: new Date(Date.now() - 3600000) },
        { status: 'delivered', location: 'Customer Address', time: new Date(Date.now() - 7200000) }
    ];
    
    return {
        trackingNumber,
        origin: 'Casablanca',
        destination: 'Rabat',
        estimatedDelivery: new Date(Date.now() + 86400000).toLocaleDateString(),
        status: 'in-transit',
        history: statuses
    };
}