File size: 1,641 Bytes
ab9146c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Main application script
document.addEventListener('DOMContentLoaded', function() {
    // Initialize tooltips
    const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
    tooltipTriggerList.map(function (tooltipTriggerEl) {
        return new bootstrap.Tooltip(tooltipTriggerEl);
    });

    // Sample data for demonstration
    const birthdays = [
        { name: "Sarah Johnson", date: "Today" },
        { name: "Michael Chen", date: "Tomorrow" }
    ];
    // Account value auto-update simulation
    function updateAccountValue() {
        const baseValue = 124870.45;
        const fluctuation = (Math.random() - 0.5) * 1000;
        const newValue = baseValue + fluctuation;
        const changePercent = ((newValue - baseValue) / baseValue * 100).toFixed(2);
        
        const valueElement = document.querySelector('.text-3xl.font-bold.text-blue-600');
        const changeElement = document.querySelector('.text-sm.text-gray-500');
        
        if (valueElement && changeElement) {
            valueElement.textContent = `${newValue.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",")}`;
            changeElement.textContent = `${changePercent >= 0 ? '+' : ''}${changePercent}% this month`;
            changeElement.className = `text-sm ${changePercent >= 0 ? 'text-green-500' : 'text-red-500'}`;
        }
    }

    document.querySelector('[data-feather="refresh-cw"]')?.addEventListener('click', updateAccountValue);
    
    // Simulate real-time updates every 30 seconds
    setInterval(updateAccountValue, 30000);
    
    console.log("CRM Dashboard initialized");
});