feat: Begins vendor views
This commit is contained in:
34
Sources/App/Views/Vendors/VendorTable.swift
Normal file
34
Sources/App/Views/Vendors/VendorTable.swift
Normal 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 {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user