64a9c1531b
Razor's @() expression auto-encodes &, turning — into &mdash; which rendered as literal text in the browser. Wrapped all such expressions in @Html.Raw() so the em-dash entity is passed through unescaped. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
167 lines
9.7 KiB
Plaintext
167 lines
9.7 KiB
Plaintext
@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">@Html.Raw(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>
|