Add manufacturer to Log Material item combobox
Shows manufacturer name as muted secondary text in each dropdown row and includes it in the search filter, so users can find a powder by brand when multiple items share a similar name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -501,7 +501,7 @@ public class JobsController : Controller
|
|||||||
// Inventory items for the manual log-material modal
|
// Inventory items for the manual log-material modal
|
||||||
var inventoryItemsForModal = (await _unitOfWork.InventoryItems.GetAllAsync())
|
var inventoryItemsForModal = (await _unitOfWork.InventoryItems.GetAllAsync())
|
||||||
.OrderBy(i => i.Name)
|
.OrderBy(i => i.Name)
|
||||||
.Select(i => new { i.Id, i.Name, i.UnitOfMeasure, i.QuantityOnHand })
|
.Select(i => new { i.Id, i.Name, i.Manufacturer, i.UnitOfMeasure, i.QuantityOnHand })
|
||||||
.ToList();
|
.ToList();
|
||||||
ViewBag.InventoryItemsForModal = System.Text.Json.JsonSerializer.Serialize(
|
ViewBag.InventoryItemsForModal = System.Text.Json.JsonSerializer.Serialize(
|
||||||
inventoryItemsForModal,
|
inventoryItemsForModal,
|
||||||
|
|||||||
@@ -1108,7 +1108,7 @@
|
|||||||
<div class="position-relative">
|
<div class="position-relative">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" id="lmItemSearch"
|
<input type="text" class="form-control" id="lmItemSearch"
|
||||||
placeholder="Search by name or unit…" autocomplete="off"
|
placeholder="Search by name or manufacturer…" autocomplete="off"
|
||||||
oninput="lmComboInput()"
|
oninput="lmComboInput()"
|
||||||
onfocus="lmComboOpen()"
|
onfocus="lmComboOpen()"
|
||||||
onkeydown="lmComboKey(event)">
|
onkeydown="lmComboKey(event)">
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
if (!dd) return;
|
if (!dd) return;
|
||||||
const filtered = query
|
const filtered = query
|
||||||
? _items.filter(it => it.name.toLowerCase().includes(query) ||
|
? _items.filter(it => it.name.toLowerCase().includes(query) ||
|
||||||
|
(it.manufacturer && it.manufacturer.toLowerCase().includes(query)) ||
|
||||||
(it.unitOfMeasure && it.unitOfMeasure.toLowerCase().includes(query)))
|
(it.unitOfMeasure && it.unitOfMeasure.toLowerCase().includes(query)))
|
||||||
: _items;
|
: _items;
|
||||||
if (filtered.length === 0) {
|
if (filtered.length === 0) {
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
}
|
}
|
||||||
dd.innerHTML = filtered.map(it => {
|
dd.innerHTML = filtered.map(it => {
|
||||||
const label = it.name + (it.unitOfMeasure ? ' (' + it.unitOfMeasure + ')' : '');
|
const label = it.name + (it.unitOfMeasure ? ' (' + it.unitOfMeasure + ')' : '');
|
||||||
|
const mfr = it.manufacturer ? `<span class="text-muted ms-1" style="font-size:.78rem;">${escLm(it.manufacturer)}</span>` : '';
|
||||||
return `<div class="lm-item-opt" style="padding:.35rem .75rem;font-size:.875rem;cursor:pointer;"
|
return `<div class="lm-item-opt" style="padding:.35rem .75rem;font-size:.875rem;cursor:pointer;"
|
||||||
data-id="${it.id}"
|
data-id="${it.id}"
|
||||||
data-qty="${it.quantityOnHand}"
|
data-qty="${it.quantityOnHand}"
|
||||||
@@ -56,7 +58,7 @@
|
|||||||
onmousedown="event.preventDefault(); lmComboSelect(this)"
|
onmousedown="event.preventDefault(); lmComboSelect(this)"
|
||||||
onmouseenter="this.style.background='#f0f4ff'"
|
onmouseenter="this.style.background='#f0f4ff'"
|
||||||
onmouseleave="this.classList.contains('lm-active') ? null : this.style.background=''">
|
onmouseleave="this.classList.contains('lm-active') ? null : this.style.background=''">
|
||||||
${escLm(label)}
|
${escLm(label)}${mfr}
|
||||||
</div>`;
|
</div>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user