diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_invoices_dispatch.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_invoices_dispatch.xhtml index 6e6d3d8..a0253ce 100644 --- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_invoices_dispatch.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_invoices_dispatch.xhtml @@ -8,70 +8,53 @@ - + + - - - - -
-
-
- Suchbegriff: -
-
- - - - - -
-
- - - -
+
+
+
+ Suchbegriff: +
+
+ + + +
+
+
-

-

- -
- - - - -
@@ -85,42 +68,54 @@ // collect all selected ids form the checkboxes in the first column $(document).ready( - function() { + function() { + initInvoiceSelection(); + $('.invoice_selection_list').val(''); + } + ); - // Button-Handler bleiben gleich - document.querySelector('input[id="clickallid"]').addEventListener('click', function() { - document.querySelectorAll('.selection_checkbox').forEach(checkbox => { - checkbox.checked = true; - updateSelectionList(checkbox.id, true); - }); - }); - - document.querySelector('input[id="unclickallid"]').addEventListener('click', function() { - document.querySelectorAll('.selection_checkbox').forEach(checkbox => { - checkbox.checked = false; - updateSelectionList(checkbox.id, false); - }); - }); - - $('.invoice_selection_list').val(''); - - function updateSelectionList(id, checked) { - let selection = $('.invoice_selection_list').val(); - let selectionArr = selection ? selection.split(",").filter(x => x) : []; - - if (checked && !selectionArr.includes(id)) { - selectionArr.push(id); - } else if (!checked) { - selectionArr = selectionArr.filter(x => x !== id); - } - - $('.invoice_selection_list').val(selectionArr.join(',')); - } - - $('input[type="checkbox"].selection_checkbox').change(function() { - updateSelectionList($(this).attr('id'), $(this).prop('checked')); - }); + // Initialisiert die buttons + function initInvoiceSelection() { + // Button-Handler bleiben gleich + document.querySelector('input[id="clickallid"]').addEventListener('click', function() { + document.querySelectorAll('.selection_checkbox').forEach(checkbox => { + checkbox.checked = true; + updateInvoiceSelection(checkbox.id, true); }); + }); + document.querySelector('input[id="unclickallid"]').addEventListener('click', function() { + document.querySelectorAll('.selection_checkbox').forEach(checkbox => { + checkbox.checked = false; + updateInvoiceSelection(checkbox.id, false); + }); + }); + $('input[type="checkbox"].selection_checkbox').change(function() { + updateInvoiceSelection($(this).attr('id'), $(this).prop('checked')); + }); + } + + function updateInvoiceSelection(id, checked) { + let selection = $('.invoice_selection_list').val(); + let selectionArr = selection ? selection.split(",").filter(x => x) : []; + if (checked && !selectionArr.includes(id)) { + selectionArr.push(id); + } else if (!checked) { + selectionArr = selectionArr.filter(x => x !== id); + } + $('.invoice_selection_list').val(selectionArr.join(',')); + } + + // This method refreshes the layout of the invoice list + function resetSelectionList(data) { + if (data.status === 'success') { + + $('[id$=invoice_list]').imixsLayout(); + initInvoiceSelection(); + // loesche alte auswahl + $('.invoice_selection_list').val(''); + } + } + /*]]>*/