From 91d0042017e6c46f2c9f5d42d438836efa6d53e4 Mon Sep 17 00:00:00 2001 From: Arturs Artamonovs Date: Fri, 7 Aug 2026 02:01:40 +0100 Subject: Added 3 views. Added basic beam drawing and basic calculations for width and length + beam drawing --- ShedCalc/BOMView.swift | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 ShedCalc/BOMView.swift (limited to 'ShedCalc/BOMView.swift') diff --git a/ShedCalc/BOMView.swift b/ShedCalc/BOMView.swift new file mode 100644 index 0000000..1bb6523 --- /dev/null +++ b/ShedCalc/BOMView.swift @@ -0,0 +1,63 @@ +// +// BOMView.swift +// ShedCalc +// +// Created by Jacky Jack on 28/07/2026. +// + +import SwiftUI +import Combine + +struct Materials: Identifiable { + let materialName: String + let pricePerMeter: Double + let totalMeters: Double + let totalPrice: Double + let metersPerPiece: Double + let totalPieces: Double + + let id = UUID() +} + + + +struct BOMView: View { + @Environment(ParamModel.self) private var paramModel + + @State private var materials = [ + Materials(materialName: "2x4", pricePerMeter: 1.2, totalMeters: 10, totalPrice: 12, metersPerPiece: 4.8, totalPieces: 23), + Materials(materialName: "OSB", pricePerMeter: 1.2, totalMeters: 10, totalPrice: 12, metersPerPiece: 4.8, totalPieces: 23), + Materials(materialName: "Roof Felt", pricePerMeter: 1.2, totalMeters: 10, totalPrice: 12, metersPerPiece: 4.8, totalPieces: 23), + Materials(materialName: "Nails", pricePerMeter: 1.2, totalMeters: 10, totalPrice: 12, metersPerPiece: 4.8, totalPieces: 23), + Materials(materialName: "Cladding", pricePerMeter: 1.2, totalMeters: 10, totalPrice: 12, metersPerPiece: 4.8, totalPieces: 23) + ] + + var body: some View { + VStack { + Text("BOM") + } + VStack { + Table(materials) { + TableColumn("Material", value: \.materialName) + TableColumn("Price per m") { material in + Text(material.pricePerMeter, format: .number.precision(.fractionLength(2))) + } + TableColumn("Total m") { material in + Text(material.totalMeters, format: .number.precision(.fractionLength(2))) + } + TableColumn("Total price") { material in + Text(material.totalPrice, format: .number.precision(.fractionLength(2))) + } + TableColumn("m per Piece") { material in + Text(material.metersPerPiece, format: .number.precision(.fractionLength(2))) + } + TableColumn("Pieces") { material in + Text(material.totalPieces, format: .number) + } + } + } + HStack { + Text("Total price: 0.00") + } + } +} -- cgit v1.2.3