File size: 1,033 Bytes
37c50fe
c4e1ce0
 
37c50fe
 
 
 
 
 
 
 
 
 
 
c4e1ce0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

// Shared functions for the application

// Format large numbers
function formatNumber(num) {
    if (num >= 1000000) {
        return (num / 1000000).toFixed(1) + 'M';
    }
    if (num >= 1000) {
        return (num / 1000).toFixed(1) + 'K';
    }
    return num.toString();
}

// Calculate potential savings
function calculateSavings() {
    const bagsPerShift = document.getElementById('bagsInput').value;
    const savingPerBag = 5; // ₹5 per bag
    const potentialSavings = bagsPerShift * savingPerBag;
    
    document.getElementById('savingsResult').textContent = 
        `Potential savings: ₹${potentialSavings.toLocaleString()}`;
    
    return potentialSavings;
}

// Initialize tooltips
function initTooltips() {
    const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
    tooltipTriggerList.map(function (tooltipTriggerEl) {
        return new bootstrap.Tooltip(tooltipTriggerEl);
    });
}

// Export functions if needed
export { calculateSavings, initTooltips };