[verified] feat: add configurable results length units
Build CutList image / build-and-push (push) Successful in 31s
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:
@@ -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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user