TireInspectionPanel: aufklappbare, editierbare Profiltiefen-/QR-Report-Ansicht in allen Reifenstapel-Ansichten

This commit is contained in:
spaethf committed 2026-09-26 23:48:10 +02:00
1 parent 766703524a
commit 7a0406eaa2
9 files changed
+825 -58

No files matched your search

@@ -399,6 +399,8 @@ else
<textarea id="edit-notes" class="form-control" rows="3" @bind="editStack.Notes"></textarea>
</div>
</div>
<TireInspectionPanel TireStackId="@editStack.Id" AllowEdit="true" Compact="true"
ScannerSubtitle="@editStack.TicketNumber" />
@if (!string.IsNullOrEmpty(editError))
{
<p class="edit-error" role="alert">@editError</p>
@@ -536,32 +538,11 @@ else
<dd><time datetime="@stack.ExpectedPickupDate.Value.ToString("yyyy-MM-dd")">@stack.ExpectedPickupDate.Value.ToLocalTime().ToString("dd.MM.yyyy")</time></dd>
</div>
}
@if (latestInspections.TryGetValue(stack.Id, out var insp) && insp != null)
{
<div class="detail-row">
<dt>Letzte Messung</dt>
<dd>
<div class="tread-chips">
<span class="tread-chip rating-@RatingClass(insp.RatingFL)">VL @FmtMm(insp.TreadDepthFL)</span>
<span class="tread-chip rating-@RatingClass(insp.RatingFR)">VR @FmtMm(insp.TreadDepthFR)</span>
<span class="tread-chip rating-@RatingClass(insp.RatingRL)">HL @FmtMm(insp.TreadDepthRL)</span>
<span class="tread-chip rating-@RatingClass(insp.RatingRR)">HR @FmtMm(insp.TreadDepthRR)</span>
</div>
<span class="muted">
@((insp.MeasuredAt ?? insp.CreatedAt).ToLocalTime().ToString("dd.MM.yyyy"))
@if (insp.Mileage.HasValue) { <text> · @insp.Mileage.Value.ToString("N0", System.Globalization.CultureInfo.GetCultureInfo("de-DE")) km</text> }
@if (!string.IsNullOrEmpty(insp.LicensePlate)) { <text> · @insp.LicensePlate</text> }
</span>
@if (!string.IsNullOrEmpty(insp.ReportUrl))
{
<a class="report-link" href="@insp.ReportUrl" target="_blank" rel="noopener">Report öffnen ↗</a>
}
</dd>
</div>
}
</dl>
</section>
</div>
<TireInspectionPanel TireStackId="@stack.Id" AllowEdit="@UserSession.IsWorkerOrAdmin" Compact="true"
ScannerSubtitle="@(stack.Customer != null ? $"Kunde: {stack.Customer.FullName}" : stack.TicketNumber)" />
};
private List<TireStack> allTireStacks = new();
@@ -575,30 +556,6 @@ else
private bool? typeFilter; // null = all, false = customer, true = inventory
private string selectedCategoryId = "";
private TireStack? selectedStack;
private readonly Dictionary<Guid, TireInspection?> latestInspections = new();
private static string RatingClass(TireMeasureRating r) => r switch
{
TireMeasureRating.Ok => "ok",
TireMeasureRating.Warning => "warn",
TireMeasureRating.Critical => "crit",
_ => "none"
};
private static string FmtMm(decimal? mm) => mm.HasValue ? mm.Value.ToString("0.0", System.Globalization.CultureInfo.GetCultureInfo("de-DE")) + " mm" : "–";
private async Task LoadLatestInspection(TireStack ts)
{
if (latestInspections.ContainsKey(ts.Id)) return;
try
{
latestInspections[ts.Id] = await TireStackService.GetLatestInspectionAsync(ts.Id);
}
catch
{
latestInspections[ts.Id] = null;
}
}
private TireStack? editStack;
private TireStack? editSource;
private bool showEditModal;
@@ -744,13 +701,9 @@ else
filteredTireStacks = query.OrderBy(ts => ts.StorageLocation?.Code).ToList();
}
private async Task SelectStack(TireStack ts)
private void SelectStack(TireStack ts)
{
selectedStack = selectedStack?.Id == ts.Id ? null : ts;
if (selectedStack != null)
{
await LoadLatestInspection(selectedStack);
}
}
private void OpenEditModal()
@@ -831,14 +784,10 @@ else
return locationLookup.TryGetValue((area, row, pos, slot), out var loc) ? loc : null;
}
private async Task SelectLocation(StorageLocation? location)
private void SelectLocation(StorageLocation? location)
{
if (location == null) return;
selectedLocation = selectedLocation?.Id == location.Id ? null : location;
if (selectedLocation?.OccupiedTireStack != null)
{
await LoadLatestInspection(selectedLocation.OccupiedTireStack);
}
}
private string GetCellTooltip(StorageLocation? loc, AreaType area, int row, ShelfPosition pos, int slot)