feat working on vendor views.

This commit is contained in:
2025-01-16 08:02:13 -05:00
parent 6f2e87e886
commit d4a8444700
8 changed files with 239 additions and 132 deletions

View File

@@ -8,9 +8,19 @@ struct VendorTable: HTML {
var content: some HTML {
table {
thead {
th { "Name" }
th {}
th { Button.add() }
tr {
th { "Name" }
th { "Branches" }
th(.style("width: 100px;")) {
Button.add()
.attributes(
.style("padding: 0px 10px;"),
.hx.get("/vendors/create"),
.hx.target("#float"),
.hx.swap(.outerHTML)
)
}
}
}
tbody(.id("vendor-table")) {
for vendor in vendors {
@@ -27,7 +37,16 @@ struct VendorTable: HTML {
tr(.id("vendor_\(vendor.id)")) {
td { vendor.name.capitalized }
td { "(\(vendor.branches?.count ?? 0)) Branches" }
td {}
td {
Button.detail()
.attributes(
.style("padding-left: 15px;"),
.hx.get("/vendors/\(vendor.id)"),
.hx.target("#float"),
.hx.pushURL(true),
.hx.swap(.outerHTML)
)
}
}
}
}