File size: 2,098 Bytes
d5df923 | 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 46 47 48 49 | // Sample data for the telecom providers
const telecomData = {
mtn: [
{ data: "1GB", cost: 5.00, charge: 0.30, price: 5.30, actual: 6.50, difference: 1.20 },
{ data: "2GB", cost: 10.00, charge: 0.60, price: 10.60, actual: 12.00, difference: 1.40 },
{ data: "3GB", cost: 14.00, charge: 0.84, price: 14.84, actual: 16.00, difference: 1.16 },
// Add more MTN data here
],
telecel: [
{ data: "5GB", cost: 21.00, charge: 1.26, price: 22.26, actual: 23.50, difference: 1.24 },
{ data: "10GB", cost: 38.00, charge: 2.28, price: 40.28, actual: 41.50, difference: 1.22 },
{ data: "15GB", cost: 57.00, charge: 3.42, price: 60.42, actual: 61.50, difference: 1.08 },
// Add more Telecel data here
],
at: [
{ data: "1GB", cost: 4.50, charge: 0.27, price: 4.77, actual: 6.00, difference: 1.23 },
{ data: "2GB", cost: 9.00, charge: 0.54, price: 9.54, actual: 10.50, difference: 0.96 },
{ data: "3GB", cost: 12.00, charge: 0.72, price: 12.72, actual: 14.00, difference: 1.28 },
// Add more AT data here
]
};
document.addEventListener('DOMContentLoaded', function() {
// Network selection functionality
const networkButtons = document.querySelectorAll('.network-btn');
networkButtons.forEach(button => {
button.addEventListener('click', function() {
networkButtons.forEach(btn => btn.classList.remove('active'));
this.classList.add('active');
const selectedNetwork = this.dataset.network;
// Update charts and data based on selected network
updateCharts(selectedNetwork);
});
});
// Initialize with MTN data
updateCharts('mtn');
});
function updateCharts(network) {
// This would update the charts with the selected network's data
console.log(`Updating charts with ${network} data`);
// In a real implementation, you would:
// 1. Get the data for the selected network
// 2. Update the chart visualization
// 3. Highlight the relevant data cards
} |