From 86307dfa05ed36c95160c54c64612d67f36c480b Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Wed, 14 Jan 2026 19:24:56 -0500 Subject: [PATCH] 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. --- Public/css/output.css | 7 +++++++ Sources/ManualDCore/DuctSizing.swift | 4 ++++ .../ViewController/Views/DuctSizing/RoomsTable.swift | 2 +- .../Views/DuctSizing/TrunkSizeForm.swift | 6 +++--- .../ViewController/Views/DuctSizing/TrunksTable.swift | 10 ++++++---- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Public/css/output.css b/Public/css/output.css index abe72ab..b558c0c 100644 --- a/Public/css/output.css +++ b/Public/css/output.css @@ -6851,6 +6851,13 @@ margin-block-end: calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse))); } } + .space-y-2 { + :where(& > :not(:last-child)) { + --tw-space-y-reverse: 0; + margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse)); + margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse))); + } + } .space-y-4 { :where(& > :not(:last-child)) { --tw-space-y-reverse: 0; diff --git a/Sources/ManualDCore/DuctSizing.swift b/Sources/ManualDCore/DuctSizing.swift index 78a514e..28b8cf0 100644 --- a/Sources/ManualDCore/DuctSizing.swift +++ b/Sources/ManualDCore/DuctSizing.swift @@ -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 { diff --git a/Sources/ViewController/Views/DuctSizing/RoomsTable.swift b/Sources/ViewController/Views/DuctSizing/RoomsTable.swift index 499b2f6..55a9212 100644 --- a/Sources/ViewController/Views/DuctSizing/RoomsTable.swift +++ b/Sources/ViewController/Views/DuctSizing/RoomsTable.swift @@ -5,7 +5,7 @@ import ManualDCore import Styleguide extension DuctSizingView { - + // TODO: Remove register ID. struct RoomsTable: HTML, Sendable { @Environment(ProjectViewValue.$projectID) var projectID diff --git a/Sources/ViewController/Views/DuctSizing/TrunkSizeForm.swift b/Sources/ViewController/Views/DuctSizing/TrunkSizeForm.swift index ea48368..a252010 100644 --- a/Sources/ViewController/Views/DuctSizing/TrunkSizeForm.swift +++ b/Sources/ViewController/Views/DuctSizing/TrunkSizeForm.swift @@ -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)") diff --git a/Sources/ViewController/Views/DuctSizing/TrunksTable.swift b/Sources/ViewController/Views/DuctSizing/TrunksTable.swift index c347be0..a88c6e4 100644 --- a/Sources/ViewController/Views/DuctSizing/TrunksTable.swift +++ b/Sources/ViewController/Views/DuctSizing/TrunksTable.swift @@ -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) } } }