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

@@ -175,6 +175,8 @@ else
</span>
<span class="info">@ts.TireSize (@TireStack.TiresPerStack Reifen)</span>
<span class="location"><span aria-hidden="true">📍</span> @(ts.StorageLocation?.Code ?? "-")</span>
<TireInspectionPanel TireStackId="@ts.Id" AllowEdit="@UserSession.IsWorkerOrAdmin" Compact="true"
ScannerSubtitle="@($"Kunde: {customer.FullName}")" />
</li>
}
</ul>
@@ -512,6 +512,7 @@
.mini-tireset {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
padding: 8px 10px;
background: rgba(0, 0, 0, 0.2);
@@ -521,6 +522,11 @@
font-size: 0.85rem;
}
.mini-tireset ::deep .insp-panel {
flex-basis: 100%;
margin-top: 4px;
}
@media (min-width: 480px) {
.mini-tireset {
gap: 10px;
@@ -590,6 +590,8 @@ else
<div class="tirestack-info">
<span class="vehicle">@(ts.TireStack.Vehicle?.ShortName ?? "Ohne KFZ")</span>
<span class="details">@(ts.TireStack.TireSize ?? "?") | @(ts.TireStack.StorageLocation?.Code ?? "-")</span>
<TireInspectionPanel TireStackId="@ts.TireStack.Id" AllowEdit="true" Compact="true"
ScannerSubtitle="@ts.TireStack.TicketNumber" />
</div>
</div>
}
@@ -949,6 +949,12 @@ else
</div>
</div>
@if (createdTireStack != null && !isInventoryMode)
{
<TireInspectionPanel TireStackId="@createdTireStack.Id" AllowEdit="true" InitiallyOpen="@(pendingReportSaved)"
ScannerSubtitle="@(selectedCustomer != null ? $"Kunde: {selectedCustomer.FullName}" : null)" />
}
<div class="step-actions">
<button class="btn btn-outline" @onclick="ResetForm">
@(isInventoryMode ? "Weiteren Stapel einlagern" : "Neuen Reifenstapel einlagern")
@@ -1185,6 +1191,7 @@ else
private bool isLoadingReport;
private TireReportData? scannedReport;
private TireReportData? pendingReport;
private bool pendingReportSaved;
private ReportAssignMode reportMode = ReportAssignMode.New;
private List<TireStack> customerStacksForReport = new();
private Guid? reportTargetStackId;
@@ -1999,12 +2006,14 @@ else
UserSession.CurrentUser?.Id);
createdTireStack = created;
pendingReportSaved = false;
if (pendingReport != null)
{
try
{
await TireStackService.AddInspectionAsync(pendingReport.ToInspection(created.Id, UserSession.CurrentUser?.Id));
pendingReportSaved = true;
}
catch (Exception ex)
{
@@ -105,7 +105,7 @@ else
</div>
<button class="btn-remove" @onclick="() => RemoveScannedItem(ts)" title="Entfernen" aria-label="Entfernen von @ts.TicketNumber">✕</button>
</div>
<div class="scanned-item-body">
<div class="scanned-customer">
@if (ts.Customer != null)
@@ -152,6 +152,8 @@ else
<span class="stored-date">Eingelagert: @ts.StoredAt.ToLocalTime().ToString("dd.MM.yyyy")</span>
<span class="days-stored">(@ts.DaysStored Tage)</span>
</div>
<TireInspectionPanel TireStackId="@ts.Id" AllowEdit="true" Compact="true"
ScannerSubtitle="@(ts.Customer != null ? $"Kunde: {ts.Customer.FullName}" : ts.TicketNumber)" />
</div>
</div>
}
@@ -205,6 +207,8 @@ else
}
</dd></div>
</dl>
<TireInspectionPanel TireStackId="@swapOutgoing.Id" AllowEdit="true" Compact="true"
ScannerSubtitle="@(swapOutgoing.Customer != null ? $"Kunde: {swapOutgoing.Customer.FullName}" : swapOutgoing.TicketNumber)" />
</div>
@* Incoming *@
@@ -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)