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:
@@ -0,0 +1,126 @@
|
||||
@model PowderCoating.Web.ViewModels.Reports.CustomerRetentionViewModel
|
||||
@{ ViewData["Title"] = "Customer Retention"; }
|
||||
|
||||
<partial name="_ReportHeader" model="Model" />
|
||||
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-6 col-md">
|
||||
<div class="card text-center border-success">
|
||||
<div class="card-body py-2">
|
||||
<div class="fs-4 fw-bold text-success">@Model.ActiveCount</div>
|
||||
<div class="small text-muted">Active</div>
|
||||
<div class="small text-muted">(≤ 30 days)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md">
|
||||
<div class="card text-center border-warning">
|
||||
<div class="card-body py-2">
|
||||
<div class="fs-4 fw-bold text-warning">@Model.AtRiskCount</div>
|
||||
<div class="small text-muted">At Risk</div>
|
||||
<div class="small text-muted">(31–60 days)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md">
|
||||
<div class="card text-center border-orange" style="border-color:#fd7e14!important">
|
||||
<div class="card-body py-2">
|
||||
<div class="fs-4 fw-bold" style="color:#fd7e14">@Model.LapsingCount</div>
|
||||
<div class="small text-muted">Lapsing</div>
|
||||
<div class="small text-muted">(61–90 days)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md">
|
||||
<div class="card text-center border-danger">
|
||||
<div class="card-body py-2">
|
||||
<div class="fs-4 fw-bold text-danger">@Model.ChurnedCount</div>
|
||||
<div class="small text-muted">Churned</div>
|
||||
<div class="small text-muted">(> 90 days)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md">
|
||||
<div class="card text-center border-secondary">
|
||||
<div class="card-body py-2">
|
||||
<div class="fs-4 fw-bold text-secondary">@Model.NeverOrderedCount</div>
|
||||
<div class="small text-muted">Never Ordered</div>
|
||||
<div class="small text-muted"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@{
|
||||
var statusOrder = new[] { "Churned", "Lapsing", "At Risk", "Active", "Never Ordered" };
|
||||
var grouped = Model.Items.GroupBy(i => i.RetentionStatus).OrderBy(g => Array.IndexOf(statusOrder, g.Key));
|
||||
}
|
||||
|
||||
@foreach (var group in grouped)
|
||||
{
|
||||
var badgeClass = group.Key switch {
|
||||
"Active" => "bg-success",
|
||||
"At Risk" => "bg-warning text-dark",
|
||||
"Lapsing" => "bg-orange",
|
||||
"Churned" => "bg-danger",
|
||||
_ => "bg-secondary"
|
||||
};
|
||||
var headerClass = group.Key switch {
|
||||
"Active" => "table-success",
|
||||
"At Risk" => "table-warning",
|
||||
"Lapsing" => "table-orange",
|
||||
"Churned" => "table-danger",
|
||||
_ => "table-secondary"
|
||||
};
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header d-flex justify-content-between align-items-center @headerClass">
|
||||
<span class="fw-semibold">@group.Key</span>
|
||||
<span class="badge @badgeClass">@group.Count()</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>Email</th>
|
||||
<th>Phone</th>
|
||||
<th class="text-end">Jobs</th>
|
||||
<th class="text-end">Lifetime Revenue</th>
|
||||
<th>Last Job</th>
|
||||
<th class="text-end">Days Since</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in group.OrderByDescending(i => i.LifetimeRevenue))
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<a asp-controller="Customers" asp-action="Details" asp-route-id="@item.CustomerId">
|
||||
@item.CustomerName
|
||||
</a>
|
||||
</td>
|
||||
<td class="small">@(item.Email ?? "—")</td>
|
||||
<td class="small">@(item.Phone ?? "—")</td>
|
||||
<td class="text-end">@item.TotalJobs</td>
|
||||
<td class="text-end">@item.LifetimeRevenue.ToString("C")</td>
|
||||
<td>@(item.LastJobDate?.ToString("MMM d, yyyy") ?? "—")</td>
|
||||
<td class="text-end">
|
||||
@if (item.DaysSinceLastJob < 0)
|
||||
{
|
||||
<span class="text-muted">—</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@item.DaysSinceLastJob</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user