/* Construction Journey — goal selection + 8-step survey + Project Team + Progress Center */
(function () {
const { useState } = React;
const Icon = window.Icon, PageHead = window.PageHead, Donut = window.Donut, Avatar = window.Avatar;
const D = window.YEIDA, fmt = D.fmtINR;
function MyJourney({ go, toast }) {
const [tab, setTab] = useState('journey');
return (
go('sampleplans')}> Design Explorer
go('construction')}> Construction Module
{/* sub-tabs */}
{[['journey', 'Journey Steps'], ['team', 'Project Team'], ['progress', 'Progress Center']].map(([k, l]) => (
setTab(k)} style={{ padding: '11px 4px', marginRight: 22, background: 'none', border: 'none', borderBottom: '2.5px solid ' + (tab === k ? 'var(--blue-600)' : 'transparent'), color: tab === k ? 'var(--ink)' : 'var(--muted)', fontWeight: tab === k ? 700 : 500, fontSize: 14.5, cursor: 'pointer', marginBottom: -1 }}>{l}
))}
{tab === 'journey' &&
}
{tab === 'team' &&
}
{tab === 'progress' &&
}
);
}
/* ---------------- GOAL SELECTION + 8-STEP ACCORDION SURVEY ---------------- */
function JourneySteps({ go, toast }) {
const [goal, setGoal] = useState('start');
const [steps, setSteps] = useState(D.journeySteps);
const [open, setOpen] = useState(() => {
const a = D.journeySteps.findIndex(s => s.active);
return a >= 0 ? a : 0;
});
const doneCount = steps.filter(s => s.done).length;
const save = (i) => {
setSteps(arr => arr.map((s, j) => j === i ? { ...s, done: true, active: false } : s));
toast && toast('Information saved · ' + steps[i].title);
const next = steps.findIndex((s, j) => j > i && !s.done);
setOpen(next >= 0 ? next : -1);
};
return (
{/* progress header */}
You're {Math.round(doneCount / steps.length * 100)}% through your journey
Complete each step below — saved steps turn green and stay editable. We'll guide you to the next action.
{doneCount} completed
{steps.length - doneCount} remaining
{/* goal selection */}
What would you like to do with your plot?
Pick a goal — we'll personalise your journey around it.
{D.journeyGoals.map(gOpt => {
const on = goal === gOpt.id;
return (
setGoal(gOpt.id)} className="card-hover" style={{ textAlign: 'left', cursor: 'pointer', padding: '14px 15px', borderRadius: 13, border: '1.5px solid ' + (on ? 'var(--blue-400)' : 'var(--line)'), background: on ? 'var(--blue-50)' : '#fff', display: 'flex', gap: 12, alignItems: 'flex-start', boxShadow: on ? '0 0 0 4px rgba(38,112,230,.1)' : 'none' }}>
);
})}
{/* accordion survey */}
{steps.map((s, i) => {
const isOpen = open === i;
const state = s.done ? 'done' : s.active || isOpen ? 'active' : 'todo';
return (
{/* header row */}
setOpen(isOpen ? -1 : i)} style={{ width: '100%', display: 'flex', alignItems: 'center', gap: 14, padding: '15px 18px', background: s.done ? 'var(--emerald-50)' : '#fff', border: 'none', cursor: 'pointer', textAlign: 'left' }}>
{s.done ? : i + 1}
{s.title}
{s.done && Information Saved }
{state === 'active' && !s.done && In progress }
{s.done ? s.summary : s.desc}
{/* body */}
{isOpen && (
save(i)}> {s.done ? 'Update & Save' : 'Save & Continue'}
{s.done && Editable anytime }
)}
);
})}
);
}
function StepBody({ step, go }) {
// tailored, lightweight content per step
switch (step.key) {
case 'goal':
return Your selected goal drives the recommended steps, designs and budget. You can change it from the selector above. ;
case 'plot':
return (
{[['Allotment No.', D.user.allotment], ['Plot', D.user.plot], ['Sector', D.user.sector], ['Pocket', D.user.pocket]].map(([l, v]) => )}
);
case 'design':
return (
Selected design from the Design Explorer. Browse alternatives anytime.
go('sampleplans')}> Open Design Explorer
);
case 'planning':
return (
{[['Configuration', 'G+1'], ['Built-up area', '4,200 sq.ft'], ['Est. duration', '11 months'], ['Plan status', 'Sanctioned']].map(([l, v]) => )}
);
case 'budget':
return (
{[['Total budget', fmt(D.construction.estimatedCost)], ['Milestones', '5'], ['Funded', fmt(D.construction.spent)]].map(([l, v]) => )}
go('payments')}> Set up milestone payments
);
case 'contractor':
return (
Assign your project team — manager, site engineer, architect & crew. View the Project Team tab to manage contacts.
);
case 'progress':
return Once construction starts, track every stage with photos, notes and dates in the Progress Center. ;
case 'certificate':
return After final inspection, apply for and download your Completion Certificate here. ;
default:
return null;
}
}
function Field({ label, value }) {
return (
);
}
function Note({ children }) {
return {children}
;
}
/* ---------------- PROJECT TEAM ---------------- */
function ProjectTeam({ toast }) {
return (
Your Project Team
{D.projectTeam.map(m => (
{m.name}
{m.org}
toast && toast('Calling ' + m.name)}> Call
toast && toast('Message sent')}> Message
))}
{/* team updates / milestone */}
Team Updates
{D.teamUpdates.map((u, i, arr) => (
{i !== arr.length - 1 &&
}
{u.who} — {u.text}
{u.time}
))}
);
}
/* ---------------- PROGRESS CENTER (stages + live view) ---------------- */
function ProgressCenter() {
const overall = Math.round(D.progressStages.reduce((s, x) => s + x.pct, 0) / D.progressStages.length);
return (
{/* live view + summary */}
LIVE
Live Site Camera
Plot B-47 · Cam 1 · 1080p — drop in your RTSP/webcam feed
{['Cam 1', 'Cam 2', 'Drone'].map((c, i) => {c} )}
Updated just now
{[['Daily Site Photos', 'image', '42 this month'], ['Weekly Progress Report', 'documents', 'Latest: 06 Jun'], ['Current Stage', 'construction', 'Slab Casting']].map(([l, ic, v]) => (
{l}
{v}
))}
{/* stage timeline */}
Construction Stages
{D.progressStages.map((st, i, arr) => {
const state = st.pct === 100 ? 'done' : st.pct > 0 ? 'active' : 'todo';
const cc = state === 'done' ? 'var(--emerald-500)' : state === 'active' ? 'var(--blue-500)' : '#c2cedd';
return (
{i !== arr.length - 1 &&
}
{state === 'done' ? : state === 'active' ? : {i + 1} }
{st.name}
{st.photos > 0 && {st.photos} }
{state === 'done' ? 'Completed' : state === 'active' ? st.pct + '%' : 'Upcoming'}
{st.note &&
{st.note}
}
{st.date}
{state === 'active' &&
}
);
})}
);
}
window.MyJourney = MyJourney;
})();