Answer-table pattern: add reusable macros, integrate with Rolodex; bulk actions retained. Field prompts/help: generic focus-based help in forms (case, rolodex); add JS support. Rebuild Docker.

This commit is contained in:
HotSwapp
2025-10-07 17:00:54 -05:00
parent 748fe92565
commit e07a4fda1c
7 changed files with 201 additions and 117 deletions

View File

@@ -68,6 +68,39 @@ document.addEventListener('DOMContentLoaded', function() {
if (qtyInput) qtyInput.addEventListener('input', recomputeAmount);
if (rateInput) rateInput.addEventListener('input', recomputeAmount);
// Generic select-all for answer tables
document.querySelectorAll('.js-answer-table').forEach(function(form) {
var selectAll = form.querySelector('.js-select-all');
if (!selectAll) return;
selectAll.addEventListener('change', function() {
var checkboxes = form.querySelectorAll('input[type="checkbox"][name]');
checkboxes.forEach(function(cb) {
if (cb !== selectAll) cb.checked = selectAll.checked;
});
});
});
// Field help: show contextual help from data-help on focus
function attachFieldHelp(container) {
if (!container) return;
var helpEl = container.querySelector('#fieldHelp');
if (!helpEl) return;
container.querySelectorAll('input, select, textarea').forEach(function(field) {
field.addEventListener('focus', function() {
var text = field.getAttribute('data-help');
if (text) helpEl.textContent = text;
});
field.addEventListener('blur', function() {
// Optionally keep last help, or reset
});
});
}
// Attach help to known forms/sections
document.querySelectorAll('form').forEach(function(form) {
attachFieldHelp(form.closest('.card-body') || form);
});
});
// Utility functions