Files
vapor-po/Sources/App/Views/Utils/Navbar.swift

32 lines
1.0 KiB
Swift

import Elementary
import ElementaryHTMX
struct Navbar: HTML, Sendable {
var content: some HTML {
div(.class("sidepanel"), .id("sidepanel")) {
a(.href("javascript:void(0)"), .class("closebtn"), .on(.click, "closeSidepanel()")) {
"x"
}
a(.hx.get("/purchase-orders?page=1&limit=50"), .hx.target("body"), .hx.pushURL(true)) {
"Purchase Orders"
}
a(.hx.get("/users"), .hx.target("body"), .hx.pushURL(true)) {
"Users"
}
a(.hx.get("/employees"), .hx.target("body"), .hx.pushURL(true)) {
"Employees"
}
a(.hx.get("/vendors"), .hx.target("body"), .hx.pushURL(true)) {
"Vendors"
}
div(.style("border-bottom: 1px solid grey; margin-bottom: 5px;")) {}
a(.hx.post("/logout"), .hx.target("#content"), .hx.swap(.outerHTML), .hx.trigger(.event(.click))) {
"Logout"
}
}
button(.class("openbtn"), .on(.click, "openSidepanel()")) {
img(.src("/images/menu.svg"), .style("width: 30px;, height: 30px;"))
}
}
}