/* Registration wizard: Account → Allotment → Verify → Addresses */
(function () {
const { useState } = React;
const Icon = window.Icon;
const D = window.YEIDA;
const AuthShell = window.AuthShell, VerifyPanel = window.VerifyPanel;
const STEPS = [
{ k: 'account', label: 'Account', icon: 'user' },
{ k: 'allotment', label: 'Allotment', icon: 'building' },
{ k: 'verify', label: 'Verify', icon: 'shield' },
{ k: 'address', label: 'Address', icon: 'mapPin' },
];
function Stepper({ step }) {
return (
{STEPS.map((s, i) => (
{i < step ? : i + 1}
{s.label}
{i < STEPS.length - 1 && }
))}
);
}
function Register({ go }) {
const [step, setStep] = useState(0);
const [form, setForm] = useState({
firstName: 'Rajeev', lastName: 'Malhotra', email: 'r.malhotra@email.com',
cc: '+91', mobile: '9876500012', password: '', confirm: '',
relationship: 'Self', terms: true, cookies: true,
allotteeFirst: 'Rajeev', allotteeLast: 'Malhotra',
hasAllotment: true, allotment: 'YEA-654321', sector: 'Sector 18', pocket: 'Pocket B', plot: 'B-47',
});
const set = (k, v) => setForm(f => ({ ...f, [k]: v }));
const next = () => setStep(s => Math.min(STEPS.length - 1, s + 1));
const isAllottee = form.relationship === 'Self';
return (
step === 0 ? go('login') : setStep(s => s - 1)}> Back
New Allottee Registration
{['Create your account', 'Identify your plot', 'Verify email & phone', 'Your addresses'][step]}
{step === 0 &&
}
{step === 1 &&
}
{step === 2 &&
}
{step === 3 &&
}
{step !== 2 && (
step === STEPS.length - 1 ? go('app') : next()}>
{step === 0 ? 'Create Account & Verify' : step === 3 ? 'Finish & Enter Portal' : 'Continue'}
)}
{step === 0 && (
Already registered?{' '}
go('login')} style={{ background: 'none', border: 'none', color: 'var(--blue-600)', fontWeight: 700, cursor: 'pointer', fontSize: 14 }}>Sign in
)}
);
}
/* Step 0 — Account creation */
function AccountStep({ form, set, isAllottee }) {
const pwMismatch = form.confirm.length > 0 && form.password !== form.confirm;
return (
{pwMismatch &&
Passwords do not match
}
{/* Relationship with Allottee */}
Relationship with Allottee
set('relationship', e.target.value)}>
{D.relationshipOptions.map(o => {o} )}
{isAllottee ? 'Self registration — you are the original allottee (Allottee = User).' : `Invitation registration — you are registering on behalf of the allottee as ${form.relationship} (Allottee ≠ User).`}
{/* Allottee name — required when registrant is NOT the allottee */}
{!isAllottee && (
Original Allottee Details
)}
set('terms', e.target.checked)} style={{ width: 17, height: 17, accentColor: 'var(--blue-600)' }} />
I accept YEIDA's Terms & Conditions and Privacy Policy
set('cookies', e.target.checked)} style={{ width: 17, height: 17, accentColor: 'var(--blue-600)' }} />
I consent to cookies for a secure, personalised portal experience
);
}
/* Step 1 — Allotment identification */
function AllotmentStep({ form, set }) {
return (
What is your Allotment Number?
Enter your allotment number to link your plot, or identify it by sector & plot if you don't have it handy.
{/* toggle */}
{[['have', 'I have my allotment number'], ['forgot', "I don't remember it"]].map(([k, l]) => (
set('hasAllotment', k === 'have')}
style={{ padding: '8px 15px', borderRadius: 9, border: 'none', fontSize: 13, fontWeight: 600, cursor: 'pointer', background: (form.hasAllotment === (k === 'have')) ? '#fff' : 'transparent', color: (form.hasAllotment === (k === 'have')) ? 'var(--ink)' : 'var(--muted)', boxShadow: (form.hasAllotment === (k === 'have')) ? 'var(--sh-xs)' : 'none' }}>{l}
))}
{form.hasAllotment ? (
) : (
Identify your plot below — we'll match it to your allotment record.
Sector
set('sector', e.target.value)}>{D.sectors.map(s => {s.name} )}
Pocket
set('pocket', e.target.value)}>{['Pocket A', 'Pocket B', 'Pocket C', 'Pocket D'].map(p => {p} )}
Plot number is typically 3 or 4 digits (e.g. 047 or 1024).
)}
);
}
/* Step 2 — Verification */
function VerifyStep({ form, go }) {
const [both, setBoth] = useState(false);
return (
Verify both your email and mobile number on this screen. Each requires an OTP.
{both ? 'Continue' : 'Verify email & phone to continue'}
);
}
/* Step 3 — Addresses (registered + mailing, editable independently) */
function AddressStep({ form, set }) {
const [sameAsReg, setSameAsReg] = useState(false);
return (
);
}
function AddressBlock({ title, sub, icon, prefix, form, set }) {
const def = prefix === 'reg' ? D.user.registeredAddress : D.user.mailingAddress;
return (
);
}
/* Standalone allotment lookup (login path — "I don't remember my allotment number") */
function AllotmentLookup({ go }) {
const [form, setForm] = useState({ sector: 'Sector 18', pocket: 'Pocket B', plot: 'B-47' });
const [found, setFound] = useState(false);
const set = (k, v) => setForm(f => ({ ...f, [k]: v }));
return (
go('login')}> Back
Find your allotment
Identify your plot
No allotment number? Locate your plot by sector, pocket and plot number.
Sector set('sector', e.target.value)}>{D.sectors.map(s => {s.name} )}
Pocket set('pocket', e.target.value)}>{['Pocket A', 'Pocket B', 'Pocket C', 'Pocket D'].map(p => {p} )}
{found ? (
Allotment found · YEA-654321
{form.sector} · {form.pocket} · Plot {form.plot}
) : (
setFound(true)}> Find my allotment
)}
go('verify')}>Continue to Verification
);
}
window.Register = Register;
window.AllotmentLookup = AllotmentLookup;
})();