diff --git a/CutList.Web/Components/Pages/Jobs/Edit.razor b/CutList.Web/Components/Pages/Jobs/Edit.razor index 8a82c5b..ad02853 100644 --- a/CutList.Web/Components/Pages/Jobs/Edit.razor +++ b/CutList.Web/Components/Pages/Jobs/Edit.razor @@ -276,7 +276,6 @@ else Length - On Hand Qty to Use Priority @@ -289,7 +288,6 @@ else @ArchUnits.FormatFromInches((double)candidate.StockItem.LengthInches) - @candidate.StockItem.QuantityOnHand @@ -810,7 +808,7 @@ else @foreach (var stock in availableStockItems) { - + } diff --git a/CutList.Web/Components/Pages/Stock/Edit.razor b/CutList.Web/Components/Pages/Stock/Edit.razor index a865518..1f1654b 100644 --- a/CutList.Web/Components/Pages/Stock/Edit.razor +++ b/CutList.Web/Components/Pages/Stock/Edit.razor @@ -70,94 +70,6 @@ else - - @if (!IsNew) - { -
-
-
-
- Inventory - @stockItem.QuantityOnHand on hand -
- -
-
- @if (showStockForm) - { -
-
Stock Transaction
-
-
- - -
-
- - -
-
- - -
-
- @if (!string.IsNullOrEmpty(stockFormErrorMessage)) - { -
@stockFormErrorMessage
- } -
- - -
-
- } - - @if (transactions.Count == 0) - { -

No transaction history yet.

- } - else - { - - - - - - - - - - - @foreach (var txn in transactions) - { - - - - - - - } - -
DateTypeQtyNotes
@txn.CreatedAt.ToLocalTime().ToString("MM/dd/yy HH:mm") - @txn.Type - - @(txn.Quantity >= 0 ? "+" : "")@txn.Quantity - @(txn.Notes ?? "-")
- } -
-
-
- } } @@ -167,19 +79,10 @@ else private StockItem stockItem = new(); private List materials = new(); - private List transactions = new(); private bool loading = true; private bool saving; private string? errorMessage; - // Stock transaction form - private bool showStockForm; - private bool savingStockTransaction; - private string stockTransactionType = "add"; - private int stockQuantity; - private string? stockNotes; - private string? stockFormErrorMessage; - private bool IsNew => !Id.HasValue; protected override async Task OnInitializedAsync() @@ -195,83 +98,10 @@ else return; } stockItem = existing; - transactions = await StockItemService.GetTransactionHistoryAsync(Id.Value, 20); } loading = false; } - private string GetTransactionBadgeClass(StockTransactionType type) => type switch - { - StockTransactionType.Received => "bg-success", - StockTransactionType.Used => "bg-primary", - StockTransactionType.Adjustment => "bg-warning text-dark", - StockTransactionType.Scrapped => "bg-danger", - StockTransactionType.Returned => "bg-info", - _ => "bg-secondary" - }; - - private void ShowStockForm() - { - stockTransactionType = "add"; - stockQuantity = 0; - stockNotes = null; - stockFormErrorMessage = null; - showStockForm = true; - } - - private void CancelStockForm() - { - showStockForm = false; - stockFormErrorMessage = null; - } - - private async Task SaveStockTransactionAsync() - { - stockFormErrorMessage = null; - savingStockTransaction = true; - - try - { - if (stockQuantity <= 0 && stockTransactionType != "adjust") - { - stockFormErrorMessage = "Quantity must be greater than zero"; - return; - } - - if (stockTransactionType == "adjust" && stockQuantity < 0) - { - stockFormErrorMessage = "Quantity cannot be negative"; - return; - } - - switch (stockTransactionType) - { - case "add": - await StockItemService.AddStockAsync(Id!.Value, stockQuantity, stockNotes); - break; - case "adjust": - await StockItemService.AdjustStockAsync(Id!.Value, stockQuantity, stockNotes); - break; - case "scrap": - await StockItemService.ScrapStockAsync(Id!.Value, stockQuantity, stockNotes); - break; - } - - // Refresh - var updated = await StockItemService.GetByIdAsync(Id!.Value); - if (updated != null) - { - stockItem = updated; - } - transactions = await StockItemService.GetTransactionHistoryAsync(Id!.Value, 20); - showStockForm = false; - } - finally - { - savingStockTransaction = false; - } - } - private async Task SaveStockItemAsync() { errorMessage = null; diff --git a/CutList.Web/Components/Pages/Stock/Index.razor b/CutList.Web/Components/Pages/Stock/Index.razor index b92647c..51a9c04 100644 --- a/CutList.Web/Components/Pages/Stock/Index.razor +++ b/CutList.Web/Components/Pages/Stock/Index.razor @@ -7,13 +7,13 @@ Stock Items
-

Stock Items

+

Stock Items TEST123

Add Stock Item

- Stock items represent the specific lengths of material you have available for cutting. Each stock item links - a material to a length and tracks how many pieces you have on hand. + Stock items represent the specific lengths of material you can cut from. Add the lengths you typically + work with here, then pick from them when adding stock to a job.

@if (loading) @@ -46,7 +46,6 @@ else Grade Size Length - On Hand Actions @@ -59,16 +58,6 @@ else @item.Material.Grade @item.Material.Size @ArchUnits.FormatFromInches((double)item.LengthInches) - - @if (item.QuantityOnHand > 0) - { - @item.QuantityOnHand - } - else - { - 0 - } -