feat: Uses room names for trunk sizing in the form and table, prep for removing register-id's in favor of only using the room names.

This commit is contained in:
2026-01-14 19:24:56 -05:00
parent 356e020e3b
commit 86307dfa05
5 changed files with 21 additions and 8 deletions

View File

@@ -50,6 +50,8 @@ public enum DuctSizing {
}
}
// TODO: Remove registerID and just use the roomName
public struct RoomContainer: Codable, Equatable, Sendable {
public let registerID: String
@@ -152,6 +154,8 @@ extension DuctSizing {
}
}
// TODO: Add an optional label that the user can set.
// Represents the database model.
public struct TrunkSize: Codable, Equatable, Identifiable, Sendable {

View File

@@ -5,7 +5,7 @@ import ManualDCore
import Styleguide
extension DuctSizingView {
// TODO: Remove register ID.
struct RoomsTable: HTML, Sendable {
@Environment(ProjectViewValue.$projectID) var projectID

View File

@@ -77,10 +77,10 @@ struct TrunkSizeForm: HTML, Sendable {
h2(.class("label font-bold col-span-5")) { "Associated Supply Runs" }
for room in rooms {
div(.class("flex justify-center items-center col-span-1")) {
div(.class("space-y-1")) {
p(.class("label block")) { room.registerID }
div(.class("grid grid-cols-1 justify-center items-center space-y-1")) {
p(.class("label block")) { room.roomName }
input(
.class("checkbox"),
.class("checkbox mx-auto"),
.type(.checkbox),
.name("rooms"),
.value("\(room.roomID)_\(room.roomRegister)")

View File

@@ -51,9 +51,11 @@ extension DuctSizingView {
.attributes(.class("badge-info"), when: trunk.type == .supply)
.attributes(.class("badge-error"), when: trunk.type == .return)
}
td(.class("space-x-2")) {
for id in registerIDS {
Badge { id }
td {
div(.class("flex flex-wrap space-x-2 space-y-2")) {
for id in registerIDS {
Badge { id }
}
}
}
td {
@@ -129,7 +131,7 @@ extension DuctSizingView {
rooms
.first(where: { $0.roomID == room.id && $0.roomRegister == register })
{
array.append(room.registerID)
array.append(room.roomName)
}
}
}