feat: Updates forms to use LabeledInput, style updates.

This commit is contained in:
2026-01-13 10:15:06 -05:00
parent 432533c940
commit df600a5471
12 changed files with 204 additions and 167 deletions

View File

@@ -42,19 +42,27 @@ struct ComponentLossForm: HTML, Sendable {
input(.class("hidden"), .name("projectID"), .value("\(projectID)"))
div {
label(.for("name")) { "Name" }
Input(id: "name", placeholder: "Name")
.attributes(.type(.text), .required, .autofocus, .value(componentLoss?.name))
}
div {
label(.for("value")) { "Value" }
Input(id: "value", placeholder: "Pressure loss")
.attributes(
.type(.number), .min("0.03"), .max("1.0"), .step("0.01"), .required,
.value(componentLoss?.value)
)
}
LabeledInput(
"Name",
.name("name"),
.type(.text),
.value(componentLoss?.name),
.placeholder("Name"),
.required,
.autofocus
)
LabeledInput(
"Value",
.name("value"),
.type(.number),
.value(componentLoss?.value),
.placeholder("0.2"),
.min("0.03"),
.max("1.0"),
.step("0.01"),
.required
)
SubmitButton()
.attributes(.class("btn-block"))

View File

@@ -24,30 +24,32 @@ struct ComponentPressureLossesView: HTML, Sendable {
}
.attributes(.class("px-4"))
table(.class("table table-zebra")) {
thead {
tr(.class("text-xl font-bold")) {
th { "Name" }
th { "Value" }
th {
div(.class("flex justify-end mx-auto")) {
Tooltip("Add Component Loss") {
PlusButton()
.attributes(
.class("btn-ghost text-2xl"),
.showModal(id: ComponentLossForm.id())
)
div(.class("overflow-x-auto")) {
table(.class("table table-zebra")) {
thead {
tr(.class("text-xl font-bold")) {
th { "Name" }
th { "Value" }
th {
div(.class("flex justify-end mx-auto")) {
Tooltip("Add Component Loss") {
PlusButton()
.attributes(
.class("btn-ghost text-2xl me-2"),
.showModal(id: ComponentLossForm.id())
)
}
}
}
}
}
}
tbody {
for row in componentPressureLosses {
TableRow(row: row)
tbody {
for row in componentPressureLosses {
TableRow(row: row)
}
}
}
}
}
}
ComponentLossForm(dismiss: true, projectID: projectID, componentLoss: nil)