@page "/stock" @inject StockItemService StockItemService @inject NavigationManager Navigation @using CutList.Core.Formatting Stock Items

Stock Items

Add Stock Item
@if (loading) {

Loading...

} else if (stockItems.Count == 0) {
No stock items found. Add your first stock item.
} else { @foreach (var item in stockItems) { }
Material Length Name Actions
@item.Material.DisplayName @ArchUnits.FormatFromInches((double)item.LengthInches) @(item.Name ?? "-") Edit
} @code { private List stockItems = new(); private bool loading = true; private ConfirmDialog deleteDialog = null!; private StockItem? itemToDelete; private string deleteMessage = ""; protected override async Task OnInitializedAsync() { stockItems = await StockItemService.GetAllAsync(); loading = false; } private void ConfirmDelete(StockItem item) { itemToDelete = item; deleteMessage = $"Are you sure you want to delete \"{item.Material.DisplayName} - {ArchUnits.FormatFromInches((double)item.LengthInches)}\"?"; deleteDialog.Show(); } private async Task DeleteConfirmed() { if (itemToDelete != null) { await StockItemService.DeleteAsync(itemToDelete.Id); stockItems = await StockItemService.GetAllAsync(); } } }