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,148 @@
@model List<PowderCoating.Core.Entities.ReleaseNote>
@{
ViewData["Title"] = "Release Notes Manager";
string TagBadge(string tag) => tag switch {
"Feature" => "bg-primary",
"Improvement" => "bg-info",
"Fix" => "bg-warning text-dark",
"Breaking" => "bg-danger",
"Security" => "bg-dark",
_ => "bg-secondary"
};
}
<div class="container-fluid py-3">
<div class="d-flex align-items-center justify-content-between mb-3">
<div>
<h4 class="mb-0"><i class="bi bi-journal-text me-2 text-primary"></i>Release Notes Manager</h4>
<small class="text-muted">Publish versioned changelogs visible to all platform users</small>
</div>
<div class="d-flex gap-2">
<a asp-action="Index" class="btn btn-outline-secondary btn-sm" target="_blank">
<i class="bi bi-eye me-1"></i>Preview Changelog
</a>
<a asp-action="Create" class="btn btn-primary btn-sm">
<i class="bi bi-plus-circle me-1"></i>New Release Note
</a>
</div>
</div>
@if (TempData["Success"] != null)
{
<div class="alert alert-success alert-dismissible fade show" role="alert">
<i class="bi bi-check-circle me-2"></i>@TempData["Success"]
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
}
@* Summary cards *@
<div class="row g-3 mb-3">
<div class="col-6 col-md-3">
<div class="card border-0 shadow-sm text-center py-3">
<div class="fs-3 fw-bold">@Model.Count</div>
<div class="small text-muted">Total</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="card border-0 shadow-sm text-center py-3">
<div class="fs-3 fw-bold text-success">@Model.Count(r => r.IsPublished)</div>
<div class="small text-muted">Published</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="card border-0 shadow-sm text-center py-3">
<div class="fs-3 fw-bold text-warning">@Model.Count(r => !r.IsPublished)</div>
<div class="small text-muted">Draft</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="card border-0 shadow-sm text-center py-3">
<div class="fs-3 fw-bold text-primary">@Model.Count(r => r.IsPublished && r.ReleasedAt >= DateTime.UtcNow.AddDays(-30))</div>
<div class="small text-muted">Last 30 Days</div>
</div>
</div>
</div>
<div class="card border-0 shadow-sm">
<div class="table-responsive">
<table class="table table-hover align-middle mb-0 small">
<thead class="table-light">
<tr>
<th style="width:100px">Version</th>
<th>Title</th>
<th style="width:100px">Tag</th>
<th style="width:110px">Released</th>
<th style="width:90px">Status</th>
<th style="width:130px">Created By</th>
<th style="width:100px"></th>
</tr>
</thead>
<tbody>
@if (!Model.Any())
{
<tr>
<td colspan="7" class="text-center text-muted py-5">
<i class="bi bi-journal-x fs-1 d-block mb-2 opacity-25"></i>
No release notes yet. <a asp-action="Create">Create the first one.</a>
</td>
</tr>
}
@foreach (var note in Model)
{
<tr class="@(note.IsPublished ? "" : "opacity-75")">
<td>
<code class="fw-semibold">v@(note.Version)</code>
</td>
<td>
<div class="fw-medium">@note.Title</div>
@if (note.Body.Length > 80)
{
<small class="text-muted">@note.Body[..80]…</small>
}
</td>
<td>
<span class="badge @TagBadge(note.Tag)">@note.Tag</span>
</td>
<td class="text-muted">@note.ReleasedAt.ToString("MM/dd/yyyy")</td>
<td>
@if (note.IsPublished)
{
<span class="badge bg-success">Published</span>
}
else
{
<span class="badge bg-warning text-dark">Draft</span>
}
</td>
<td class="text-muted">@note.CreatedByUserName</td>
<td>
<div class="d-flex gap-1">
<a asp-action="Edit" asp-route-id="@note.Id"
class="btn btn-sm btn-outline-secondary py-0 px-2" title="Edit">
<i class="bi bi-pencil"></i>
</a>
<form asp-action="TogglePublish" asp-route-id="@note.Id" method="post" class="d-inline">
@Html.AntiForgeryToken()
<button type="submit"
class="btn btn-sm @(note.IsPublished ? "btn-outline-warning" : "btn-outline-success") py-0 px-2"
title="@(note.IsPublished ? "Unpublish" : "Publish")">
<i class="bi @(note.IsPublished ? "bi-eye-slash" : "bi-eye")"></i>
</button>
</form>
<form asp-action="Delete" asp-route-id="@note.Id" method="post" class="d-inline"
onsubmit="return confirm('Delete v@(note.Version)?')">
@Html.AntiForgeryToken()
<button type="submit" class="btn btn-sm btn-outline-danger py-0 px-2" title="Delete">
<i class="bi bi-trash"></i>
</button>
</form>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>