feat: Working on search for purchase orders.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import DatabaseClientLive
|
||||
import Dependencies
|
||||
import Elementary
|
||||
import ElementaryHTMX
|
||||
import Fluent
|
||||
import SharedModels
|
||||
import Vapor
|
||||
@@ -12,6 +13,7 @@ func routes(_ app: Application) throws {
|
||||
try app.register(collection: VendorViewController())
|
||||
try app.register(collection: EmployeeViewController())
|
||||
try app.register(collection: PurchaseOrderViewController())
|
||||
try app.register(collection: UtilsViewController())
|
||||
|
||||
app.get { _ in
|
||||
HTMLResponse {
|
||||
@@ -38,7 +40,21 @@ func routes(_ app: Application) throws {
|
||||
let token = try await users.login(loginForm)
|
||||
let user = try await users.get(token.userID)!
|
||||
req.session.authenticate(user)
|
||||
return try await PurchaseOrderViewController().index(req: req)
|
||||
let context = try req.query.decode(LoginContext.self)
|
||||
|
||||
return await req.render {
|
||||
MainPage(displayNav: true, route: .purchaseOrders) {
|
||||
div(
|
||||
.hx.get(context.next ?? "/purchase-orders"),
|
||||
.hx.pushURL(true),
|
||||
.hx.target("body"),
|
||||
.hx.trigger(.event(.revealed)),
|
||||
.hx.indicator(".hx-indicator")
|
||||
) {
|
||||
Img.spinner().attributes(.class("hx-indicator"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let protected = app.grouped(UserPasswordAuthenticator(), UserSessionAuthenticator())
|
||||
|
||||
Reference in New Issue
Block a user