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,93 @@
|
||||
@model PowderCoating.Application.DTOs.Customer.CreatePricingTierDto
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "New Pricing Tier";
|
||||
ViewData["PageIcon"] = "bi-tags-fill";
|
||||
}
|
||||
|
||||
<div class="container-fluid mt-4">
|
||||
<div class="d-flex justify-content-end gap-2 mb-4">
|
||||
<a asp-controller="Help" asp-action="Settings" class="btn btn-outline-secondary" target="_blank" title="Settings help">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
<span class="d-none d-sm-inline ms-1">Help</span>
|
||||
</a>
|
||||
<a asp-action="Index" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i>Back to Tiers
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0"><i class="bi bi-tag me-2"></i>Tier Details</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form asp-action="Create" method="post">
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="TierName" class="form-label fw-semibold">Tier Name</label>
|
||||
<a tabindex="0" class="help-icon" role="button"
|
||||
data-bs-toggle="popover" data-bs-placement="right"
|
||||
data-bs-title="Tier Name"
|
||||
data-bs-content="Choose a name that communicates the customer relationship level — for example <em>Silver</em>, <em>Gold</em>, <em>Preferred Shop</em>, or <em>Wholesale</em>. The name is visible to your staff when editing customers and appears in the quote pricing breakdown.">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
<input asp-for="TierName" class="form-control" placeholder="e.g. Gold, VIP, Wholesale" autofocus />
|
||||
<span asp-validation-for="TierName" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="Description" class="form-label fw-semibold">Description</label>
|
||||
<input asp-for="Description" class="form-control" placeholder="Optional — shown on customer profiles" />
|
||||
<span asp-validation-for="Description" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="DiscountPercent" class="form-label fw-semibold">Discount %</label>
|
||||
<a tabindex="0" class="help-icon" role="button"
|
||||
data-bs-toggle="popover" data-bs-placement="right"
|
||||
data-bs-title="Discount Percentage"
|
||||
data-bs-content="This percentage is automatically deducted from the subtotal of every new quote created for a customer on this tier. For example, 10% on a $600 quote reduces the total by $60. The discount appears as a named line item in the quote pricing breakdown so the customer can see it clearly. Enter <strong>0</strong> for standard pricing with no discount.">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
<div class="input-group" style="max-width: 200px;">
|
||||
<input asp-for="DiscountPercent" class="form-control" type="number"
|
||||
min="0" max="100" step="0.01" placeholder="0" />
|
||||
<span class="input-group-text">%</span>
|
||||
</div>
|
||||
<div class="form-text">Enter 0 for no discount (standard pricing).</div>
|
||||
<span asp-validation-for="DiscountPercent" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<div class="form-check">
|
||||
<input asp-for="IsActive" class="form-check-input" type="checkbox" />
|
||||
<label asp-for="IsActive" class="form-check-label fw-semibold">Active</label>
|
||||
<a tabindex="0" class="help-icon" role="button"
|
||||
data-bs-toggle="popover" data-bs-placement="right"
|
||||
data-bs-title="Active Status"
|
||||
data-bs-content="Active tiers appear in the tier dropdown when editing a customer record. Uncheck this to hide the tier from the dropdown without deleting it — useful for legacy tiers that still have customers assigned but should not be used for new assignments.">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
<div class="form-text">Inactive tiers cannot be assigned to new customers.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end">
|
||||
<a asp-action="Index" class="btn btn-outline-secondary">Cancel</a>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="bi bi-check-circle me-1"></i>Create Tier
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
@model PowderCoating.Application.DTOs.Customer.UpdatePricingTierDto
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Edit Pricing Tier";
|
||||
ViewData["PageIcon"] = "bi-tags-fill";
|
||||
}
|
||||
|
||||
<div class="container-fluid mt-4">
|
||||
<div class="d-flex justify-content-end gap-2 mb-4">
|
||||
<a asp-controller="Help" asp-action="Settings" class="btn btn-outline-secondary" target="_blank" title="Settings help">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
<span class="d-none d-sm-inline ms-1">Help</span>
|
||||
</a>
|
||||
<a asp-action="Index" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i>Back to Tiers
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0"><i class="bi bi-tag me-2"></i>Tier Details</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form asp-action="Edit" method="post">
|
||||
@Html.AntiForgeryToken()
|
||||
<input type="hidden" asp-for="Id" />
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="TierName" class="form-label fw-semibold">Tier Name</label>
|
||||
<a tabindex="0" class="help-icon" role="button"
|
||||
data-bs-toggle="popover" data-bs-placement="right"
|
||||
data-bs-title="Tier Name"
|
||||
data-bs-content="Choose a name that communicates the customer relationship level — for example <em>Silver</em>, <em>Gold</em>, <em>Preferred Shop</em>, or <em>Wholesale</em>. The name is visible to your staff when editing customers and appears in the quote pricing breakdown.">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
<input asp-for="TierName" class="form-control" autofocus />
|
||||
<span asp-validation-for="TierName" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="Description" class="form-label fw-semibold">Description</label>
|
||||
<input asp-for="Description" class="form-control" placeholder="Optional — shown on customer profiles" />
|
||||
<span asp-validation-for="Description" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="DiscountPercent" class="form-label fw-semibold">Discount %</label>
|
||||
<a tabindex="0" class="help-icon" role="button"
|
||||
data-bs-toggle="popover" data-bs-placement="right"
|
||||
data-bs-title="Discount Percentage"
|
||||
data-bs-content="This percentage is automatically deducted from the subtotal of every new quote created for a customer on this tier. <strong>Changing this value affects all future quotes</strong> for customers on the tier — existing quotes are not recalculated. Enter <strong>0</strong> for standard pricing with no discount.">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
<div class="input-group" style="max-width: 200px;">
|
||||
<input asp-for="DiscountPercent" class="form-control" type="number"
|
||||
min="0" max="100" step="0.01" />
|
||||
<span class="input-group-text">%</span>
|
||||
</div>
|
||||
<div class="form-text">Changes apply immediately to all new quotes for customers on this tier.</div>
|
||||
<span asp-validation-for="DiscountPercent" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<div class="form-check">
|
||||
<input asp-for="IsActive" class="form-check-input" type="checkbox" />
|
||||
<label asp-for="IsActive" class="form-check-label fw-semibold">Active</label>
|
||||
<a tabindex="0" class="help-icon" role="button"
|
||||
data-bs-toggle="popover" data-bs-placement="right"
|
||||
data-bs-title="Active Status"
|
||||
data-bs-content="Active tiers appear in the tier dropdown when editing a customer record. Uncheck this to hide the tier from the dropdown without deleting it — useful for legacy tiers that still have customers assigned but should not be used for new assignments.">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
<div class="form-text">Inactive tiers cannot be assigned to new customers.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2 justify-content-end">
|
||||
<a asp-action="Index" class="btn btn-outline-secondary">Cancel</a>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="bi bi-check-circle me-1"></i>Save Changes
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
@model List<PowderCoating.Application.DTOs.Customer.PricingTierDto>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Pricing Tiers";
|
||||
ViewData["PageIcon"] = "bi-tags-fill";
|
||||
ViewData["PageHelpTitle"] = "Pricing Tiers";
|
||||
ViewData["PageHelpContent"] = "Pricing tiers let you automatically apply a discount to quotes for your best customers. Create tiers here, then assign a tier to a customer on their profile. Every new quote for that customer will show the tier discount as a separate line item in the pricing breakdown.";
|
||||
}
|
||||
|
||||
<div class="container-fluid mt-4">
|
||||
<div class="d-flex justify-content-end gap-2 mb-4">
|
||||
<a asp-controller="Help" asp-action="Settings" class="btn btn-outline-secondary" target="_blank" title="Settings help">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
<span class="d-none d-sm-inline ms-1">Help</span>
|
||||
</a>
|
||||
<a asp-action="Create" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle me-1"></i>New Tier
|
||||
</a>
|
||||
<a asp-controller="CompanySettings" asp-action="Index" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i>Settings
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@if (TempData["SuccessMessage"] != null)
|
||||
{
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
<i class="bi bi-check-circle me-2"></i>@TempData["SuccessMessage"]
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
}
|
||||
@if (TempData["ErrorMessage"] != null)
|
||||
{
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<i class="bi bi-exclamation-triangle me-2"></i>@TempData["ErrorMessage"]
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body p-0">
|
||||
@if (!Model.Any())
|
||||
{
|
||||
<div class="text-center py-5 text-muted">
|
||||
<i class="bi bi-tags display-4 d-block mb-2 opacity-25"></i>
|
||||
<p class="mb-1">No pricing tiers defined yet.</p>
|
||||
<a asp-action="Create" class="btn btn-primary mt-2">
|
||||
<i class="bi bi-plus-circle me-1"></i>Create First Tier
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-hover mb-0 align-middle">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Tier Name</th>
|
||||
<th>Description</th>
|
||||
<th class="text-center">
|
||||
Discount
|
||||
<a tabindex="0" class="help-icon" role="button"
|
||||
data-bs-toggle="popover" data-bs-placement="top"
|
||||
data-bs-title="Tier Discount"
|
||||
data-bs-content="The percentage automatically deducted from a quote's subtotal when this customer's tier is selected. A 10% tier on a $500 quote saves the customer $50. The discount appears as its own line in the quote pricing breakdown.">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
</th>
|
||||
<th class="text-center">
|
||||
Customers
|
||||
<a tabindex="0" class="help-icon" role="button"
|
||||
data-bs-toggle="popover" data-bs-placement="top"
|
||||
data-bs-title="Assigned Customers"
|
||||
data-bs-content="The number of customers currently assigned to this tier. Tiers with assigned customers <strong>cannot be deleted</strong> — reassign or move customers first. You can deactivate a tier instead to prevent it appearing in the customer dropdown without losing history.">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
</th>
|
||||
<th class="text-center">
|
||||
Status
|
||||
<a tabindex="0" class="help-icon" role="button"
|
||||
data-bs-toggle="popover" data-bs-placement="top"
|
||||
data-bs-title="Active / Inactive"
|
||||
data-bs-content="<strong>Active</strong> tiers appear in the tier dropdown when editing a customer. <strong>Inactive</strong> tiers are hidden from that dropdown but existing customers on the tier keep their assignment and discount until you change it. Use the toggle button to flip the status.">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
</th>
|
||||
<th class="text-end">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var tier in Model)
|
||||
{
|
||||
<tr class="@(!tier.IsActive ? "table-secondary text-muted" : null)">
|
||||
<td>
|
||||
<strong>@tier.TierName</strong>
|
||||
</td>
|
||||
<td>
|
||||
<span class="text-muted small">@(tier.Description ?? "—")</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (tier.DiscountPercent == 0)
|
||||
{
|
||||
<span class="text-muted">No discount</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="badge bg-success fs-6">@tier.DiscountPercent.ToString("0.##")%</span>
|
||||
}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (tier.CustomerCount > 0)
|
||||
{
|
||||
<a asp-controller="Customers" asp-action="Index"
|
||||
class="badge bg-primary text-decoration-none">
|
||||
@tier.CustomerCount
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-muted">0</span>
|
||||
}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (tier.IsActive)
|
||||
{
|
||||
<span class="badge bg-success">Active</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="badge bg-secondary">Inactive</span>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<div class="d-flex gap-1 justify-content-end">
|
||||
<a asp-action="Edit" asp-route-id="@tier.Id"
|
||||
class="btn btn-sm btn-outline-primary" title="Edit">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
<form asp-action="ToggleActive" asp-route-id="@tier.Id" method="post" class="d-inline">
|
||||
@Html.AntiForgeryToken()
|
||||
<button type="submit" class="btn btn-sm btn-outline-secondary"
|
||||
title="@(tier.IsActive ? "Deactivate" : "Activate")">
|
||||
<i class="bi @(tier.IsActive ? "bi-toggle-on" : "bi-toggle-off")"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form asp-action="Delete" asp-route-id="@tier.Id" method="post" class="d-inline"
|
||||
onsubmit="return confirm('Delete tier \'@tier.TierName\'? This cannot be undone.');">
|
||||
@Html.AntiForgeryToken()
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger" title="Delete"
|
||||
@(tier.CustomerCount > 0 ? "disabled" : null)>
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info mt-3 alert-permanent">
|
||||
<i class="bi bi-info-circle me-2"></i>
|
||||
<strong>How tiers work:</strong> Assign a tier to a customer on their profile. The tier's discount percentage is automatically deducted from quote totals when that customer is selected. Tiers with assigned customers cannot be deleted — deactivate them instead.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user