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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user