// Woodbury Operator — Move-in / Move-out flow. Registers window.MoveScreen. (function () { const NS = window.WoodburyPropertiesDesignSystem_7290ca; const { Card, CardHeader, Button, Badge, Avatar, IconTile, Eyebrow, ProgressBar, Modal, Select, Input } = NS; const STEPS = { "Move-in": [ { label: "Assign unit", icon: "link", note: "Link the tenant to a vacant unit." }, { label: "Move-in inspection", icon: "clipboard-check", note: "Document unit condition with photos." }, { label: "Collect documents", icon: "file-text", note: "Signed tenancy agreement & ID on file." }, { label: "Activate lease", icon: "file-signature", note: "Lease start date confirmed." }, { label: "Hand over keys", icon: "key-round", note: "Keys, gate remote & access code issued." }, ], "Move-out": [ { label: "Notice logged", icon: "calendar-x", note: "Move-out date recorded." }, { label: "Move-out inspection", icon: "clipboard-check", note: "Condition vs. move-in report." }, { label: "Condition report", icon: "file-warning", note: "Damages / repairs noted for follow-up." }, { label: "Unlink unit", icon: "unlink", note: "Free the unit for new applicants." }, { label: "Close tenancy", icon: "check-check", note: "Archive record & revoke access." }, ], }; const SEED = [ { id: "MV-3007", type: "Move-in", tenant: "Adjoa Mensah", avatar: "../../assets/images/av-ama.jpg", property: "Lashibi Townhouses", unit: "House 3", date: "22 Aug 2026", step: 2 }, { id: "MV-3005", type: "Move-out", tenant: "Nana Adjei", avatar: "../../assets/images/av-nana.jpg", property: "Onehive Tse Addo", unit: "Unit 101", date: "31 Aug 2026", step: 1 }, { id: "MV-2998", type: "Move-in", tenant: "Kwabena Osei", avatar: "../../assets/images/avatar-1.jpg", property: "Cantonments City", unit: "Apt 5A", date: "05 Aug 2026", step: 5 }, ]; function MoveScreen() { const loading = window.WBuseLoad(); const canManage = window.WBCan("move.manage"); const [moves, setMoves] = React.useState(SEED); const fromScreening = window.WBuseNew("moves"); const allMoves = [...fromScreening.slice().reverse(), ...moves]; const [sel, setSel] = React.useState(null); const [nw, setNw] = React.useState(false); const [draft, setDraft] = React.useState({ type: "Move-in", tenant: "", property: window.WB_SITES[0], unit: "", date: "" }); const current = allMoves.find((m) => m.id === sel); const advance = (m) => { const steps = STEPS[m.type]; const inSeed = moves.some((x) => x.id === m.id); if (inSeed) { setMoves((list) => list.map((x) => x.id === m.id ? { ...x, step: Math.min(steps.length, x.step + 1) } : x)); } else { const it = window.WB_NEW.moves.find((x) => x.id === m.id); if (it) { it.step = Math.min(steps.length, it.step + 1); window.WBbus.dispatchEvent(new CustomEvent("moves")); } } window.WBToast(m.step >= steps.length ? "Move complete" : "Step completed: " + steps[m.step].label); }; if (current) { const steps = STEPS[current.type]; const pct = Math.round((current.step / steps.length) * 100); return (
setSel(null)}>Back} />
{current.type} {current.step} of {steps.length} steps · {pct}%
= steps.length ? Complete : null} />
{steps.map((s, i) => { const done = i < current.step, active = i === current.step; return (
{s.label}
{s.note}
{done && Done} {active && canManage && } {active && !canManage && Pending}
); })}
); } const inProg = allMoves.filter((m) => m.step < STEPS[m.type].length); const done = allMoves.filter((m) => m.step >= STEPS[m.type].length); return (
setNw(true)}>Start Move : null} /> {inProg.length}} /> {loading ? : inProg.length === 0 ? ( setNw(true)}>Start Move : null} /> ) : inProg.map((m, i) => { const steps = STEPS[m.type]; const pct = Math.round((m.step / steps.length) * 100); return (
setSel(m.id)} style={{ display: "grid", gridTemplateColumns: "1.5fr 1.3fr 1fr 0.6fr", gap: 20, alignItems: "center", padding: "18px 24px", borderTop: i ? "1px solid var(--border)" : "none", cursor: "pointer" }}>
{m.tenant}
{m.id} · {m.date}
{m.property}
{m.unit}
{steps[m.step] ? steps[m.step].label : "Done"}{pct}%
{m.type}
); })}
{!loading && done.length > 0 && ( {done.length}} /> {done.map((m, i) => (
setSel(m.id)} style={{ display: "flex", gap: 14, alignItems: "center", padding: "16px 24px", borderTop: i ? "1px solid var(--border)" : "none", cursor: "pointer" }}>
{m.tenant}
{m.property} · {m.unit} · {m.date}
{m.type} complete
))}
)} setNw(false)} icon="truck" title="Start a Move" subtitle="Begin a guided move-in or move-out." footer={}>
setDraft((d) => ({ ...d, tenant: e.target.value }))} options={["Select tenant…", ...window.WB_TENANT_NAMES]} />
setDraft((d) => ({ ...d, unit: e.target.value }))} options={(draft.type === "Move-in" ? window.WBunitsFor(draft.property, true) : window.WBunitsFor(draft.property, false)).length ? (draft.type === "Move-in" ? window.WBunitsFor(draft.property, true) : window.WBunitsFor(draft.property, false)) : ["No units"]} containerStyle={{ flex: 1 }} />
setDraft((d) => ({ ...d, date: e.target.value }))} />
); } window.MoveScreen = MoveScreen; })();