File size: 1,724 Bytes
cbff4b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Initialize any interactive components or animations

document.addEventListener('DOMContentLoaded', function() {
    // Tooltips for table headers
    const tableHeaders = document.querySelectorAll('th');
    
    tableHeaders.forEach(header => {
        header.addEventListener('mouseenter', function() {
            const description = this.getAttribute('data-tooltip');
            if (description) {
                // Create and show tooltip
                const tooltip = document.createElement('div');
                tooltip.className = 'absolute z-10 bg-black text-white text-xs rounded py-1 px-2';
                tooltip.textContent = description;
                
                const rect = this.getBoundingClientRect();
                tooltip.style.top = `${rect.bottom + window.scrollY}px`;
                tooltip.style.left = `${rect.left + window.scrollX}px`;
                
                document.body.appendChild(tooltip);
                this._tooltip = tooltip;
            }
        });
        
        header.addEventListener('mouseleave', function() {
            if (this._tooltip) {
                document.body.removeChild(this._tooltip);
                delete this._tooltip;
            }
        });
    });
    
    // Calculate and update dynamic metrics
    function updateMetrics() {
        const production = 6700;
        const limit = 1920;
        const efficiency = ((limit / production) * 100).toFixed(2);
        const savings = 4780 * 5;
        
        document.querySelector('[data-efficiency]').textContent = `${100 - efficiency}%`;
        document.querySelector('[data-savings]').textContent = `₹${savings.toLocaleString()}`;
    }
    
    updateMetrics();
});