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,209 @@
@model SmsConsentAuditViewModel
@{
ViewData["Title"] = "SMS Consent Audit";
ViewData["PageIcon"] = "bi-phone-vibrate";
}
<div class="container-fluid mt-3">
<div class="d-flex align-items-center justify-content-between mb-4">
<div>
<h4 class="mb-0"><i class="bi bi-phone-vibrate me-2 text-primary"></i>SMS Consent Audit</h4>
<p class="text-muted small mb-0">TCPA compliance record — tracks customer SMS opt-in, opt-out, and consent timestamps.</p>
</div>
<a asp-action="ExportCsv" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-download me-1"></i>Export CSV
</a>
</div>
<!-- Stat Cards -->
<div class="row g-3 mb-4">
<div class="col-sm-6 col-xl-3">
<div class="card border-0 shadow-sm h-100">
<div class="card-body">
<div class="d-flex align-items-center gap-3">
<div class="rounded-circle bg-secondary bg-opacity-10 d-flex align-items-center justify-content-center" style="width:48px;height:48px;flex-shrink:0">
<i class="bi bi-people text-secondary fs-4"></i>
</div>
<div>
<div class="fs-3 fw-bold">@Model.TotalCount.ToString("N0")</div>
<div class="text-muted small">Total Customers</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-xl-3">
<div class="card border-0 shadow-sm h-100">
<div class="card-body">
<div class="d-flex align-items-center gap-3">
<div class="rounded-circle bg-success bg-opacity-10 d-flex align-items-center justify-content-center" style="width:48px;height:48px;flex-shrink:0">
<i class="bi bi-phone-fill text-success fs-4"></i>
</div>
<div>
<div class="fs-3 fw-bold">@Model.OptedInCount.ToString("N0")</div>
<div class="text-muted small">Opted In</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-xl-3">
<div class="card border-0 shadow-sm h-100">
<div class="card-body">
<div class="d-flex align-items-center gap-3">
<div class="rounded-circle bg-danger bg-opacity-10 d-flex align-items-center justify-content-center" style="width:48px;height:48px;flex-shrink:0">
<i class="bi bi-phone-x text-danger fs-4"></i>
</div>
<div>
<div class="fs-3 fw-bold">@Model.OptedOutCount.ToString("N0")</div>
<div class="text-muted small">Opted Out</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-xl-3">
<div class="card border-0 shadow-sm h-100">
<div class="card-body">
<div class="d-flex align-items-center gap-3">
<div class="rounded-circle bg-secondary bg-opacity-10 d-flex align-items-center justify-content-center" style="width:48px;height:48px;flex-shrink:0">
<i class="bi bi-dash-circle text-secondary fs-4"></i>
</div>
<div>
<div class="fs-3 fw-bold">@Model.NeverSubscribedCount.ToString("N0")</div>
<div class="text-muted small">Never Subscribed</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Filters + Search -->
<div class="card shadow-sm mb-0">
<div class="card-header d-flex flex-wrap align-items-center gap-2 justify-content-between">
<div class="d-flex flex-wrap gap-1">
<a asp-action="Index" asp-route-filter="all" asp-route-search="@Model.Search"
class="btn btn-sm @(Model.Filter == "all" ? "btn-primary" : "btn-outline-secondary")">
All <span class="badge bg-white text-dark ms-1">@Model.TotalCount</span>
</a>
<a asp-action="Index" asp-route-filter="opted-in" asp-route-search="@Model.Search"
class="btn btn-sm @(Model.Filter == "opted-in" ? "btn-success" : "btn-outline-success")">
Opted In <span class="badge bg-white text-dark ms-1">@Model.OptedInCount</span>
</a>
<a asp-action="Index" asp-route-filter="opted-out" asp-route-search="@Model.Search"
class="btn btn-sm @(Model.Filter == "opted-out" ? "btn-danger" : "btn-outline-danger")">
Opted Out <span class="badge bg-white text-dark ms-1">@Model.OptedOutCount</span>
</a>
<a asp-action="Index" asp-route-filter="never" asp-route-search="@Model.Search"
class="btn btn-sm @(Model.Filter == "never" ? "btn-secondary" : "btn-outline-secondary")">
Never Subscribed <span class="badge bg-white text-dark ms-1">@Model.NeverSubscribedCount</span>
</a>
</div>
<form method="get" class="d-flex gap-2">
<input type="hidden" name="filter" value="@Model.Filter" />
<input type="search" name="search" value="@Model.Search" class="form-control form-control-sm"
placeholder="Search by name or phone…" style="min-width:220px" />
<button type="submit" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-search"></i>
</button>
</form>
</div>
<div class="table-responsive">
<table class="table table-hover mb-0 align-middle">
<thead class="table-light">
<tr>
<th>Customer</th>
<th>Phone / Mobile</th>
<th class="text-center">SMS Status</th>
<th>Consented At</th>
<th>Consent Method</th>
<th>Opted Out At</th>
</tr>
</thead>
<tbody>
@foreach (var row in Model.Rows)
{
<tr>
<td>
<a asp-controller="Customers" asp-action="Details" asp-route-id="@row.CustomerId"
class="fw-semibold text-decoration-none">
@row.CustomerName
</a>
</td>
<td>
@if (!string.IsNullOrWhiteSpace(row.MobilePhone))
{
<div><i class="bi bi-phone text-muted me-1 small"></i>@row.MobilePhone</div>
}
@if (!string.IsNullOrWhiteSpace(row.Phone))
{
<div class="text-muted small"><i class="bi bi-telephone me-1"></i>@row.Phone</div>
}
@if (string.IsNullOrWhiteSpace(row.MobilePhone) && string.IsNullOrWhiteSpace(row.Phone))
{
<span class="text-muted">—</span>
}
</td>
<td class="text-center">
<span class="badge @row.StatusBadgeClass">@row.StatusLabel</span>
</td>
<td>
@if (row.ConsentedAt.HasValue)
{
<span title="@row.ConsentedAt.Value.ToString("u")">
@row.ConsentedAt.Value.ToString("MMM d, yyyy")
</span>
}
else
{
<span class="text-muted">—</span>
}
</td>
<td>
@if (!string.IsNullOrWhiteSpace(row.ConsentMethod))
{
<span class="text-muted small">@row.ConsentMethod</span>
}
else
{
<span class="text-muted">—</span>
}
</td>
<td>
@if (row.OptedOutAt.HasValue)
{
<span class="text-danger" title="@row.OptedOutAt.Value.ToString("u")">
@row.OptedOutAt.Value.ToString("MMM d, yyyy")
</span>
}
else
{
<span class="text-muted">—</span>
}
</td>
</tr>
}
@if (!Model.Rows.Any())
{
<tr>
<td colspan="6" class="text-center text-muted py-5">
<i class="bi bi-phone-vibrate fs-1 d-block mb-2 opacity-25"></i>
No customers match the current filter.
</td>
</tr>
}
</tbody>
</table>
</div>
@if (Model.Rows.Any())
{
<div class="card-footer text-muted small">
Showing @Model.Rows.Count of @Model.TotalCount customers.
Timestamps shown in server UTC. <a asp-action="ExportCsv" class="text-muted">Export full list as CSV</a>.
</div>
}
</div>
</div>