a0bdd2b5b4
Replace all corruption variants with HTML entities across 226 view files: - 3-char UTF-8-as-Win1252 sequences (ae-corruption) - Standalone smart/curly quotes that break C# Razor expressions - Partially re-corrupted variants where the 3rd byte was normalised to ASCII tools/Fix-Encoding.ps1: re-runnable sweep; uses [char] code points so the script itself never contains a literal non-ASCII character; supports -DryRun .githooks/pre-commit: blocks commits containing the ae-corruption byte signature (xc3xa2xe2x82xac); git core.hooksPath = .githooks so the hook is repo-committed and active for all future work on this machine. Build clean; 225 unit tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
234 lines
12 KiB
Plaintext
234 lines
12 KiB
Plaintext
@model List<PowderCoating.Core.Entities.CreditMemo>
|
|
@using PowderCoating.Core.Enums
|
|
@{
|
|
ViewData["Title"] = "Credit Memos";
|
|
var status = ViewBag.Status as string ?? "";
|
|
var search = ViewBag.Search as string ?? "";
|
|
int activeCount = ViewBag.ActiveCount;
|
|
decimal outstanding = ViewBag.OutstandingBalance;
|
|
}
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<h4 class="mb-0"><i class="bi bi-journal-minus me-2 text-primary"></i>Credit Memos</h4>
|
|
<a asp-action="Create" class="btn btn-primary">
|
|
<i class="bi bi-plus-lg me-1"></i>Issue Credit Memo
|
|
</a>
|
|
</div>
|
|
|
|
@if (TempData["Success"] != null)
|
|
{
|
|
<div class="alert alert-success alert-permanent alert-dismissible fade show">
|
|
@TempData["Success"]
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
|
</div>
|
|
}
|
|
@if (TempData["Error"] != null)
|
|
{
|
|
<div class="alert alert-danger alert-permanent alert-dismissible fade show">
|
|
@TempData["Error"]
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
|
</div>
|
|
}
|
|
|
|
@* ── Stats bar ─────────────────────────────────────────────────── *@
|
|
<div class="row g-3 mb-4">
|
|
<div class="col-sm-6 col-lg-3">
|
|
<div class="card border-0 bg-primary-subtle h-100">
|
|
<div class="card-body">
|
|
<div class="text-primary fw-semibold small">Active Memos</div>
|
|
<div class="fs-3 fw-bold">@activeCount</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-6 col-lg-3">
|
|
<div class="card border-0 bg-warning-subtle h-100">
|
|
<div class="card-body">
|
|
<div class="text-warning fw-semibold small">Outstanding Credit</div>
|
|
<div class="fs-3 fw-bold">@outstanding.ToString("C")</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-6 col-lg-3">
|
|
<div class="card border-0 bg-success-subtle h-100">
|
|
<div class="card-body">
|
|
<div class="text-success fw-semibold small">Total Memos</div>
|
|
<div class="fs-3 fw-bold">@Model.Count</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-6 col-lg-3">
|
|
<div class="card border-0 bg-secondary-subtle h-100">
|
|
<div class="card-body">
|
|
<div class="text-secondary fw-semibold small">Total Issued</div>
|
|
<div class="fs-3 fw-bold">@Model.Sum(m => m.Amount).ToString("C")</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@* ── Filters ──────────────────────────────────────────────────── *@
|
|
<div class="card mb-3">
|
|
<div class="card-body py-2">
|
|
<form method="get" class="row g-2 align-items-end">
|
|
<div class="col-md-4">
|
|
<label class="form-label small mb-1">Search</label>
|
|
<input name="search" value="@search" class="form-control form-control-sm"
|
|
placeholder="Customer, memo #, or reason…" />
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label small mb-1">Status</label>
|
|
<select name="status" class="form-select form-select-sm">
|
|
<option value="" selected="@(status == "")">All Statuses</option>
|
|
<option value="Active" selected="@(status == "Active")">Active</option>
|
|
<option value="PartiallyApplied" selected="@(status == "PartiallyApplied")">Partially Applied</option>
|
|
<option value="FullyApplied" selected="@(status == "FullyApplied")">Fully Applied</option>
|
|
<option value="Voided" selected="@(status == "Voided")">Voided</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-auto">
|
|
<button type="submit" class="btn btn-sm btn-primary">Filter</button>
|
|
<a asp-action="Index" class="btn btn-sm btn-outline-secondary ms-1">Clear</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
@* ── Table ────────────────────────────────────────────────────── *@
|
|
@if (!Model.Any())
|
|
{
|
|
<div class="alert alert-info alert-permanent">No credit memos found.</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="card">
|
|
<div class="mobile-card-view">
|
|
<div class="mobile-card-list">
|
|
@foreach (var m in Model)
|
|
{
|
|
var expired2 = m.ExpiryDate.HasValue && m.ExpiryDate.Value < DateTime.UtcNow
|
|
&& m.Status != CreditMemoStatus.FullyApplied
|
|
&& m.Status != CreditMemoStatus.Voided;
|
|
var (cmBadge, cmLabel) = m.Status switch
|
|
{
|
|
CreditMemoStatus.Active => ("bg-success-subtle text-success", "Active"),
|
|
CreditMemoStatus.PartiallyApplied => ("bg-warning-subtle text-warning", "Partial"),
|
|
CreditMemoStatus.FullyApplied => ("bg-secondary-subtle text-secondary", "Applied"),
|
|
CreditMemoStatus.Voided => ("bg-danger-subtle text-danger", "Voided"),
|
|
_ => ("bg-secondary-subtle text-secondary", m.Status.ToString())
|
|
};
|
|
var cmCustomer = string.IsNullOrWhiteSpace(m.Customer?.CompanyName)
|
|
? $"{m.Customer?.ContactFirstName} {m.Customer?.ContactLastName}".Trim()
|
|
: m.Customer!.CompanyName;
|
|
<div class="mobile-data-card" onclick="window.location='@Url.Action("Details", new { id = m.Id })'">
|
|
<div class="mobile-card-header">
|
|
<div class="mobile-card-icon" style="background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);">
|
|
<i class="bi bi-journal-minus"></i>
|
|
</div>
|
|
<div class="mobile-card-title">
|
|
<h6>@m.MemoNumber</h6>
|
|
<small>@cmCustomer</small>
|
|
</div>
|
|
</div>
|
|
<div class="mobile-card-body">
|
|
<div class="mobile-card-row">
|
|
<span class="mobile-card-label">Status</span>
|
|
<span class="mobile-card-value"><span class="badge @cmBadge">@cmLabel</span></span>
|
|
</div>
|
|
<div class="mobile-card-row">
|
|
<span class="mobile-card-label">Amount</span>
|
|
<span class="mobile-card-value">@m.Amount.ToString("C")</span>
|
|
</div>
|
|
<div class="mobile-card-row">
|
|
<span class="mobile-card-label">Remaining</span>
|
|
<span class="mobile-card-value @(m.RemainingBalance > 0 && m.Status != CreditMemoStatus.Voided ? "text-success fw-semibold" : "text-muted")">
|
|
@m.RemainingBalance.ToString("C")
|
|
</span>
|
|
</div>
|
|
<div class="mobile-card-row">
|
|
<span class="mobile-card-label">Issued</span>
|
|
<span class="mobile-card-value">@m.IssueDate.ToLocalTime().ToString("MM/dd/yy")</span>
|
|
</div>
|
|
@if (m.ExpiryDate.HasValue)
|
|
{
|
|
<div class="mobile-card-row">
|
|
<span class="mobile-card-label">Expires</span>
|
|
<span class="mobile-card-value @(expired2 ? "text-danger fw-semibold" : "")">
|
|
@m.ExpiryDate.Value.ToLocalTime().ToString("MM/dd/yy")
|
|
@if (expired2) { <small>(Expired)</small> }
|
|
</span>
|
|
</div>
|
|
}
|
|
</div>
|
|
<div class="mobile-card-footer">
|
|
<a asp-action="Details" asp-route-id="@m.Id" class="btn btn-sm btn-outline-primary" onclick="event.stopPropagation()">
|
|
Details
|
|
</a>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Memo #</th>
|
|
<th>Customer</th>
|
|
<th class="text-end">Amount</th>
|
|
<th class="text-end">Applied</th>
|
|
<th class="text-end">Remaining</th>
|
|
<th>Issue Date</th>
|
|
<th>Expires</th>
|
|
<th>Status</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var m in Model)
|
|
{
|
|
var rowClass = m.Status == CreditMemoStatus.Voided ? "text-muted" : "";
|
|
var expired = m.ExpiryDate.HasValue && m.ExpiryDate.Value < DateTime.UtcNow
|
|
&& m.Status != CreditMemoStatus.FullyApplied
|
|
&& m.Status != CreditMemoStatus.Voided;
|
|
<tr class="@rowClass">
|
|
<td>
|
|
<a asp-action="Details" asp-route-id="@m.Id" class="fw-semibold text-decoration-none">
|
|
@m.MemoNumber
|
|
</a>
|
|
</td>
|
|
<td>@(string.IsNullOrWhiteSpace(m.Customer?.CompanyName) ? $"{m.Customer?.ContactFirstName} {m.Customer?.ContactLastName}".Trim() : m.Customer.CompanyName)</td>
|
|
<td class="text-end">@m.Amount.ToString("C")</td>
|
|
<td class="text-end">@m.AmountApplied.ToString("C")</td>
|
|
<td class="text-end @(m.RemainingBalance > 0 && m.Status != CreditMemoStatus.Voided ? "text-success fw-semibold" : "")">
|
|
@m.RemainingBalance.ToString("C")
|
|
</td>
|
|
<td>@m.IssueDate.ToLocalTime().ToString("MM/dd/yyyy")</td>
|
|
<td class="@(expired ? "text-danger fw-semibold" : "")">
|
|
@(m.ExpiryDate.HasValue ? m.ExpiryDate.Value.ToLocalTime().ToString("MM/dd/yyyy") : "—")
|
|
@if (expired) { <small>(Expired)</small> }
|
|
</td>
|
|
<td>
|
|
@{
|
|
var (badgeClass, badgeLabel) = m.Status switch
|
|
{
|
|
CreditMemoStatus.Active => ("bg-success-subtle text-success", "Active"),
|
|
CreditMemoStatus.PartiallyApplied => ("bg-warning-subtle text-warning", "Partial"),
|
|
CreditMemoStatus.FullyApplied => ("bg-secondary-subtle text-secondary", "Applied"),
|
|
CreditMemoStatus.Voided => ("bg-danger-subtle text-danger", "Voided"),
|
|
_ => ("bg-secondary-subtle text-secondary", m.Status.ToString())
|
|
};
|
|
}
|
|
<span class="badge @badgeClass">@badgeLabel</span>
|
|
</td>
|
|
<td class="text-end">
|
|
<a asp-action="Details" asp-route-id="@m.Id"
|
|
class="btn btn-sm btn-outline-primary">Details</a>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
}
|