fix: Search button would stay on top of sidepanel when it was open.

This commit is contained in:
2025-01-18 09:05:07 -05:00
parent d8328314ed
commit 9efd920456
7 changed files with 62 additions and 166 deletions

View File

@@ -3,7 +3,38 @@ import ElementaryHTMX
import Fluent
import SharedModels
enum RouteContainer {
extension HTMLAttribute.hx {
static func get(route: RouteKey) -> HTMLAttribute {
get(route.url)
}
static func post(route: RouteKey) -> HTMLAttribute {
post(route.url)
}
static func put(route: RouteKey) -> HTMLAttribute {
put(route.url)
}
static func delete(route: RouteKey) -> HTMLAttribute {
delete(route.url)
}
}
extension HTMLAttribute.hx {
static func target(_ target: HXTarget) -> HTMLAttribute {
Self.target(target.selector)
}
}
extension HTMLAttribute where Tag: HTMLTrait.Attributes.Global {
static func id(_ target: HXTarget) -> Self {
id(target.id)
}
}
enum RouteKey {
case employees(EmployeeRoute? = nil)
case purchaseOrders(PurchaseOrderRoute? = nil)
case users(UserRoute? = nil)
@@ -59,12 +90,14 @@ enum RouteContainer {
}
enum SearchQuery {
case context(PurchaseOrderSearchContext)
case context(PurchaseOrderSearchContext, table: Bool? = nil)
var query: String {
switch self {
case let .context(context):
return "context=\(context.rawValue)"
case let .context(context, table):
let query = "context=\(context.rawValue)"
guard let table else { return query }
return "\(query)&table=\(table)"
}
}
}
@@ -84,29 +117,6 @@ enum RouteContainer {
}
extension HTMLAttribute.hx {
static func get(route: RouteContainer) -> HTMLAttribute {
get(route.url)
}
static func post(route: RouteContainer) -> HTMLAttribute {
post(route.url)
}
static func put(route: RouteContainer) -> HTMLAttribute {
put(route.url)
}
static func delete(route: RouteContainer) -> HTMLAttribute {
delete(route.url)
}
}
enum RouteKey: String {
case purchaseOrders = "purchase-orders"
}
enum HXTarget {
case body
case employee(EmployeeKey)
@@ -185,19 +195,6 @@ enum HXTarget {
}
}
extension HTMLAttribute.hx {
static func target(_ target: HXTarget) -> HTMLAttribute {
Self.target(target.selector)
}
}
extension HTMLAttribute where Tag: HTMLTrait.Attributes.Global {
static func id(_ target: HXTarget) -> Self {
id(target.id)
}
}
enum ViewRoute: String {
case employees