class TableSite extends HTMLElement { constructor() { super(); this.attachShadow({ mode: "open" }); this._sites = []; } /** * Set the sites data and render the table */ set sites(value) { this._sites = value; this.render(); } /** * Get the sites data */ get sites() { return this._sites; } connectedCallback() { this.render(); } /** * Get badge color class based on report status */ getConditionClass(status) { switch (status) { case "Reported": return "bg-warning text-dark"; case "Assigned": return "bg-info text-dark"; case "On-Hold": return "bg-secondary"; case "Complete": return "bg-success"; default: return "bg-secondary"; } } render() { // Create the styles const style = ` `; // Create the table let tableHTML = `
| Site ID | Condition | Address |
|---|---|---|
| ${site.id} | ${site.condition} | ${site.address} |
| No sites | ||