Number Management System
00 से 99 तक सभी Numbers को Manage करें
// Create numbers from 00 to 99 function initializeNumbers() { numbersData = []; for (let i = 0; i < 100; i++) { const num = i.toString().padStart(2, '0'); // Randomly assign FR or SR type const type = Math.random() > 0.5 ? 'fr' : 'sr'; numbersData.push({ number: num, type: type, amount: 0 }); } renderNumbers(); updateSummary(); }
// Render numbers in the container function renderNumbers() { const container = document.getElementById('numbersContainer'); container.innerHTML = '';
const searchTerm = document.getElementById('search').value.toLowerCase(); const filterType = document.getElementById('filterType').value;
numbersData.forEach(item => { // Apply search filter if (searchTerm && !item.number.includes(searchTerm)) { return; }
// Apply type filter if (filterType !== 'all' && item.type !== filterType) { return; }
const card = document.createElement('div'); card.className = `number-card ${item.type}`; card.innerHTML = `
`; container.appendChild(card); }); }
// Update amount for a specific number function updateAmount(number, value) { const amountValue = parseInt(value) || 0; const numberItem = numbersData.find(item => item.number === number);
if (numberItem) { numberItem.amount = amountValue; updateSummary(); // Re-render to show updated amount renderNumbers(); } }
// Update summary information function updateSummary() { let totalAmount = 0; let frCount = 0; let srCount = 0;
numbersData.forEach(item => { totalAmount += item.amount; if (item.type === 'fr') frCount++; if (item.type === 'sr') srCount++; });
document.getElementById('totalAmount').textContent = `₹${totalAmount}`; document.getElementById('frCount').textContent = frCount; document.getElementById('srCount').textContent = srCount; }
// Reset all amounts to zero function resetAllAmounts() { if (confirm('क्या आप सभी amounts reset करना चाहते हैं?')) { numbersData.forEach(item => { item.amount = 0; }); renderNumbers(); updateSummary(); } }
// Event listeners document.getElementById('search').addEventListener('input', renderNumbers); document.getElementById('filterType').addEventListener('change', renderNumbers); document.getElementById('resetBtn').addEventListener('click', resetAllAmounts);
// Initialize the application initializeNumbers();
