Phase 114 complete (v3.7 Invoices): - /settings/accounting jako hub-rozdroze (Paragony / Faktury) - /settings/accounting/receipts + /invoices osobne podstrony list i edycji - InvoiceConfigRepository + Controller (CRUD z walidacja delegacji) - Seed Domyslny VAT (NOT EXISTS idempotent) - invoice-config-form.js (toggle is_delegated -> integration_id) - confirm-delete.js (globalny modul OrderProAlerts.confirm) - Legacy aliasy starych endpointow /settings/accounting/save|toggle|delete Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
36 lines
897 B
JavaScript
36 lines
897 B
JavaScript
(function () {
|
|
'use strict';
|
|
|
|
function sync(checkbox, wrapper) {
|
|
if (!checkbox || !wrapper) return;
|
|
var select = wrapper.querySelector('select[name="integration_id"]');
|
|
if (checkbox.checked) {
|
|
wrapper.style.display = '';
|
|
if (select) select.required = true;
|
|
} else {
|
|
wrapper.style.display = 'none';
|
|
if (select) {
|
|
select.required = false;
|
|
select.value = '';
|
|
}
|
|
}
|
|
}
|
|
|
|
function init() {
|
|
var checkbox = document.querySelector('[data-invoice-delegated]');
|
|
var wrapper = document.querySelector('[data-invoice-delegation]');
|
|
if (!checkbox || !wrapper) return;
|
|
|
|
sync(checkbox, wrapper);
|
|
checkbox.addEventListener('change', function () {
|
|
sync(checkbox, wrapper);
|
|
});
|
|
}
|
|
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', init);
|
|
} else {
|
|
init();
|
|
}
|
|
})();
|