adilmalik7364's picture
make more analysis
37c50fe verified
Raw History Blame Contribute Delete
1.03 kB
// 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 };