Restore all zeroed views + add bulk gift certificate creation

The HTML entity sweep script had a bug where it wrote empty files for any
view that contained no target Unicode characters, zeroing out 215 view files.
All views restored from the pre-sweep commit (cefdf3e).

Bulk gift certificate feature:
- BulkCreateGiftCertificateDto with Quantity (1-500), Amount, Reason, Expiry, Notes
- GenerateBulkGiftCertificatePdfAsync on IPdfService / PdfService: one Letter page
  per cert, reusing the same purple/gold branded ComposeGiftCertificateContent helper
- GiftCertificatesController: BulkCreate GET/POST, BulkResult GET, BulkDownloadPdf POST
- Views: BulkCreate.cshtml (form with live total preview), BulkResult.cshtml (table +
  Download All PDF button that POSTs cert IDs to avoid URL length limits)
- gift-certificate-bulk.js: live preview + spinner/disable on submit
- Index.cshtml: Bulk Create button added alongside New Certificate

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-14 20:09:22 -04:00
parent 3eda91f170
commit 4ec55e7290
240 changed files with 73116 additions and 0 deletions
@@ -0,0 +1,95 @@
@model PowderCoating.Web.ViewModels.Reports.SalesByCustomerViewModel
@{ ViewData["Title"] = "Sales by Customer"; }
<partial name="_ReportHeader" model="Model" />
<div class="row g-3 mb-3">
<div class="col-sm-4">
<div class="card text-bg-primary">
<div class="card-body py-2">
<div class="small">Total Invoiced</div>
<div class="fs-5 fw-bold">@Model.TotalInvoiced.ToString("C")</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card text-bg-success">
<div class="card-body py-2">
<div class="small">Total Collected</div>
<div class="fs-5 fw-bold">@Model.TotalPaid.ToString("C")</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card text-bg-warning">
<div class="card-body py-2">
<div class="small">Outstanding Balance</div>
<div class="fs-5 fw-bold">@((Model.TotalInvoiced - Model.TotalPaid).ToString("C"))</div>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="fw-semibold">Customer Sales Summary</span>
<span class="text-muted small">@Model.Items.Count customers</span>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-sm table-hover mb-0">
<thead class="table-light">
<tr>
<th>Customer</th>
<th>Type</th>
<th class="text-end">Invoices</th>
<th class="text-end">Total Invoiced</th>
<th class="text-end">Total Paid</th>
<th class="text-end">Balance Due</th>
<th class="text-end">Avg Invoice</th>
<th>Last Invoice</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Items)
{
<tr>
<td>
<a asp-controller="Customers" asp-action="Details" asp-route-id="@item.CustomerId">
@item.CustomerName
</a>
</td>
<td>
@if (item.IsCommercial)
{
<span class="badge bg-info-subtle text-info">Commercial</span>
}
else
{
<span class="badge bg-secondary-subtle text-secondary">Individual</span>
}
</td>
<td class="text-end">@item.InvoiceCount</td>
<td class="text-end fw-semibold">@item.TotalInvoiced.ToString("C")</td>
<td class="text-end text-success">@item.TotalPaid.ToString("C")</td>
<td class="text-end @(item.BalanceDue > 0 ? "text-warning fw-semibold" : "")">
@item.BalanceDue.ToString("C")
</td>
<td class="text-end">@item.AvgInvoiceValue.ToString("C")</td>
<td>@(item.LastInvoiceDate?.ToString("MMM d, yyyy") ?? "—")</td>
</tr>
}
</tbody>
<tfoot class="table-light fw-bold">
<tr>
<td colspan="3">Totals</td>
<td class="text-end">@Model.TotalInvoiced.ToString("C")</td>
<td class="text-end text-success">@Model.TotalPaid.ToString("C")</td>
<td class="text-end">@((Model.TotalInvoiced - Model.TotalPaid).ToString("C"))</td>
<td colspan="2"></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>