fix - rechnungsauswahl in stapelverarbeitung

This commit is contained in:
Ralph Soika 2025-01-27 08:43:12 +01:00
parent 831ace7b42
commit 1cd4980ce0

View file

@ -8,12 +8,8 @@
<!-- zeigt alle rechnungen an die von einem Abteilungsleiter verteilt werden können --> <!-- zeigt alle rechnungen an die von einem Abteilungsleiter verteilt werden können -->
<h:panelGroup id="search_result" > <h:panelGroup id="invoice_list" >
<ui:param name="invoiceList" value="#{invoiceDispatchController.invoices}"></ui:param>
<ui:param name="invoiceList"
value="#{invoiceDispatchController.invoices}"></ui:param>
<div class="imixs-form-section-2"> <div class="imixs-form-section-2">
<dl> <dl>
@ -23,55 +19,42 @@
<dd> <dd>
<h:inputText <h:inputText
value="#{invoiceDispatchController.filter}"> value="#{invoiceDispatchController.filter}">
<f:ajax listener="#{invoiceDispatchController.searchInvoices()}" render="search_result"/> <f:ajax listener="#{invoiceDispatchController.searchInvoices()}"
render="invoice_list"
onevent="resetSelectionList"/>
</h:inputText> </h:inputText>
</dd> </dd>
</dl> </dl>
</div> </div>
<ui:fragment rendered="#{empty invoiceList}"> <ui:fragment rendered="#{empty invoiceList}">
<div class="ui-state-highlight ui-corner-all" <div class="ui-state-highlight ui-corner-all"
style="margin-bottom: 10px; padding: .5em;"> style="margin-bottom: 10px; padding: .5em;">
<p> <p>
<h:outputText rendered="#{empty invoiceDispatchController.filter}" value="Es liegen derzeit keine Rechnungen zur Prüfung für Sie vor." /> <h:outputText rendered="#{empty invoiceDispatchController.filter}" value="Es liegen derzeit keine Rechnungen zur Prüfung für Sie vor." />
<h:outputText rendered="#{! empty invoiceDispatchController.filter}" value="Es wurden keine Rechnungen mit dem Suchbegriff gefunden." /> <h:outputText rendered="#{! empty invoiceDispatchController.filter}" value="Es wurden keine Rechnungen mit dem Suchbegriff gefunden." />
</p> </p>
</div> </div>
</ui:fragment> </ui:fragment>
<ui:fragment rendered="#{!empty invoiceList}"> <ui:fragment rendered="#{!empty invoiceList}">
<div class="imixs-form-section"> <div class="imixs-form-section">
<input type="button" id="clickallid" value="#{custom['invoice.clickall']}" /> <input type="button" id="clickallid" value="#{custom['invoice.clickall']}" />
<input type="button" id="unclickallid" value="#{custom['invoice.unclickall']}" /> <input type="button" id="unclickallid" value="#{custom['invoice.unclickall']}" />
<table class="" style="font-size: 0.9rem;line-height: 2.1em;"> <table class="" style="font-size: 0.9rem;line-height: 2.1em;">
<c:forEach items="#{invoiceList}" var="invoice"> <c:forEach items="#{invoiceList}" var="invoice">
<tr> <tr>
<td><input type="checkbox" class="selection_checkbox" <td><input type="checkbox" class="selection_checkbox"
id="#{invoice.uniqueID}" /></td> id="#{invoice.uniqueID}" /></td>
<td><h:link outcome="/pages/workitems/workitem"> <td><h:link outcome="/pages/workitems/workitem">
<h:outputText escape="false" value="#{invoice.item['$workflowsummary']}" /> <h:outputText escape="false" value="#{invoice.item['$workflowsummary']}" />
<f:param name="id" value="#{invoice.item['$uniqueid']}" /> <f:param name="id" value="#{invoice.item['$uniqueid']}" />
</h:link></td> </h:link></td>
</tr> </tr>
</c:forEach> </c:forEach>
<h:inputText style="display:xnone;" class="invoice_selection_list"
<h:inputText style="display:none;" class="invoice_selection_list"
value="#{workitem.item['invoice.selection']}" /> value="#{workitem.item['invoice.selection']}" />
</table> </table>
</div> </div>
</ui:fragment> </ui:fragment>
@ -86,41 +69,53 @@
// collect all selected ids form the checkboxes in the first column // collect all selected ids form the checkboxes in the first column
$(document).ready( $(document).ready(
function() { function() {
initInvoiceSelection();
$('.invoice_selection_list').val('');
}
);
// Initialisiert die buttons
function initInvoiceSelection() {
// Button-Handler bleiben gleich // Button-Handler bleiben gleich
document.querySelector('input[id="clickallid"]').addEventListener('click', function() { document.querySelector('input[id="clickallid"]').addEventListener('click', function() {
document.querySelectorAll('.selection_checkbox').forEach(checkbox => { document.querySelectorAll('.selection_checkbox').forEach(checkbox => {
checkbox.checked = true; checkbox.checked = true;
updateSelectionList(checkbox.id, true); updateInvoiceSelection(checkbox.id, true);
}); });
}); });
document.querySelector('input[id="unclickallid"]').addEventListener('click', function() { document.querySelector('input[id="unclickallid"]').addEventListener('click', function() {
document.querySelectorAll('.selection_checkbox').forEach(checkbox => { document.querySelectorAll('.selection_checkbox').forEach(checkbox => {
checkbox.checked = false; checkbox.checked = false;
updateSelectionList(checkbox.id, false); updateInvoiceSelection(checkbox.id, false);
}); });
}); });
$('input[type="checkbox"].selection_checkbox').change(function() {
updateInvoiceSelection($(this).attr('id'), $(this).prop('checked'));
});
}
$('.invoice_selection_list').val(''); function updateInvoiceSelection(id, checked) {
function updateSelectionList(id, checked) {
let selection = $('.invoice_selection_list').val(); let selection = $('.invoice_selection_list').val();
let selectionArr = selection ? selection.split(",").filter(x => x) : []; let selectionArr = selection ? selection.split(",").filter(x => x) : [];
if (checked && !selectionArr.includes(id)) { if (checked && !selectionArr.includes(id)) {
selectionArr.push(id); selectionArr.push(id);
} else if (!checked) { } else if (!checked) {
selectionArr = selectionArr.filter(x => x !== id); selectionArr = selectionArr.filter(x => x !== id);
} }
$('.invoice_selection_list').val(selectionArr.join(',')); $('.invoice_selection_list').val(selectionArr.join(','));
} }
$('input[type="checkbox"].selection_checkbox').change(function() { // This method refreshes the layout of the invoice list
updateSelectionList($(this).attr('id'), $(this).prop('checked')); function resetSelectionList(data) {
}); if (data.status === 'success') {
});
$('[id$=invoice_list]').imixsLayout();
initInvoiceSelection();
// loesche alte auswahl
$('.invoice_selection_list').val('');
}
}
/*]]>*/ /*]]>*/
</script> </script>