/* Payments module */
(function () {
const { useState } = React;
const Icon = window.Icon, PageHead = window.PageHead, LineChart = window.LineChart, BarChart = window.BarChart;
const D = window.YEIDA, fmt = D.fmtINR;
function Payments({ go, toast }) {
const [tab, setTab] = useState('dues');
const [pay, setPay] = useState(null); // due being paid
const totalDue = D.dues.reduce((s, d) => s + d.amount, 0);
return (
{/* summary cards */}
{[
['Outstanding', fmt(totalDue), 'amber', 'rupee', '3 dues pending'],
['Paid (FY 25-26)', fmt(265370), 'emerald', 'checkCircle', '5 transactions'],
['Next Due', '30 Jun', 'blue', 'calendar', 'Lease Rent 2026-27'],
['Total Premium', fmt(D.property.totalValue), 'navy', 'building', '90% paid'],
].map(([l, v, c, ic, sub]) => {
const cc = { blue: ['var(--blue-50)', 'var(--blue-600)'], emerald: ['var(--emerald-50)', 'var(--emerald-700)'], amber: ['var(--amber-50)', 'var(--amber-600)'], navy: ['#e9eefb', 'var(--navy-700)'] }[c];
return (
);
})}
{/* tabs */}
{[['dues', 'Outstanding Dues'], ['history', 'Payment History'], ['receipts', 'Receipts'], ['construction', 'Construction Payments'], ['analytics', 'Financial Analytics']].map(([k, l]) => (
))}
{tab === 'dues' &&
toast && toast('e-Challan generated · CH-2026-0606-18')} />}
{tab === 'history' && }
{tab === 'receipts' && }
{tab === 'construction' && }
{tab === 'analytics' && }
{pay && setPay(null)} onDone={() => { setPay(null); toast && toast('Payment successful · receipt sent to email'); }} />}
);
}
function Dues({ onPay, onChallan }) {
return (
{[['Estimated Build Cost', fmt(C.estimatedCost), 'navy', 'building'], ['Paid to Contractor', fmt(paid), 'emerald', 'checkCircle'], ['Upcoming Milestones', fmt(upcoming), 'amber', 'clock']].map(([l, v, c, ic]) => {
const cc = { emerald: ['var(--emerald-50)', 'var(--emerald-700)'], amber: ['var(--amber-50)', 'var(--amber-600)'], navy: ['#e9eefb', 'var(--navy-700)'] }[c];
return (
);
})}
Milestone Payments & Invoices
Contractor · {C.contractor.name}
| Milestone | Invoice | Vendor | Date | Status | Amount | |
{CP.map(p => (
| {p.milestone} |
{p.id} |
{p.vendor} |
{p.date} |
{p.status === 'Paid' ? : null}{p.status} |
{fmt(p.amount)} |
{p.status === 'Paid' ? : } |
))}
);
}
function Analytics() {
return (
Cumulative payments
Premium + lease rent paid since allotment
20192021202320252026
By category
Lifetime breakdown
{[['Location Premium', 82, 'var(--blue-500)'], ['Lease Rent', 11, 'var(--emerald-500)'], ['Fees & Charges', 5, 'var(--amber-500)'], ['Utilities', 2, 'var(--navy-700)']].map(([l, p, c]) => (
))}
Yearly payments
Total paid per financial year (₹ lakh)
{['19', '20', '21', '22', '23', '24', '25', '26'].map(y => FY{y})}
);
}
function PayModal({ due, onClose, onDone }) {
const [method, setMethod] = useState('upi');
const [stage, setStage] = useState('select');
const methods = [['upi', 'UPI', 'phone'], ['card', 'Debit/Credit Card', 'payments'], ['net', 'Net Banking', 'building']];
const pay = () => { setStage('processing'); setTimeout(() => setStage('done'), 1600); };
return (