// Dashboard module — rendered dynamically into #app
export async function render(container) {
container.innerHTML = `
Snabbåtgärder
`;
// Load real data
try {
const [deals, customers, tickets] = await Promise.all([
apiRequest('/sales/deals').then(r => r.ok ? r.json() : {deals: []}),
apiRequest('/crm/customers').then(r => r.ok ? r.json() : {customers: []}),
apiRequest('/support/tickets').then(r => r.ok ? r.json() : {tickets: []}),
]);
document.getElementById('kpi-deals').textContent = deals.deals?.length || 0;
document.getElementById('kpi-customers').textContent = customers.customers?.length || 0;
document.getElementById('kpi-tickets').textContent = tickets.tickets?.length || 0;
} catch (err) {
console.error('Dashboard load error:', err);
}
}