feat(114): accounting configs refactor + invoice configs CRUD
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>
This commit is contained in:
35
public/assets/js/modules/invoice-config-form.js
Normal file
35
public/assets/js/modules/invoice-config-form.js
Normal file
@@ -0,0 +1,35 @@
|
||||
(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();
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user