Add vendor supply categories with inventory auto-filter

Vendors can now be tagged with one or more inventory categories (Powder,
Chemical, etc.) via checkboxes on the Create/Edit form. The inventory
Create/Edit vendor dropdown automatically filters to matching vendors when
a category is selected; falls back to all vendors if none are tagged.
Includes migration AddVendorCategories (VendorInventoryCategories join table).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-23 09:52:34 -04:00
parent a7bf97a2df
commit d77b3778ac
13 changed files with 10983 additions and 7 deletions
@@ -195,6 +195,27 @@
</div>
</div>
<!-- Supply Categories -->
@if (ViewBag.VendorCategories is IEnumerable<PowderCoating.Core.Entities.InventoryCategoryLookup> cats && cats.Any())
{
<div class="mb-4">
<h5 class="border-bottom pb-2 mb-3">
<i class="bi bi-tags me-2 text-primary"></i>Supply Categories
</h5>
<div class="d-flex flex-wrap gap-3">
@foreach (var cat in cats)
{
<div class="form-check">
<input class="form-check-input" type="checkbox"
name="CategoryIds" value="@cat.Id" id="cat_@cat.Id" />
<label class="form-check-label" for="cat_@cat.Id">@cat.DisplayName</label>
</div>
}
</div>
<div class="form-text">Tag this vendor with the types of supplies they provide. Used to filter the vendor list when adding inventory items.</div>
</div>
}
<!-- Notes Section -->
<div class="mb-4">
<h5 class="border-bottom pb-2 mb-3">
@@ -198,6 +198,29 @@
</div>
</div>
<!-- Supply Categories -->
@if (ViewBag.VendorCategories is IEnumerable<PowderCoating.Core.Entities.InventoryCategoryLookup> cats && cats.Any())
{
var selectedCatIds = (HashSet<int>)ViewBag.SelectedCategoryIds;
<div class="mb-4">
<h5 class="border-bottom pb-2 mb-3">
<i class="bi bi-tags me-2 text-primary"></i>Supply Categories
</h5>
<div class="d-flex flex-wrap gap-3">
@foreach (var cat in cats)
{
<div class="form-check">
<input class="form-check-input" type="checkbox"
name="CategoryIds" value="@cat.Id" id="cat_@cat.Id"
@(selectedCatIds.Contains(cat.Id) ? "checked" : "") />
<label class="form-check-label" for="cat_@cat.Id">@cat.DisplayName</label>
</div>
}
</div>
<div class="form-text">Tag this vendor with the types of supplies they provide. Used to filter the vendor list when adding inventory items.</div>
</div>
}
<!-- Notes Section -->
<div class="mb-4">
<h5 class="border-bottom pb-2 mb-3">