Link inventory to powder catalog and flag discontinued items

Phase 5 (part): the inventory tie-in.

- Set InventoryItem.PowderCatalogItemId on the catalog-sourced create paths:
  directly in CreateIncomingFromCatalog, and via a new FindCatalogMatchAsync
  (Manufacturer + ManufacturerPartNumber) helper in Create.
- Inventory Details loads the linked catalog row (falling back to an identity
  match for items created before linking) and shows a "Discontinued by
  manufacturer — cannot reorder" badge + banner when it's discontinued.
  Deliberately distinct from the shop's own Active/Inactive status: existing
  stock can still be used and quoted, it just can't be reordered.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 11:18:15 -04:00
parent a07f6aa1a8
commit 4506c1f641
2 changed files with 56 additions and 0 deletions
@@ -69,6 +69,12 @@
{
<span class="badge bg-danger"><i class="bi bi-x-circle me-1"></i>Inactive</span>
}
@if ((bool?)ViewBag.CatalogDiscontinued == true)
{
<span class="badge bg-warning text-dark" title="Discontinued by the manufacturer — cannot reorder">
<i class="bi bi-slash-circle me-1"></i>Discontinued by manufacturer
</span>
}
</div>
</div>
<div class="d-flex gap-2">
@@ -103,6 +109,20 @@
<div><strong>Status:</strong> This item is inactive</div>
</div>
}
@if ((bool?)ViewBag.CatalogDiscontinued == true)
{
<div class="alert alert-warning alert-permanent d-flex align-items-center mb-3">
<i class="bi bi-slash-circle me-2"></i>
<div>
<strong>Discontinued by @(ViewBag.CatalogVendorName ?? "manufacturer"):</strong>
this powder has been discontinued and cannot be reordered. Existing stock can still be used and quoted.
@if (!string.IsNullOrEmpty(ViewBag.CatalogProductUrl as string))
{
<a href="@ViewBag.CatalogProductUrl" target="_blank" rel="noopener" class="alert-link ms-1">View product page</a>
}
</div>
</div>
}
<div class="row g-4">
<!-- Left Column -->