Promote job powders to top of Log Material dropdown
Powders already assigned to this job's coats appear under a 'This Job' section header, then a divider, then 'All Inventory' — so the most relevant choices are always one click away. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -503,9 +503,17 @@ public class JobsController : Controller
|
||||
.OrderBy(i => i.Name)
|
||||
.Select(i => new { i.Id, i.Name, i.Manufacturer, i.UnitOfMeasure, i.QuantityOnHand })
|
||||
.ToList();
|
||||
ViewBag.InventoryItemsForModal = System.Text.Json.JsonSerializer.Serialize(
|
||||
inventoryItemsForModal,
|
||||
new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase });
|
||||
var jsonOpts = new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase };
|
||||
ViewBag.InventoryItemsForModal = System.Text.Json.JsonSerializer.Serialize(inventoryItemsForModal, jsonOpts);
|
||||
|
||||
// IDs of powders already assigned to this job's coats — shown at top of log-material dropdown
|
||||
var jobPowderIds = (jobDto.Items ?? new List<PowderCoating.Application.DTOs.Job.JobItemDto>())
|
||||
.SelectMany(i => i.Coats ?? new List<PowderCoating.Application.DTOs.Job.JobItemCoatDto>())
|
||||
.Where(c => c.InventoryItemId.HasValue)
|
||||
.Select(c => c.InventoryItemId!.Value)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
ViewBag.JobPowderIds = System.Text.Json.JsonSerializer.Serialize(jobPowderIds, jsonOpts);
|
||||
|
||||
// Pre-logged powder grouped by InventoryItemId (for Complete Job modal pre-fill)
|
||||
ViewBag.PreLoggedPowder = allJobTransactions
|
||||
|
||||
Reference in New Issue
Block a user