// Woodbury Operator — Vendors directory. Registers window.VendorsScreen.
(function () {
const NS = window.WoodburyPropertiesDesignSystem_7290ca;
const { Card, CardHeader, Button, Badge, StatCard, IconTile, Input, Modal, Select } = NS;
function VendorsScreen() {
const V = window.WB_DATA.vendors;
const [modal, setModal] = React.useState(null); // 'add' | vendor
const [q, setQ] = React.useState("");
const close = () => setModal(null);
const shown = V.filter((v) => !q || (v.name + v.trade).toLowerCase().includes(q.toLowerCase()));
React.useEffect(() => { const f = window.WBFocus; if (f && f.kind === "vendor") { const v = V.find((x) => x.name === f.key); if (v) { window.WB_ACTIVE_VENDOR = v; window.WBNavigate && window.WBNavigate("VendorDetail"); } window.WBFocus = null; } }, []);
return (
setModal("add")}>Add Vendor} />
window.WBNavigate&&window.WBNavigate("Vendors")} label="Approved Vendors" value="5" icon="hard-hat" iconTone="brand" />
window.WBNavigate&&window.WBNavigate("Vendors")} label="Preferred" value="2" icon="star" iconTone="success" emphasis="success" />
window.WBNavigate&&window.WBNavigate("Vendors")} label="On-site Today" value="1" icon="map-pin" iconTone="accent" />
window.WBNavigate&&window.WBNavigate("Vendors")} label="Open Assignments" value="6" icon="wrench" iconTone="sunken" />
setQ(e.target.value)} containerStyle={{ width: 260 }} />} />
{["Vendor", "Trade", "Phone", "Status", "Action"].map((h, i) => (
{h}
))}
{V.map((v, i) => (
{v.name}
{v.jobs} completed jobs
{v.trade}
{v.phone}
{v.rating}
))}
{shown.length === 0 && No vendors match “{q}”.
}
{/* Add vendor */}
Cancel { close(); window.WBToast("Vendor added to directory"); }}>Add Vendor}>
{/* View vendor */}
Close { close(); window.WBToast("Assigning a ticket to " + modal.name); }}>Assign Ticket}>
{modal && typeof modal === "object" && (
{[["Trade", modal.trade], ["Phone", modal.phone], ["Completed jobs", modal.jobs], ["Status", modal.rating]].map(([k, v]) => (
{k}{v}
))}
)}
);
}
window.VendorsScreen = VendorsScreen;
})();