[verified] feat: add configurable results length units
Build CutList image / build-and-push (push) Successful in 31s

Default cut results to total-inch mixed fractions, allow switching to feet and inches, and separate part names from lengths visually.
This commit is contained in:
aj
2026-08-03 01:31:09 +00:00
parent 79bf56afd8
commit 3ccaddef0c
6 changed files with 85 additions and 5 deletions
+14 -5
View File
@@ -503,6 +503,7 @@ else
private MultiMaterialPackingSummary? summary;
private bool optimizing;
private bool lockingJob;
private bool showLengthsInInches = true;
private IEnumerable<MaterialShape> DistinctShapes => materials.Select(m => m.Shape).Distinct().OrderBy(s => s);
private IEnumerable<Material> FilteredMaterials => !selectedShape.HasValue
@@ -511,6 +512,9 @@ else
private bool IsNew => !Id.HasValue;
private bool CanOptimize => job.Parts.Count > 0 && job.CuttingToolId != null;
private string FormatResultLength(double inches) => showLengthsInInches
? ArchUnits.FormatInches(inches)
: ArchUnits.FormatFromInches(inches);
private async Task UnlockJob()
{
@@ -987,6 +991,10 @@ else
<button class="btn btn-outline-secondary ms-2" @onclick="PrintReport">
<i class="bi bi-printer me-1"></i> Print Report
</button>
<button class="btn btn-outline-secondary ms-2" @onclick="() => showLengthsInInches = !showLengthsInInches"
aria-pressed="@showLengthsInInches">
@(showLengthsInInches ? "Show feet + inches" : "Show all inches")
</button>
@if (!job.IsLocked)
{
<button class="btn btn-warning ms-2" @onclick="LockJob" disabled="@lockingJob">
@@ -1037,7 +1045,7 @@ else
<div class="col-md-3 col-6 mb-3">
<div class="card text-center">
<div class="card-body">
<h2 class="card-title mb-0">@ArchUnits.FormatFromInches(summary.TotalWaste)</h2>
<h2 class="card-title mb-0">@FormatResultLength(summary.TotalWaste)</h2>
<p class="card-text text-muted">Total Waste</p>
</div>
</div>
@@ -1084,7 +1092,7 @@ else
{
<tr>
<td>@materialResult.Material.DisplayName</td>
<td>@ArchUnits.FormatFromInches(group.Key)</td>
<td>@FormatResultLength(group.Key)</td>
<td class="text-end">@group.Count()</td>
</tr>
}
@@ -1158,7 +1166,7 @@ else
{
<tr>
<td>@binNum</td>
<td style="white-space: nowrap;">@ArchUnits.FormatFromInches(entry.Bin.Length)</td>
<td style="white-space: nowrap;">@FormatResultLength(entry.Bin.Length)</td>
<td>
@foreach (var item in entry.Bin.Items)
{
@@ -1166,12 +1174,13 @@ else
@if (!string.IsNullOrWhiteSpace(item.Name))
{
<span class="cut-part-badge-name">@item.Name</span>
<span class="cut-part-badge-divider" aria-hidden="true"></span>
}
<span class="cut-part-badge-length">@ArchUnits.FormatFromInches(item.Length)</span>
<span class="cut-part-badge-length">@FormatResultLength(item.Length)</span>
</span>
}
</td>
<td style="white-space: nowrap;">@ArchUnits.FormatFromInches(entry.Bin.RemainingLength)</td>
<td style="white-space: nowrap;">@FormatResultLength(entry.Bin.RemainingLength)</td>
</tr>
binNum++;
}
+1
View File
@@ -275,6 +275,7 @@ a, .btn-link { color: var(--accent-dark); }
/* Results cut badges keep the part number and its length visually distinct. */
.cut-part-badge { background-color: #6c8ebf; display: inline-flex; font-weight: 500; overflow: hidden; padding: 0; }
.cut-part-badge-name { padding: .35em .55em; }
.cut-part-badge-divider { border-left: 1px solid rgba(255, 255, 255, .75); margin: .2em 0; }
.cut-part-badge-length { background-color: #4c6680; padding: .35em .55em; }
/* Overview */