4ec55e7290
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>
38 lines
1.4 KiB
JavaScript
38 lines
1.4 KiB
JavaScript
(function () {
|
|
var qtyInput = document.getElementById('Quantity');
|
|
var amtInput = document.getElementById('Amount');
|
|
var preview = document.getElementById('batchPreview');
|
|
var prevQty = document.getElementById('prevQty');
|
|
var prevAmt = document.getElementById('prevAmt');
|
|
var prevTotal = document.getElementById('prevTotal');
|
|
|
|
function updatePreview() {
|
|
var qty = parseInt(qtyInput.value, 10);
|
|
var amt = parseFloat(amtInput.value);
|
|
if (qty > 0 && amt > 0) {
|
|
prevQty.textContent = qty;
|
|
prevAmt.textContent = '$' + amt.toFixed(2);
|
|
prevTotal.textContent = '$' + (qty * amt).toFixed(2);
|
|
preview.style.display = '';
|
|
} else {
|
|
preview.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
if (qtyInput && amtInput) {
|
|
qtyInput.addEventListener('input', updatePreview);
|
|
amtInput.addEventListener('input', updatePreview);
|
|
updatePreview();
|
|
}
|
|
|
|
// Disable submit button after first click to prevent double-submit during long creation
|
|
var form = document.querySelector('form');
|
|
var submitBtn = document.getElementById('submitBtn');
|
|
if (form && submitBtn) {
|
|
form.addEventListener('submit', function () {
|
|
submitBtn.disabled = true;
|
|
submitBtn.innerHTML = '<span class="spinner-border spinner-border-sm me-2"></span>Creating...';
|
|
});
|
|
}
|
|
}());
|