import Elementary import ElementaryHTMX import SharedModels struct VendorTable: HTML { let vendors: [Vendor] var content: some HTML { table { thead { th { "Name" } th {} th { Button.add() } } tbody(.id("vendor-table")) { for vendor in vendors { Row(vendor: vendor) } } } } struct Row: HTML { let vendor: Vendor var content: some HTML { tr(.id("vendor_\(vendor.id)")) { td { vendor.name.capitalized } td { "(\(vendor.branches?.count ?? 0)) Branches" } td {} } } } }