// Costs Page Module class CostsPage { constructor() { this.costData = null; this.init(); } async init() { // Load data await Promise.all([ this.loadCostStats(), this.loadCostsChart(), this.loadBudgetTracking(), this.loadPricingTable() ]); // Setup event listeners this.setupEventListeners(); } async loadCostStats() { try { const data = await window.api.get('/usage/summary'); this.costData = { totalCost: data.total_cost, todayCost: data.today_cost, weekCost: data.total_cost * 0.4, // Placeholder for weekly logic monthCost: data.total_cost, avgDailyCost: data.total_cost / 30, // Simplified costTrend: 5.2, budgetUsed: Math.min(Math.round((data.total_cost / 100) * 100), 100), // Assuming $100 budget projectedMonthEnd: data.today_cost * 30 }; this.renderCostStats(); } catch (error) { console.error('Error loading cost stats:', error); } } renderCostStats() { const container = document.getElementById('cost-stats'); if (!container) return; container.innerHTML = `
${row.id}