// 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 (