a0bdd2b5b4
Replace all corruption variants with HTML entities across 226 view files: - 3-char UTF-8-as-Win1252 sequences (ae-corruption) - Standalone smart/curly quotes that break C# Razor expressions - Partially re-corrupted variants where the 3rd byte was normalised to ASCII tools/Fix-Encoding.ps1: re-runnable sweep; uses [char] code points so the script itself never contains a literal non-ASCII character; supports -DryRun .githooks/pre-commit: blocks commits containing the ae-corruption byte signature (xc3xa2xe2x82xac); git core.hooksPath = .githooks so the hook is repo-committed and active for all future work on this machine. Build clean; 225 unit tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
135 lines
6.8 KiB
Plaintext
135 lines
6.8 KiB
Plaintext
@model PowderCoating.Application.DTOs.GiftCertificate.CreateGiftCertificateDto
|
|
@using PowderCoating.Core.Enums
|
|
|
|
@{
|
|
ViewData["Title"] = "New Gift Certificate";
|
|
ViewData["PageIcon"] = "bi-gift";
|
|
}
|
|
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-7">
|
|
<div class="d-flex justify-content-end mb-4">
|
|
<a asp-action="Index" class="btn btn-outline-secondary">
|
|
<i class="bi bi-arrow-left me-2"></i>Back
|
|
</a>
|
|
</div>
|
|
|
|
<form asp-action="Create" method="post">
|
|
@Html.AntiForgeryToken()
|
|
|
|
<div class="card border-0 shadow-sm mb-4">
|
|
<div class="card-header bg-white border-0 py-3">
|
|
<h5 class="mb-0 fw-semibold"><i class="bi bi-currency-dollar me-2 text-primary"></i>Certificate Details</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row g-3">
|
|
<div class="col-md-6">
|
|
<label asp-for="Amount" class="form-label fw-semibold"></label>
|
|
<div class="input-group">
|
|
<span class="input-group-text">$</span>
|
|
<input asp-for="Amount" type="number" step="0.01" min="1" class="form-control" placeholder="0.00" />
|
|
</div>
|
|
<span asp-validation-for="Amount" class="text-danger small"></span>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label asp-for="IssuedReason" class="form-label fw-semibold"></label>
|
|
<select asp-for="IssuedReason" class="form-select" id="issuedReasonSelect"
|
|
onchange="toggleSaleFields()">
|
|
@foreach (var reason in Enum.GetValues<GiftCertificateIssuedReason>())
|
|
{
|
|
<option value="@((int)reason)">@reason</option>
|
|
}
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Sale-specific fields -->
|
|
<div id="saleFields" class="col-12">
|
|
<div class="row g-3">
|
|
<div class="col-md-6">
|
|
<label asp-for="PurchasePrice" class="form-label fw-semibold">Selling Price <span class="text-muted fw-normal">(what buyer pays)</span></label>
|
|
<div class="input-group">
|
|
<span class="input-group-text">$</span>
|
|
<input asp-for="PurchasePrice" type="number" step="0.01" min="0" class="form-control" placeholder="0.00" />
|
|
</div>
|
|
<div class="form-text">Leave blank if same as face value.</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label asp-for="PurchasingCustomerId" class="form-label fw-semibold">Purchased By</label>
|
|
<select asp-for="PurchasingCustomerId" asp-items="ViewBag.Customers" class="form-select"></select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label asp-for="ExpiryDate" class="form-label fw-semibold"></label>
|
|
<input asp-for="ExpiryDate" type="date" class="form-control" />
|
|
<div class="form-text">Leave blank for no expiry.</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card border-0 shadow-sm mb-4">
|
|
<div class="card-header bg-white border-0 py-3">
|
|
<h5 class="mb-0 fw-semibold"><i class="bi bi-person me-2 text-primary"></i>Recipient</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row g-3">
|
|
<div class="col-12">
|
|
<label asp-for="RecipientCustomerId" class="form-label fw-semibold">Existing Customer</label>
|
|
<select asp-for="RecipientCustomerId" asp-items="ViewBag.Customers" class="form-select"
|
|
onchange="toggleRecipientName()"></select>
|
|
<div class="form-text">Select a customer, or leave blank and fill in the name below.</div>
|
|
</div>
|
|
<div class="col-md-6" id="recipientNameField">
|
|
<label asp-for="RecipientName" class="form-label fw-semibold"></label>
|
|
<input asp-for="RecipientName" class="form-control" placeholder="Name on certificate" />
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label asp-for="RecipientEmail" class="form-label fw-semibold"></label>
|
|
<input asp-for="RecipientEmail" type="email" class="form-control" placeholder="Optional — for emailing the certificate" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card border-0 shadow-sm mb-4">
|
|
<div class="card-header bg-white border-0 py-3">
|
|
<h5 class="mb-0 fw-semibold"><i class="bi bi-journal me-2 text-primary"></i>Notes</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<textarea asp-for="Notes" class="form-control" rows="3" placeholder="Any internal notes about this certificate..."></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-flex gap-2">
|
|
<button type="submit" class="btn btn-primary">
|
|
<i class="bi bi-gift me-2"></i>Issue Certificate
|
|
</button>
|
|
<a asp-action="Index" class="btn btn-outline-secondary">Cancel</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
@section Scripts {
|
|
<script>
|
|
function toggleSaleFields() {
|
|
const reason = parseInt(document.getElementById('issuedReasonSelect').value);
|
|
const saleFields = document.getElementById('saleFields');
|
|
// GiftCertificateIssuedReason.Sold = 0
|
|
saleFields.style.display = reason === 0 ? '' : 'none';
|
|
}
|
|
|
|
function toggleRecipientName() {
|
|
const customerId = document.getElementById('RecipientCustomerId').value;
|
|
const nameField = document.getElementById('recipientNameField');
|
|
nameField.style.display = customerId ? 'none' : '';
|
|
}
|
|
|
|
// Init on load
|
|
toggleSaleFields();
|
|
toggleRecipientName();
|
|
</script>
|
|
}
|