feat working on vendor views.
This commit is contained in:
@@ -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)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user