feat: Adds api route tests. Tested user interface works as expected, still needs some work on vendors form.

This commit is contained in:
2025-01-20 16:44:12 -05:00
parent affd9b5d81
commit 410bbae1c8
23 changed files with 537 additions and 121 deletions

View File

@@ -26,15 +26,15 @@ struct VendorDetail: HTML {
// TODO: What route for here??
var branchForm: some HTML {
// TODO: Add hidden input field with vendor id.
form(
.id("branch-form"),
.hx.post("/vendors/\(vendor.id)/branches"),
.id(.branch(.form)),
.hx.post("/vendors/branches"),
.hx.target("#branches"),
.hx.swap(.beforeEnd),
.hx.on(.afterRequest, .ifSuccessful(.resetForm))
// .custom(name: "hx-on::after-request", value: "if(event.detail.successful) this.reset();")
) {
input(.type(.hidden), .name("vendorID"), .value(vendor.id.uuidString))
input(
.type(.text), .class("col-9"), .name("name"), .placeholder("Add branch..."), .required,
// FIX: route