Replace literal Unicode special chars with HTML entities across all 233 views

Sweeps em dashes, en dashes, multiplication signs, ellipses, and curly quotes
to their HTML entity equivalents (— – × … ‘ ’)
in all .cshtml files, skipping <script> blocks. Prevents encoding corruption
from AI tools and Windows encoding mismatches that caused recurring symbol bugs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-14 19:16:17 -04:00
parent cefdf3e35c
commit 3eda91f170
233 changed files with 0 additions and 72627 deletions
@@ -1,213 +0,0 @@
@using PowderCoating.Application.DTOs.PurchaseOrder
@model CreatePurchaseOrderDto
@{
ViewData["Title"] = "New Purchase Order";
bool fromLowStock = (bool)(ViewBag.FromLowStock ?? false);
}
@section Scripts {
<script id="inventoryItemsData" type="application/json">@Html.Raw(ViewBag.InventoryItemsJson ?? "[]")</script>
<script id="existingItemsData" type="application/json">@Html.Raw(System.Text.Json.JsonSerializer.Serialize(Model.Items.Select(i => new {
type = i.InventoryItemId.HasValue ? "inventory" : "custom",
selectedId = i.InventoryItemId,
description = i.Description,
uom = i.UnitOfMeasure,
qty = i.QuantityOrdered,
cost = i.UnitCost,
notes = i.Notes
})))</script>
<script src="~/js/purchase-orders.js"></script>
}
<div class="d-flex justify-content-between align-items-center mb-3">
<div class="d-flex align-items-center gap-2">
<h4 class="mb-0">
@if (fromLowStock)
{
<span><i class="bi bi-lightning-charge text-warning me-1"></i> New PO — From Low Stock</span>
}
else
{
<span>New Purchase Order</span>
}
</h4>
<a tabindex="0" class="help-icon" role="button"
data-bs-toggle="popover" data-bs-placement="right" data-bs-trigger="focus"
data-bs-title="New Purchase Order"
data-bs-content="POs are saved as Draft and can be edited before submitting. Add line items from your inventory catalog or enter a custom description for items not in the system. Once submitted you can receive goods against the PO — receiving automatically updates inventory quantities. After receiving, use Create Bill to convert the PO into a payable bill.">
<i class="bi bi-question-circle"></i>
</a>
</div>
<a asp-action="Index" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-arrow-left"></i> Cancel
</a>
</div>
@if (!ViewData.ModelState.IsValid)
{
<div class="alert alert-danger alert-permanent">
<ul class="mb-0">
@foreach (var error in ViewData.ModelState.Values.SelectMany(v => v.Errors))
{
<li>@error.ErrorMessage</li>
}
</ul>
</div>
}
<form asp-action="Create" method="post">
@Html.AntiForgeryToken()
<div class="row g-3">
<!-- Left: Header + Line Items -->
<div class="col-lg-8">
<!-- Header -->
<div class="card border-0 shadow-sm mb-3">
<div class="card-header bg-transparent d-flex align-items-center gap-2">
<span class="fw-semibold">Order Details</span>
<a tabindex="0" class="help-icon" role="button"
data-bs-toggle="popover" data-bs-placement="right" data-bs-trigger="focus"
data-bs-title="Order Details"
data-bs-content="Select the vendor you're ordering from. Order Date defaults to today — adjust if you're entering a past order. Expected Delivery is used to flag the PO as Overdue on the list view if goods haven't arrived by that date.">
<i class="bi bi-question-circle"></i>
</a>
</div>
<div class="card-body">
<div class="row g-3">
<div class="col-md-6">
<label asp-for="VendorId" class="form-label fw-semibold">Vendor <span class="text-danger">*</span></label>
<select asp-for="VendorId" asp-items="@ViewBag.Vendors" class="form-select"
data-quick-add-url="/Vendors/Create" data-quick-add-title="Add New Vendor">
<option value="__new__">+ Add New Vendor…</option>
</select>
<span asp-validation-for="VendorId" class="text-danger small"></span>
</div>
<div class="col-md-3">
<label asp-for="OrderDate" class="form-label fw-semibold">Order Date</label>
<input asp-for="OrderDate" type="date" class="form-control"
value="@Model.OrderDate.ToString("yyyy-MM-dd")" />
</div>
<div class="col-md-3">
<label asp-for="ExpectedDeliveryDate" class="form-label fw-semibold">Expected Delivery</label>
<input asp-for="ExpectedDeliveryDate" type="date" class="form-control"
value="@Model.ExpectedDeliveryDate?.ToString("yyyy-MM-dd")" />
</div>
</div>
</div>
</div>
<!-- Line Items -->
<div class="card border-0 shadow-sm mb-3">
<div class="card-header bg-transparent d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center gap-2">
<span class="fw-semibold">Line Items</span>
<a tabindex="0" class="help-icon" role="button"
data-bs-toggle="popover" data-bs-placement="right" data-bs-trigger="focus"
data-bs-title="Line Items"
data-bs-content="Each row is one item you're ordering. Choose an inventory item from the catalog (the system will pre-fill SKU and default cost) or enter a custom description for non-catalog purchases. Qty and Unit Cost drive the line total. When goods are received, inventory quantities are updated automatically for catalog items.">
<i class="bi bi-question-circle"></i>
</a>
</div>
<button type="button" class="btn btn-sm btn-primary" onclick="addItem()">
<i class="bi bi-plus-lg"></i> Add Item
</button>
</div>
<div class="card-body p-0">
<div id="emptyItemsMessage" class="text-center py-4 text-muted"
style="display:@(Model.Items.Any() ? "none" : "block")">
<i class="bi bi-cart-plus d-block" style="font-size:2rem;"></i>
<p class="mb-0 mt-1 small">Click "Add Item" to add line items.</p>
</div>
<div class="table-responsive">
<table class="table mb-0">
<thead class="table-light small" id="lineItemsHeader"
style="display:@(Model.Items.Any() ? "" : "none")">
<tr>
<th style="min-width:240px">Item / Description</th>
<th style="width:95px">Qty</th>
<th style="width:110px">Unit Cost</th>
<th style="width:100px" class="text-end">Line Total</th>
<th>Notes</th>
<th style="width:50px"></th>
</tr>
</thead>
<tbody id="lineItemsBody">
</tbody>
</table>
</div>
</div>
</div>
<!-- Notes -->
<div class="card border-0 shadow-sm">
<div class="card-body">
<div class="row g-3">
<div class="col-md-6">
<label asp-for="Notes" class="form-label fw-semibold">Notes</label>
<textarea asp-for="Notes" class="form-control" rows="3"
placeholder="Visible on PO…"></textarea>
</div>
<div class="col-md-6">
<label asp-for="InternalNotes" class="form-label fw-semibold">Internal Notes</label>
<textarea asp-for="InternalNotes" class="form-control" rows="3"
placeholder="Internal use only…"></textarea>
</div>
</div>
</div>
</div>
</div>
<!-- Right: Totals + Submit -->
<div class="col-lg-4">
<div class="card border-0 shadow-sm mb-3">
<div class="card-header bg-transparent fw-semibold">Totals</div>
<div class="card-body">
<div class="d-flex justify-content-between mb-2">
<span class="text-muted">Subtotal</span>
<span id="subTotalDisplay" class="fw-semibold">$0.00</span>
</div>
<div class="mb-3">
<label asp-for="ShippingCost" class="form-label small text-muted">Shipping Cost</label>
<div class="input-group input-group-sm">
<span class="input-group-text">$</span>
<input asp-for="ShippingCost" id="shippingCostInput" type="number"
class="form-control" min="0" step="0.01" oninput="updateTotals()" />
</div>
</div>
<hr />
<div class="d-flex justify-content-between">
<span class="fw-bold">Grand Total</span>
<span id="grandTotalDisplay" class="fw-bold fs-5">$0.00</span>
</div>
</div>
</div>
<div class="d-grid gap-2">
<button type="submit" class="btn btn-primary">
<i class="bi bi-save me-1"></i> Save as Draft
</button>
<a asp-action="Index" class="btn btn-outline-secondary">Cancel</a>
</div>
</div>
</div>
</form>
<script>
document.addEventListener('DOMContentLoaded', () => {
const existing = JSON.parse(document.getElementById('existingItemsData')?.textContent || '[]');
const tbody = document.getElementById('lineItemsBody');
const header = document.getElementById('lineItemsHeader');
existing.forEach(item => {
const i = itemIndex++;
const tr = document.createElement('tr');
tr.setAttribute('data-index', i);
tr.innerHTML = buildRowHtml(i, item);
tbody.appendChild(tr);
});
if (header) header.style.display = existing.length > 0 ? '' : 'none';
toggleEmptyMessage();
updateTotals();
});
</script>
@@ -1,272 +0,0 @@
@using PowderCoating.Application.DTOs.PurchaseOrder
@using PowderCoating.Core.Enums
@model PurchaseOrderDto
@{
ViewData["Title"] = $"PO {Model.PoNumber}";
string StatusBadge(PurchaseOrderStatus s) => s switch {
PurchaseOrderStatus.Draft => "secondary",
PurchaseOrderStatus.Submitted => "primary",
PurchaseOrderStatus.PartiallyReceived => "warning",
PurchaseOrderStatus.Received => "success",
PurchaseOrderStatus.Cancelled => "danger",
_ => "secondary"
};
}
<div class="d-flex justify-content-between align-items-center mb-3">
<div>
<div class="d-flex align-items-center gap-2">
<h4 class="mb-0">
@Model.PoNumber
<span class="badge bg-@StatusBadge(Model.Status) ms-2">@Model.Status</span>
@if (Model.IsOverdue)
{
<span class="badge bg-danger ms-1">Overdue</span>
}
</h4>
<a tabindex="0" class="help-icon" role="button"
data-bs-toggle="popover" data-bs-placement="right" data-bs-trigger="focus"
data-bs-title="Purchase Order"
data-bs-content="PO lifecycle: Draft (editable) → Submit → Receive Goods (updates inventory) → Create Bill (creates a payable bill in Accounts Payable). Partially Received means some items have arrived; you can receive multiple partial shipments. Once fully received you can create a bill to pay the vendor. Cancelled POs can be deleted.">
<i class="bi bi-question-circle"></i>
</a>
</div>
<small class="text-muted">@Model.VendorName</small>
</div>
<div class="d-flex gap-2">
<a asp-action="DownloadPdf" asp-route-id="@Model.Id" class="btn btn-sm btn-outline-secondary" target="_blank">
<i class="bi bi-file-earmark-pdf me-1"></i> Download PDF
</a>
<a asp-action="Index" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-arrow-left"></i> Back to List
</a>
</div>
</div>
<div class="row g-3">
<!-- Left: Line Items -->
<div class="col-lg-8">
<div class="card border-0 shadow-sm">
<div class="card-header bg-transparent fw-semibold">
<i class="bi bi-list-ul me-1"></i> Line Items
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table mb-0">
<thead class="table-light small">
<tr>
<th>Item</th>
<th>SKU</th>
<th class="text-center">Ordered</th>
<th class="text-center">Received</th>
<th class="text-end">Unit Cost</th>
<th class="text-end">Line Total</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Items)
{
<tr class="@(item.IsFullyReceived ? "table-success" : "")">
<td>
@item.ItemName
@if (!string.IsNullOrEmpty(item.Notes))
{
<br /><small class="text-muted">@item.Notes</small>
}
</td>
<td class="text-muted small">@item.ItemSKU</td>
<td class="text-center">@item.QuantityOrdered.ToString("G29") @item.UnitOfMeasure</td>
<td class="text-center">
@item.QuantityReceived.ToString("G29")
@if (item.IsFullyReceived)
{
<i class="bi bi-check-circle-fill text-success ms-1"></i>
}
</td>
<td class="text-end">$@item.UnitCost.ToString("N2")</td>
<td class="text-end fw-semibold">$@item.LineTotal.ToString("N2")</td>
</tr>
}
</tbody>
<tfoot class="table-light">
<tr>
<td colspan="5" class="text-end">Subtotal</td>
<td class="text-end fw-semibold">$@Model.SubTotal.ToString("N2")</td>
</tr>
@if (Model.ShippingCost > 0)
{
<tr>
<td colspan="5" class="text-end text-muted">Shipping</td>
<td class="text-end text-muted">$@Model.ShippingCost.ToString("N2")</td>
</tr>
}
<tr>
<td colspan="5" class="text-end fw-bold">Total</td>
<td class="text-end fw-bold fs-5">$@Model.TotalAmount.ToString("N2")</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
@if (!string.IsNullOrEmpty(Model.Notes))
{
<div class="card border-0 shadow-sm mt-3">
<div class="card-header bg-transparent fw-semibold"><i class="bi bi-chat-text me-1"></i> Notes</div>
<div class="card-body">@Model.Notes</div>
</div>
}
@if (!string.IsNullOrEmpty(Model.InternalNotes))
{
<div class="card border-0 shadow-sm mt-3 border-warning">
<div class="card-header bg-transparent fw-semibold text-warning"><i class="bi bi-lock me-1"></i> Internal Notes</div>
<div class="card-body">@Model.InternalNotes</div>
</div>
}
</div>
<!-- Right: Actions + Info -->
<div class="col-lg-4">
<!-- Actions -->
<div class="card border-0 shadow-sm mb-3">
<div class="card-header bg-transparent d-flex align-items-center gap-2">
<span class="fw-semibold">Actions</span>
<a tabindex="0" class="help-icon" role="button"
data-bs-toggle="popover" data-bs-placement="left" data-bs-trigger="focus"
data-bs-title="Actions"
data-bs-content="Draft: Edit or Submit. Submit to lock line items and signal the order is placed. Submitted/Partially Received: Receive Goods to enter quantities arrived and update inventory. Cancel to void the order. Received: Create Bill converts this PO into a vendor bill for payment through Accounts Payable.">
<i class="bi bi-question-circle"></i>
</a>
</div>
<div class="card-body d-grid gap-2">
@if (Model.Status == PurchaseOrderStatus.Draft)
{
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-outline-primary">
<i class="bi bi-pencil me-1"></i> Edit
</a>
<form asp-action="Submit" asp-route-id="@Model.Id" method="post">
@Html.AntiForgeryToken()
<button type="submit" class="btn btn-primary w-100">
<i class="bi bi-send me-1"></i> Submit PO
</button>
</form>
<a asp-action="Delete" asp-route-id="@Model.Id" class="btn btn-outline-danger">
<i class="bi bi-trash me-1"></i> Delete
</a>
}
@if (Model.Status == PurchaseOrderStatus.Submitted || Model.Status == PurchaseOrderStatus.PartiallyReceived)
{
<a asp-action="Receive" asp-route-id="@Model.Id" class="btn btn-success">
<i class="bi bi-box-arrow-in-down me-1"></i> Receive Goods
</a>
<form asp-action="Cancel" asp-route-id="@Model.Id" method="post">
@Html.AntiForgeryToken()
<button type="submit" class="btn btn-outline-danger w-100"
onclick="return confirm('Cancel this purchase order?')">
<i class="bi bi-x-circle me-1"></i> Cancel PO
</button>
</form>
}
@if (Model.Status == PurchaseOrderStatus.Received)
{
<div class="text-center text-success">
<i class="bi bi-check-circle-fill fs-2"></i>
<p class="mb-0 fw-semibold">Fully Received</p>
@if (Model.ReceivedDate.HasValue)
{
<small class="text-muted">@Model.ReceivedDate.Value.ToString("MM/dd/yyyy")</small>
}
</div>
@if (Model.BillId.HasValue)
{
<a asp-controller="Bills" asp-action="Details" asp-route-id="@Model.BillId" class="btn btn-outline-primary w-100">
<i class="bi bi-receipt me-1"></i> View Bill @Model.BillNumber
</a>
}
else
{
<a asp-controller="Bills" asp-action="CreateFromPurchaseOrder" asp-route-purchaseOrderId="@Model.Id"
class="btn btn-primary w-100">
<i class="bi bi-receipt me-1"></i> Create Bill
</a>
}
}
@if (Model.Status == PurchaseOrderStatus.PartiallyReceived && !Model.BillId.HasValue)
{
<a asp-controller="Bills" asp-action="CreateFromPurchaseOrder" asp-route-purchaseOrderId="@Model.Id"
class="btn btn-outline-primary w-100">
<i class="bi bi-receipt me-1"></i> Create Bill (Partial)
</a>
}
@if (Model.BillId.HasValue && Model.Status == PurchaseOrderStatus.PartiallyReceived)
{
<a asp-controller="Bills" asp-action="Details" asp-route-id="@Model.BillId" class="btn btn-outline-primary w-100">
<i class="bi bi-receipt me-1"></i> View Bill @Model.BillNumber
</a>
}
@if (Model.Status == PurchaseOrderStatus.Cancelled)
{
<div class="text-center text-muted">
<i class="bi bi-x-circle fs-2"></i>
<p class="mb-0">Cancelled</p>
</div>
<a asp-action="Delete" asp-route-id="@Model.Id" class="btn btn-outline-danger btn-sm">
<i class="bi bi-trash me-1"></i> Delete
</a>
}
</div>
</div>
<!-- Vendor Info -->
<div class="card border-0 shadow-sm mb-3">
<div class="card-header bg-transparent fw-semibold"><i class="bi bi-truck me-1"></i> Vendor</div>
<div class="card-body small">
<p class="fw-semibold mb-1">@Model.VendorName</p>
@if (!string.IsNullOrEmpty(Model.VendorEmail))
{
<p class="mb-1"><i class="bi bi-envelope me-1 text-muted"></i> @Model.VendorEmail</p>
}
@if (!string.IsNullOrEmpty(Model.VendorPhone))
{
<p class="mb-0"><i class="bi bi-telephone me-1 text-muted"></i> @Model.VendorPhone</p>
}
</div>
</div>
<!-- Dates -->
<div class="card border-0 shadow-sm">
<div class="card-header bg-transparent d-flex align-items-center gap-2">
<span class="fw-semibold"><i class="bi bi-calendar3 me-1"></i> Dates</span>
<a tabindex="0" class="help-icon" role="button"
data-bs-toggle="popover" data-bs-placement="left" data-bs-trigger="focus"
data-bs-title="Dates"
data-bs-content="Order Date is when the PO was placed. Expected Delivery is when goods are due — if today's date is past this and the PO hasn't been fully received, the row shows as Overdue. Received date is set automatically when you record receipt of all items.">
<i class="bi bi-question-circle"></i>
</a>
</div>
<div class="card-body small">
<div class="d-flex justify-content-between mb-2">
<span class="text-muted">Order Date</span>
<span>@Model.OrderDate.ToString("MM/dd/yyyy")</span>
</div>
<div class="d-flex justify-content-between mb-2">
<span class="text-muted">Expected Delivery</span>
<span class="@(Model.IsOverdue ? "text-danger fw-semibold" : "")">
@(Model.ExpectedDeliveryDate?.ToString("MM/dd/yyyy") ?? "—")
</span>
</div>
@if (Model.ReceivedDate.HasValue)
{
<div class="d-flex justify-content-between">
<span class="text-muted">Received</span>
<span class="text-success">@Model.ReceivedDate.Value.ToString("MM/dd/yyyy")</span>
</div>
}
</div>
</div>
</div>
</div>
@@ -1,179 +0,0 @@
@using PowderCoating.Application.DTOs.PurchaseOrder
@model UpdatePurchaseOrderDto
@{
ViewData["Title"] = $"Edit {ViewBag.PoNumber}";
int poId = (int)ViewBag.PoId;
}
@section Scripts {
<script id="inventoryItemsData" type="application/json">@Html.Raw(ViewBag.InventoryItemsJson ?? "[]")</script>
<script id="existingItemsData" type="application/json">@Html.Raw(System.Text.Json.JsonSerializer.Serialize(Model.Items.Select(i => new {
type = i.InventoryItemId.HasValue ? "inventory" : "custom",
selectedId = i.InventoryItemId,
description = i.Description,
uom = i.UnitOfMeasure,
qty = i.QuantityOrdered,
cost = i.UnitCost,
notes = i.Notes
})))</script>
<script src="~/js/purchase-orders.js"></script>
}
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="mb-0">Edit @ViewBag.PoNumber</h4>
<a asp-action="Details" asp-route-id="@poId" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-arrow-left"></i> Cancel
</a>
</div>
<div class="alert alert-info alert-permanent d-flex align-items-center gap-2 mb-3">
<i class="bi bi-info-circle-fill"></i>
<span>Only <strong>Draft</strong> purchase orders can be edited.</span>
</div>
@if (!ViewData.ModelState.IsValid)
{
<div class="alert alert-danger alert-permanent">
<ul class="mb-0">
@foreach (var error in ViewData.ModelState.Values.SelectMany(v => v.Errors))
{
<li>@error.ErrorMessage</li>
}
</ul>
</div>
}
<form asp-action="Edit" asp-route-id="@poId" method="post">
@Html.AntiForgeryToken()
<div class="row g-3">
<div class="col-lg-8">
<div class="card border-0 shadow-sm mb-3">
<div class="card-header bg-transparent fw-semibold">Order Details</div>
<div class="card-body">
<div class="row g-3">
<div class="col-md-6">
<label asp-for="VendorId" class="form-label fw-semibold">Vendor <span class="text-danger">*</span></label>
<select asp-for="VendorId" asp-items="@ViewBag.Vendors" class="form-select"
data-quick-add-url="/Vendors/Create" data-quick-add-title="Add New Vendor">
<option value="__new__">+ Add New Vendor…</option>
</select>
<span asp-validation-for="VendorId" class="text-danger small"></span>
</div>
<div class="col-md-3">
<label asp-for="OrderDate" class="form-label fw-semibold">Order Date</label>
<input asp-for="OrderDate" type="date" class="form-control"
value="@Model.OrderDate.ToString("yyyy-MM-dd")" />
</div>
<div class="col-md-3">
<label asp-for="ExpectedDeliveryDate" class="form-label fw-semibold">Expected Delivery</label>
<input asp-for="ExpectedDeliveryDate" type="date" class="form-control"
value="@Model.ExpectedDeliveryDate?.ToString("yyyy-MM-dd")" />
</div>
</div>
</div>
</div>
<div class="card border-0 shadow-sm mb-3">
<div class="card-header bg-transparent d-flex justify-content-between align-items-center">
<span class="fw-semibold">Line Items</span>
<button type="button" class="btn btn-sm btn-primary" onclick="addItem()">
<i class="bi bi-plus-lg"></i> Add Item
</button>
</div>
<div class="card-body p-0">
<div id="emptyItemsMessage" class="text-center py-4 text-muted"
style="display:@(Model.Items.Any() ? "none" : "block")">
<i class="bi bi-cart-plus d-block" style="font-size:2rem;"></i>
<p class="mb-0 mt-1 small">Click "Add Item" to add line items.</p>
</div>
<div class="table-responsive">
<table class="table mb-0">
<thead class="table-light small" id="lineItemsHeader"
style="display:@(Model.Items.Any() ? "" : "none")">
<tr>
<th style="min-width:240px">Item / Description</th>
<th style="width:95px">Qty</th>
<th style="width:110px">Unit Cost</th>
<th style="width:100px" class="text-end">Line Total</th>
<th>Notes</th>
<th style="width:50px"></th>
</tr>
</thead>
<tbody id="lineItemsBody">
</tbody>
</table>
</div>
</div>
</div>
<div class="card border-0 shadow-sm">
<div class="card-body">
<div class="row g-3">
<div class="col-md-6">
<label asp-for="Notes" class="form-label fw-semibold">Notes</label>
<textarea asp-for="Notes" class="form-control" rows="3"
placeholder="Visible on PO…"></textarea>
</div>
<div class="col-md-6">
<label asp-for="InternalNotes" class="form-label fw-semibold">Internal Notes</label>
<textarea asp-for="InternalNotes" class="form-control" rows="3"
placeholder="Internal use only…"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card border-0 shadow-sm mb-3">
<div class="card-header bg-transparent fw-semibold">Totals</div>
<div class="card-body">
<div class="d-flex justify-content-between mb-2">
<span class="text-muted">Subtotal</span>
<span id="subTotalDisplay" class="fw-semibold">$0.00</span>
</div>
<div class="mb-3">
<label asp-for="ShippingCost" class="form-label small text-muted">Shipping Cost</label>
<div class="input-group input-group-sm">
<span class="input-group-text">$</span>
<input asp-for="ShippingCost" id="shippingCostInput" type="number"
class="form-control" min="0" step="0.01" oninput="updateTotals()" />
</div>
</div>
<hr />
<div class="d-flex justify-content-between">
<span class="fw-bold">Grand Total</span>
<span id="grandTotalDisplay" class="fw-bold fs-5">$0.00</span>
</div>
</div>
</div>
<div class="d-grid gap-2">
<button type="submit" class="btn btn-primary">
<i class="bi bi-save me-1"></i> Save Changes
</button>
<a asp-action="Details" asp-route-id="@poId" class="btn btn-outline-secondary">Cancel</a>
</div>
</div>
</div>
</form>
<script>
document.addEventListener('DOMContentLoaded', () => {
const existing = JSON.parse(document.getElementById('existingItemsData')?.textContent || '[]');
const tbody = document.getElementById('lineItemsBody');
const header = document.getElementById('lineItemsHeader');
existing.forEach(item => {
const i = itemIndex++;
const tr = document.createElement('tr');
tr.setAttribute('data-index', i);
tr.innerHTML = buildRowHtml(i, item);
tbody.appendChild(tr);
});
if (header) header.style.display = existing.length > 0 ? '' : 'none';
toggleEmptyMessage();
updateTotals();
});
</script>
@@ -1,230 +0,0 @@
@using PowderCoating.Application.DTOs.Common
@using PowderCoating.Application.DTOs.PurchaseOrder
@using PowderCoating.Core.Enums
@model PagedResult<PurchaseOrderListDto>
@{
ViewData["Title"] = "Purchase Orders";
var searchTerm = ViewBag.SearchTerm as string;
var statusFilter = ViewBag.StatusFilter as PurchaseOrderStatus?;
var vendorId = ViewBag.VendorId as int?;
var dateFrom = ViewBag.DateFrom as string;
var dateTo = ViewBag.DateTo as string;
var sortCol = (ViewBag.SortColumn as string ?? "orderdate").ToLower();
var sortDir = (ViewBag.SortDirection as string ?? "desc").ToLower();
string SortIcon(string col) {
if (col != sortCol) return "<i class=\"bi bi-arrow-down-up text-muted opacity-50\"></i>";
return sortDir == "asc"
? "<i class=\"bi bi-sort-up\"></i>"
: "<i class=\"bi bi-sort-down\"></i>";
}
string SortHref(string col) {
var dir = (col == sortCol && sortDir == "asc") ? "desc" : "asc";
return $"?sortColumn={col}&sortDirection={dir}&searchTerm={searchTerm}&statusFilter={statusFilter}&vendorId={vendorId}&dateFrom={dateFrom}&dateTo={dateTo}&pageSize={Model.PageSize}";
}
string StatusBadge(PurchaseOrderStatus s) => s switch {
PurchaseOrderStatus.Draft => "secondary",
PurchaseOrderStatus.Submitted => "primary",
PurchaseOrderStatus.PartiallyReceived => "warning",
PurchaseOrderStatus.Received => "success",
PurchaseOrderStatus.Cancelled => "danger",
_ => "secondary"
};
}
<!-- Stats Cards -->
<div class="row g-3 mb-4">
<div class="col-6 col-md-3">
<div class="card border-0 shadow-sm">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div>
<p class="text-muted mb-1 small">Total POs</p>
<h3 class="mb-0 fw-bold">@ViewBag.TotalCount</h3>
</div>
<div class="rounded-circle p-3" style="background:#dbeafe;">
<i class="bi bi-cart-check text-primary" style="font-size:1.4rem;"></i>
</div>
</div>
</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="card border-0 shadow-sm">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div>
<p class="text-muted mb-1 small">Open</p>
<h3 class="mb-0 fw-bold">@ViewBag.OpenCount</h3>
</div>
<div class="rounded-circle p-3" style="background:#fef9c3;">
<i class="bi bi-hourglass-split text-warning" style="font-size:1.4rem;"></i>
</div>
</div>
</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="card border-0 shadow-sm">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div>
<p class="text-muted mb-1 small">Committed Value</p>
<h3 class="mb-0 fw-bold">$@ViewBag.CommittedValue?.ToString("N2")</h3>
</div>
<div class="rounded-circle p-3" style="background:#dcfce7;">
<i class="bi bi-currency-dollar text-success" style="font-size:1.4rem;"></i>
</div>
</div>
</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="card border-0 shadow-sm">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div>
<p class="text-muted mb-1 small">Overdue</p>
<h3 class="mb-0 fw-bold text-danger">@ViewBag.OverdueCount</h3>
</div>
<div class="rounded-circle p-3" style="background:#fee2e2;">
<i class="bi bi-exclamation-triangle text-danger" style="font-size:1.4rem;"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Toolbar -->
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2">
<div class="d-flex align-items-center gap-2">
<h4 class="mb-0">Purchase Orders</h4>
<a tabindex="0" class="help-icon" role="button"
data-bs-toggle="popover" data-bs-placement="right" data-bs-trigger="focus"
data-bs-title="Purchase Orders"
data-bs-content="Track orders placed with vendors. Lifecycle: Draft (editable) → Submitted (sent to vendor) → Partially Received / Received → Create Bill. Overdue rows are highlighted red when Expected Delivery is past. Open shows Submitted + Partially Received POs. Use From Low Stock to pre-populate a PO with items that have fallen below their reorder point.">
<i class="bi bi-question-circle"></i>
</a>
</div>
<div class="d-flex gap-2">
<a asp-action="CreateFromLowStock" class="btn btn-outline-warning btn-sm">
<i class="bi bi-lightning-charge"></i> From Low Stock
</a>
<a asp-action="Create" class="btn btn-primary btn-sm">
<i class="bi bi-plus-lg"></i> New Purchase Order
</a>
</div>
</div>
<!-- Filters -->
<form method="get" class="card border-0 shadow-sm mb-3">
<div class="card-body py-2">
<div class="row g-2 align-items-end">
<div class="col-md-3">
<input type="text" name="searchTerm" value="@searchTerm" class="form-control form-control-sm"
placeholder="Search PO#, vendor, notes…" />
</div>
<div class="col-md-2">
<select name="statusFilter" class="form-select form-select-sm">
<option value="">All Statuses</option>
@foreach (var s in Enum.GetValues<PurchaseOrderStatus>())
{
<option value="@((int)s)" selected="@(statusFilter == s)">@s.ToString()</option>
}
</select>
</div>
<div class="col-md-2">
<select name="vendorId" class="form-select form-select-sm" asp-items="@ViewBag.VendorList">
</select>
</div>
<div class="col-md-2">
<input type="date" name="dateFrom" value="@dateFrom" class="form-control form-control-sm" title="From" />
</div>
<div class="col-md-2">
<input type="date" name="dateTo" value="@dateTo" class="form-control form-control-sm" title="To" />
</div>
<div class="col-md-1 d-flex gap-1">
<button type="submit" class="btn btn-primary btn-sm flex-grow-1">
<i class="bi bi-search"></i>
</button>
<a asp-action="Index" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-x"></i>
</a>
</div>
</div>
</div>
<input type="hidden" name="sortColumn" value="@sortCol" />
<input type="hidden" name="sortDirection" value="@sortDir" />
<input type="hidden" name="pageSize" value="@Model.PageSize" />
</form>
<!-- Grid -->
<div class="card border-0 shadow-sm">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead class="table-light">
<tr>
<th><a href="@SortHref("ponumber")" class="text-decoration-none text-dark">PO # @Html.Raw(SortIcon("ponumber"))</a></th>
<th><a href="@SortHref("vendor")" class="text-decoration-none text-dark">Vendor @Html.Raw(SortIcon("vendor"))</a></th>
<th><a href="@SortHref("status")" class="text-decoration-none text-dark">Status @Html.Raw(SortIcon("status"))</a></th>
<th><a href="@SortHref("orderdate")" class="text-decoration-none text-dark">Order Date @Html.Raw(SortIcon("orderdate"))</a></th>
<th><a href="@SortHref("expected")" class="text-decoration-none text-dark">Expected @Html.Raw(SortIcon("expected"))</a></th>
<th class="text-center">Items</th>
<th class="text-end"><a href="@SortHref("total")" class="text-decoration-none text-dark">Total @Html.Raw(SortIcon("total"))</a></th>
<th></th>
</tr>
</thead>
<tbody>
@if (!Model.Items.Any())
{
<tr>
<td colspan="8" class="text-center py-5 text-muted">
<i class="bi bi-cart-x d-block" style="font-size:2.5rem;"></i>
<p class="mt-2 mb-0">No purchase orders found.</p>
<a asp-action="Create" class="btn btn-primary btn-sm mt-3">Create Your First PO</a>
</td>
</tr>
}
else
{
@foreach (var po in Model.Items)
{
<tr class="@(po.IsOverdue ? "table-danger" : "")">
<td>
<a asp-action="Details" asp-route-id="@po.Id" class="fw-semibold text-decoration-none">
@po.PoNumber
</a>
@if (po.IsOverdue)
{
<span class="badge bg-danger ms-1">Overdue</span>
}
</td>
<td>@po.VendorName</td>
<td>
<span class="badge bg-@StatusBadge(po.Status)">
@po.Status.ToString()
</span>
</td>
<td>@po.OrderDate.ToString("MM/dd/yyyy")</td>
<td>@(po.ExpectedDeliveryDate?.ToString("MM/dd/yyyy") ?? "—")</td>
<td class="text-center">@po.ItemCount</td>
<td class="text-end fw-semibold">$@po.TotalAmount.ToString("N2")</td>
<td class="text-end">
<a asp-action="Details" asp-route-id="@po.Id" class="btn btn-sm btn-outline-primary">
<i class="bi bi-eye"></i>
</a>
</td>
</tr>
}
}
</tbody>
</table>
</div>
</div>
</div>
<partial name="_Pagination" model="Model" />
@@ -1,153 +0,0 @@
@using PowderCoating.Application.DTOs.PurchaseOrder
@model ReceivePurchaseOrderDto
@{
ViewData["Title"] = $"Receive Goods — {ViewBag.PoNumber}";
int poId = (int)ViewBag.PoId;
}
@section Scripts {
<script src="~/js/purchase-orders.js"></script>
}
<div class="d-flex justify-content-between align-items-center mb-3">
<div>
<div class="d-flex align-items-center gap-2">
<h4 class="mb-0">Receive Goods</h4>
<a tabindex="0" class="help-icon" role="button"
data-bs-toggle="popover" data-bs-placement="right" data-bs-trigger="focus"
data-bs-title="Receive Goods"
data-bs-content="Enter the quantity actually received for each line item. Use Receive All to fill in the full remaining quantity for every item. You can receive partial quantities — the PO becomes Partially Received and you can come back to record the rest later. Saving automatically adds the received quantities to inventory on hand and records purchase transactions.">
<i class="bi bi-question-circle"></i>
</a>
</div>
<small class="text-muted">@ViewBag.PoNumber · @ViewBag.VendorName · Ordered @((DateTime)ViewBag.OrderDate).ToString("MM/dd/yyyy")</small>
</div>
<a asp-action="Details" asp-route-id="@poId" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-arrow-left"></i> Back
</a>
</div>
<form asp-action="Receive" asp-route-id="@poId" method="post">
@Html.AntiForgeryToken()
<div class="row g-3">
<div class="col-lg-8">
<div class="card border-0 shadow-sm">
<div class="card-header bg-transparent d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center gap-2">
<span class="fw-semibold">Items to Receive</span>
<a tabindex="0" class="help-icon" role="button"
data-bs-toggle="popover" data-bs-placement="right" data-bs-trigger="focus"
data-bs-title="Items to Receive"
data-bs-content="Remaining = Ordered minus Previously Received. Enter how many units arrived in this shipment — you can enter less than Remaining for a partial delivery. Rows already fully received are shown in green and cannot be edited. Only inventory catalog items will have their stock quantities updated on save.">
<i class="bi bi-question-circle"></i>
</a>
</div>
<div class="d-flex gap-2">
<button type="button" class="btn btn-sm btn-outline-success" onclick="receiveAll()">
<i class="bi bi-check-all"></i> Receive All
</button>
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="clearAll()">
Clear
</button>
</div>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table mb-0">
<thead class="table-light small">
<tr>
<th>Item</th>
<th class="text-center">Ordered</th>
<th class="text-center">Previously Received</th>
<th class="text-center">Remaining</th>
<th style="width:130px">Qty to Receive</th>
</tr>
</thead>
<tbody>
@for (int i = 0; i < Model.Items.Count; i++)
{
var item = Model.Items[i];
bool fullyReceived = item.QuantityAlreadyReceived >= item.QuantityOrdered;
<tr class="@(fullyReceived ? "table-success text-muted" : "")">
<td>
<input type="hidden" name="Items[@i].PurchaseOrderItemId" value="@item.PurchaseOrderItemId" />
<input type="hidden" name="Items[@i].InventoryItemId" value="@item.InventoryItemId" />
<input type="hidden" name="Items[@i].ItemName" value="@item.ItemName" />
<input type="hidden" name="Items[@i].ItemSKU" value="@item.ItemSKU" />
<input type="hidden" name="Items[@i].UnitOfMeasure" value="@item.UnitOfMeasure" />
<input type="hidden" name="Items[@i].QuantityOrdered" value="@item.QuantityOrdered" />
<input type="hidden" name="Items[@i].QuantityAlreadyReceived" value="@item.QuantityAlreadyReceived" />
<input type="hidden" name="Items[@i].QuantityRemaining" value="@item.QuantityRemaining" />
<span class="fw-semibold">@item.ItemName</span>
<br /><small class="text-muted">@item.ItemSKU</small>
</td>
<td class="text-center">@item.QuantityOrdered.ToString("G29") @item.UnitOfMeasure</td>
<td class="text-center">@item.QuantityAlreadyReceived.ToString("G29")</td>
<td class="text-center">
@if (fullyReceived)
{
<span class="badge bg-success"><i class="bi bi-check"></i> Done</span>
}
else
{
@item.QuantityRemaining.ToString("G29")
}
</td>
<td>
@if (!fullyReceived)
{
<input type="number" name="Items[@i].QuantityToReceive"
class="form-control form-control-sm receive-qty-input"
value="@item.QuantityToReceive"
min="0" step="0.001"
max="@item.QuantityRemaining"
data-remaining="@item.QuantityRemaining" />
}
else
{
<input type="hidden" name="Items[@i].QuantityToReceive" value="0" />
<span class="text-muted">—</span>
}
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card border-0 shadow-sm mb-3">
<div class="card-header bg-transparent fw-semibold">Receipt Details</div>
<div class="card-body">
<div class="mb-3">
<label asp-for="ReceivedDate" class="form-label fw-semibold">Received Date <span class="text-danger">*</span></label>
<input asp-for="ReceivedDate" type="date" class="form-control"
value="@Model.ReceivedDate.ToString("yyyy-MM-dd")" required />
</div>
<div class="mb-3">
<label asp-for="Notes" class="form-label fw-semibold">Notes</label>
<textarea asp-for="Notes" class="form-control" rows="3"
placeholder="Any notes about this receipt…"></textarea>
</div>
</div>
</div>
<div class="alert alert-info alert-permanent small">
<i class="bi bi-info-circle me-1"></i>
Receiving goods will automatically update inventory quantities and record purchase transactions.
</div>
<div class="d-grid gap-2">
<button type="submit" class="btn btn-success">
<i class="bi bi-box-arrow-in-down me-1"></i> Record Receipt
</button>
<a asp-action="Details" asp-route-id="@poId" class="btn btn-outline-secondary">Cancel</a>
</div>
</div>
</div>
</form>
@@ -1,42 +0,0 @@
@{
ViewData["Title"] = "Create PO From Low Stock";
}
<div class="d-flex justify-content-between align-items-center mb-3">
<div class="d-flex align-items-center gap-2">
<h4 class="mb-0"><i class="bi bi-lightning-charge text-warning me-1"></i> Create PO From Low Stock</h4>
<a tabindex="0" class="help-icon" role="button"
data-bs-toggle="popover" data-bs-placement="right" data-bs-trigger="focus"
data-bs-title="Create PO From Low Stock"
data-bs-content="These vendors have one or more inventory items that have fallen to or below their Reorder Point. Selecting a vendor pre-populates a new purchase order with all their low-stock items at their standard Reorder Quantity — you can adjust quantities before saving. Items without a Primary Vendor assigned will not appear here.">
<i class="bi bi-question-circle"></i>
</a>
</div>
<a asp-action="Index" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-arrow-left"></i> Back
</a>
</div>
<p class="text-muted mb-4">
The following vendors have low-stock items assigned to them. Select a vendor to pre-populate a purchase order.
</p>
<div class="row g-3">
@foreach (var vendor in (dynamic)ViewBag.VendorGroups)
{
<div class="col-md-4">
<div class="card border-0 shadow-sm h-100">
<div class="card-body">
<h5 class="fw-semibold mb-1">@vendor.VendorName</h5>
<p class="text-muted mb-3">
<span class="badge bg-warning text-dark">@vendor.ItemCount low-stock item@(vendor.ItemCount == 1 ? "" : "s")</span>
</p>
<a asp-action="CreateFromLowStock" asp-route-vendorId="@vendor.VendorId"
class="btn btn-primary btn-sm stretched-link">
<i class="bi bi-cart-plus me-1"></i> Create PO for this Vendor
</a>
</div>
</div>
</div>
}
</div>