feat: Begins vendor views

This commit is contained in:
2025-01-15 16:37:18 -05:00
parent 24570e7191
commit 6f2e87e886
13 changed files with 199 additions and 301 deletions

View File

@@ -0,0 +1,34 @@
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<HTMLTag.tr> {
tr(.id("vendor_\(vendor.id)")) {
td { vendor.name.capitalized }
td { "(\(vendor.branches?.count ?? 0)) Branches" }
td {}
}
}
}
}