`).join('');
}
function buildActivityLog(){
const logs=[
{date:'Feb 20, 2025',msg:'Net Meter application submitted to UHBVN. Expected: 15 days.',type:'info'},
{date:'Feb 15, 2025',msg:'Solar installation completed! System is live.',type:'success'},
{date:'Feb 12, 2025',msg:'Subsidy of ₹78,000 applied on PM Suryaghar portal.',type:'success'},
{date:'Jan 20, 2025',msg:'Material delivered: 8× Waaree 400W panels + Growatt 3kW inverter.',type:'info'},
{date:'Jan 15, 2025',msg:'Technical sanction received from UHBVN.',type:'success'},
{date:'Jan 10, 2025',msg:'Project booked. Site survey completed.',type:'info'},
];
document.getElementById('activityLog').innerHTML=logs.map(l=>`
${l.type==='success'?'✅':'ℹ️'}
`).join('');
}
function buildEnergyChart(){
const months=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
const vals=[980,1120,1450,1620,1800,2240,2190,2050,1840,1620,1240,1050];
const max=Math.max(...vals);
document.getElementById('energyChart').innerHTML=vals.map((v,i)=>`
${v<1000?v:(v/1000).toFixed(1)+'k'}
${months[i]}
`).join('');
}
function buildInvoices(){
const invs=[
{num:'INV-ST-2025-001',desc:'3kW Solar System Installation — Phase 1',date:'Jan 15, 2025',amount:'₹85,000',status:'paid',type:'Installation'},
{num:'INV-ST-2025-002',desc:'Balance Payment — System Completion',date:'Feb 15, 2025',amount:'₹42,000',status:'paid',type:'Installation'},
{num:'INV-ST-2025-003',desc:'Annual Maintenance Contract (AMC) — 5 Years',date:'Feb 20, 2025',amount:'₹15,000',status:'paid',type:'AMC'},
{num:'INV-ST-2024-001',desc:'Site Survey & Documentation Charges',date:'Jan 10, 2025',amount:'₹2,000',status:'paid',type:'Survey'},
];
document.getElementById('invoiceList').innerHTML=invs.map(inv=>`
🧾
${inv.num}
${inv.desc} • ${inv.date} • ${inv.type}
${inv.amount}
${inv.status==='paid'?'✅ Paid':'⏳ Pending'}
⬇ PDF
`).join('');
}
function buildRefHistory(){
const refs=[
{name:'Suresh Kumar',village:'Fatehabad',date:'Feb 5, 2025',project:'3kW Residential',comm:'₹4,000',status:'approved'},
{name:'Manpreet Singh',village:'Sirsa',date:'Jan 20, 2025',project:'2kW Residential',comm:'₹2,000',status:'approved'},
{name:'Priyanka Devi',village:'Hisar',date:'Mar 1, 2025',project:'Site Survey Booked',comm:'₹2,500',status:'pending'},
];
document.getElementById('refHistoryList').innerHTML=refs.map(r=>`
${r.name} — ${r.village}
${r.project} • ${r.date}
${r.status==='approved'?'✅ Paid':'⏳ Pending'}
${r.comm}
`).join('');
}
function downloadInvoice(num){
showNotif('📥 Downloading '+num+'... (PDF generation होगी production में)');
// Production: window.open('/api/invoices/'+num+'/pdf')
}
function copyRefLink(){
const link=document.getElementById('refLinkDisplay').textContent;
navigator.clipboard.writeText(link).then(()=>showNotif('✅ Referral link copied!'));
}
function submitService(){
showNotif('✅ Service request submitted! 24 hours में callback मिलेगा।');
}
function showNotif(msg){
const t=document.getElementById('notifToast');
t.textContent=msg;t.classList.add('show');
setTimeout(()=>t.classList.remove('show'),3000);
}
// Allow Enter key on log