/* Dashboard — split into A) Authority Status & Records and B) Construction Progress */
(function () {
const Icon = window.Icon, Donut = window.Donut, StatusBadge = window.StatusBadge;
const D = window.YEIDA, fmt = D.fmtINR;
function SectionLabel({ n, title, sub, children }) {
return (
{/* Welcome banner */}
{/* decorative concentric rings */}
Official Allottee Portal
Welcome back, {D.user.firstName}
Plot {D.user.plot} · {D.user.sector}
{D.user.relationship} · {D.user.isAllottee ? 'Allottee' : 'Representative'}
{A.leaseDeed.label}
{A.atl.label}
go('payments')}> Pay Dues
go('journey')}> What's next?
{/* ===== Module switcher: Plot Dashboard (primary) · Construction Project Dashboard (secondary) ===== */}
{[
{ k: 'plot', icon: 'building', title: 'Yamuna Expressway · Plot Dashboard', sub: 'Authority status, records & payments', tag: 'Primary' },
{ k: 'construction', icon: 'construction', title: 'Construction Project Dashboard', sub: 'Build progress, milestones & contractor', tag: D.journey.constructionStarted ? 'Active' : 'Not started' },
].map(m => {
const on = view === m.k;
return (
switchTo(m.k)} className="card mod-switch" style={{ flex: 1, minWidth: 280, textAlign: 'left', cursor: 'pointer', padding: '16px 18px', display: 'flex', alignItems: 'center', gap: 14, border: on ? '1.5px solid var(--blue-400)' : '1px solid var(--line)', background: on ? 'linear-gradient(100deg, var(--blue-50), #fff)' : '#fff', boxShadow: on ? '0 0 0 4px rgba(38,112,230,.1)' : 'var(--sh-sm)' }}>
{m.title}
{m.tag}
{m.sub}
{on && }
);
})}
{view === 'plot' ?
:
}
);
}
/* ============================ MODULE 1 — PLOT DASHBOARD (PRIMARY) ============================ */
function PlotDashboard({ go }) {
const totalDue = D.dues.reduce((s, d) => s + d.amount, 0);
const paidPct = Math.round(D.property.paid / D.property.totalValue * 100);
const A = D.authorityStatus;
return (
{/* Pending actions strip */}
3 pending actions need your attention
ATL pending · 1 overdue payment · Soil Test Report awaited
go('payments')}>Clear dues
go('construction')}>Resolve
go('payments')}>View all records
{/* Authority Status — key metrics */}
{(() => {
const last = D.authorityRecords[D.authorityRecords.length - 1] || D.authorityRecords[0];
const nextDue = [...D.dues].sort((a, b) => a.due.localeCompare(b.due))[0] || D.dues[0];
const metrics = [
{ label: 'Total Paid', value: fmt(D.property.paid), sub: D.authorityRecords.length + ' receipts', icon: 'checkCircle', color: 'emerald' },
{ label: 'Outstanding Dues', value: fmt(totalDue), sub: D.dues.length + ' pending', icon: 'rupee', color: 'amber' },
{ label: 'Last Payment', value: fmt(last.amount), sub: last.date, icon: 'history', color: 'blue' },
{ label: 'Next Due', value: nextDue.due, sub: fmt(nextDue.amount) + ' · ' + nextDue.type, icon: 'calendar', color: 'navy' },
];
const C = { emerald: ['var(--emerald-50)', 'var(--emerald-700)'], amber: ['var(--amber-50)', 'var(--amber-600)'], blue: ['var(--blue-50)', 'var(--blue-600)'], navy: ['#e9eefb', 'var(--navy-700)'] };
return (
{metrics.map(m => {
const cc = C[m.color];
return (
{m.label}
{m.value}
{m.sub}
);
})}
);
})()}
{/* Authority payments summary */}
Authority Payments
Premium & lease account
go('payments')}>Details
Total Premium
{fmt(D.property.totalValue)}
Deposited
{fmt(D.property.paid)}
Balance
{fmt(D.property.totalValue - D.property.paid)}
{paidPct}% of premium deposited {D.authorityRecords.length} official receipts
{/* Pending dues + due dates */}
Pending Dues & Due Dates
{D.dues.length} pending
{D.dues.map(d => (
{d.label}
{d.status === 'overdue' ? 'Overdue' : d.status === 'due' ? 'Due soon' : 'Upcoming'}
{d.due}
{fmt(d.amount)}
))}
go('payments')}>Pay {fmt(totalDue)}
{/* Official records table */}
Official Authority Records Verified deposits & challans on record with YEIDA
go('payments')}> Statement
Head of Account Challan No. Date Mode Status Amount
{D.authorityRecords.map(r => (
{r.head}
{r.challan}
{r.date}
{r.mode}
{r.status}
{fmt(r.amount)}
))}
{/* Latest Notices · AI Assistant · Recent Documents */}
Latest Notices
go('notices')}>All
{D.notices.slice(0, 3).map(n => (
go('notices')} style={{ textAlign: 'left', background: 'none', border: 'none', cursor: 'pointer', padding: '8px 0', borderBottom: '1px solid var(--line-2)', display: 'flex', gap: 11 }}>
{n.title}
{n.cat} · {n.date}
))}
AI Assistant Online · ask anything
{['What payments are pending?', 'What is my ATL status?'].map(q => (
go('assistant')} style={{ textAlign: 'left', fontSize: 12.5, fontWeight: 500, color: '#dce8f8', padding: '9px 12px', borderRadius: 10, border: '1px solid rgba(255,255,255,.14)', background: 'rgba(255,255,255,.06)', cursor: 'pointer' }}>{q}
))}
go('assistant')}> Open Assistant
Recent Documents
go('documents')}>All
{D.documents.slice(0, 4).map((d, i) => (
go('documents')} className="row spread" style={{ width: '100%', textAlign: 'left', background: 'none', border: 'none', cursor: 'pointer', padding: '8px 0', borderBottom: '1px solid var(--line-2)' }}>
{d.name} {d.date}
))}
);
}
/* ============================ MODULE 2 — CONSTRUCTION PROJECT DASHBOARD (SECONDARY) ============================ */
function ConstructionDashboard({ go }) {
const J = D.journey;
return (
go('construction')}>Open module
{/* construction financial / site widgets */}
{Math.round(D.construction.spent / D.construction.estimatedCost * 100)}% spent
Estimated Build Cost
{fmt(D.construction.estimatedCost)}
{fmt(D.construction.spent)} spent to date
{D.construction.contractor.status}
Contractor Status
{D.construction.contractor.name}
{D.construction.contractor.rating}
Engaged since {D.construction.contractor.since}
{D.construction.onSchedule ? 'On schedule' : 'Delayed'}
Completion Forecast
{D.construction.completionForecast}
Current: {D.construction.currentMilestone}
{/* status + progress */}
{J.constructionStarted ? 'Construction Started' : 'Not Started'}
Next Required Action
{J.nextAction}
go('construction')}>
{/* milestones */}
Milestones
{D.constructionMilestones.map((m, i) => (
{m.label}
0 ? 'blue' : 'gray')} style={{ fontSize: 10.5 }}>{m.status}
{m.date}
))}
{/* timeline */}
Activity Timeline
{D.activity.slice(0, 4).map((a, i, arr) => {
const cc = { emerald: 'var(--emerald-500)', blue: 'var(--blue-500)', amber: 'var(--amber-500)', navy: 'var(--navy-700)' }[a.color];
return (
{i !== arr.length - 1 &&
}
{a.title}
{a.desc}
{a.time}
);
})}
{/* construction payments shortcut + sample plans CTA */}
Construction Payments
Milestone invoices & receipts
go('payments')}>Open
Sample Plans & Tours
Designs matched to your plot
go('sampleplans')}>Open
);
}
window.Dashboard = Dashboard;
})();