// Woodbury Operator — Ticket Detail (progress tracker). Registers window.TicketDetailScreen. (function () { const NS = window.WoodburyPropertiesDesignSystem_7290ca; const { Card, CardHeader, Button, Badge, Avatar, IconTile, Eyebrow, Modal, Select, Textarea, Input } = NS; // Progress stages a ticket moves through. const STAGES = ["Reported", "Vendor Assigned", "Scheduled", "In Progress", "Resolved"]; function TicketDetailScreen({ onBack }) { const seed = window.WB_ACTIVE_TICKET || { unit: "House 1 — AC Leak", asset: "Lashibi Townhouses", icon: "wind", badge: "Urgent", badgeTone: "danger", vendor: "AirCool HVAC Services", vendorTrade: "HVAC", vendorPhone: "+233 55 880 9910", tenant: "Kofi Mensah", tenantUnit: "House 1", reported: "18 Aug 2026 · 09:12", reportDate: "20 Aug 2026", priority: "Urgent", stageIndex: 1, description: "Unit making a loud grinding noise and not cooling. Started overnight.", }; const [stage, setStage] = React.useState(seed.stageIndex || 1); const [log, setLog] = React.useState([ { icon: "user-check", tone: "accent", title: "Vendor assigned", body: seed.vendor + " assigned to the ticket.", time: "18 Aug · 09:40" }, { icon: "wrench", tone: "danger", title: "Ticket reported", body: seed.description, time: seed.reported }, ]); const [update, setUpdate] = React.useState(false); const [uStage, setUStage] = React.useState(STAGES[Math.min(stage + 1, STAGES.length - 1)]); const [uNote, setUNote] = React.useState(""); const [notifyTenant, setNotifyTenant] = React.useState(true); const applyUpdate = () => { const idx = STAGES.indexOf(uStage); setStage(idx); setLog((l) => [{ icon: "activity", tone: "brand", title: "Status → " + uStage, body: uNote || "Progress updated.", time: "Just now" }, ...l]); setUpdate(false); setUNote(""); window.WBToast(notifyTenant ? "Progress updated · " + seed.tenant + " notified" : "Progress updated"); }; return (
} /> {/* Progress tracker */}
{seed.priority} priority
Target report-back: {seed.reportDate}
= 4 ? "success" : seed.badgeTone} dot={stage >= 4}>{STAGES[stage]}
{STAGES.map((s, i) => { const done = i < stage, active = i === stage; return (
{s}
{i < STAGES.length - 1 &&
} ); })}
{/* Activity log */} { setUStage(STAGES[stage]); setUpdate(true); }}>Add Update} />
{log.map((e, i) => { const tones = { danger: ["var(--danger-bg)", "var(--danger)"], brand: ["var(--walnut-100)", "var(--walnut-700)"], accent: ["rgba(194,125,72,0.14)", "var(--terracotta-600)"], success: ["var(--success-bg)", "var(--success)"] }[e.tone] || ["var(--cream-100)", "var(--gray-500)"]; return (
{i < log.length - 1 &&
}
{e.title}{e.time}

{e.body}

); })}
{/* Vendor + tenant + resolve */}
Assigned Vendor
{seed.vendor}
{seed.vendorTrade} · {seed.vendorPhone}
Reported By
{seed.tenant}
{seed.tenantUnit}
{stage < 4 && }
{/* Update progress modal */} setUpdate(false)} icon="refresh-cw" title="Update Progress" subtitle={seed.unit} footer={}>