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,70 +8,53 @@
<!-- 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">
<dl>
<dt>
Suchbegriff:
</dt>
<dd>
<h:inputText
value="#{invoiceDispatchController.filter}">
<f:ajax listener="#{invoiceDispatchController.searchInvoices()}" render="search_result"/>
</h:inputText>
</dd>
</dl>
</div>
<div class="imixs-form-section-2">
<dl>
<dt>
Suchbegriff:
</dt>
<dd>
<h:inputText
value="#{invoiceDispatchController.filter}">
<f:ajax listener="#{invoiceDispatchController.searchInvoices()}"
render="invoice_list"
onevent="resetSelectionList"/>
</h:inputText>
</dd>
</dl>
</div>
<ui:fragment rendered="#{empty invoiceList}">
<div class="ui-state-highlight ui-corner-all"
style="margin-bottom: 10px; padding: .5em;">
<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 wurden keine Rechnungen mit dem Suchbegriff gefunden." />
</p>
</div>
</ui:fragment>
<ui:fragment rendered="#{!empty invoiceList}">
<div class="imixs-form-section">
<input type="button" id="clickallid" value="#{custom['invoice.clickall']}" />
<input type="button" id="unclickallid" value="#{custom['invoice.unclickall']}" />
<table class="" style="font-size: 0.9rem;line-height: 2.1em;">
<c:forEach items="#{invoiceList}" var="invoice">
<tr>
<td><input type="checkbox" class="selection_checkbox"
id="#{invoice.uniqueID}" /></td>
<td><h:link outcome="/pages/workitems/workitem">
<h:outputText escape="false" value="#{invoice.item['$workflowsummary']}" />
<f:param name="id" value="#{invoice.item['$uniqueid']}" />
</h:link></td>
</tr>
</c:forEach>
<h:inputText style="display:none;" class="invoice_selection_list"
<h:inputText style="display:xnone;" class="invoice_selection_list"
value="#{workitem.item['invoice.selection']}" />
</table>
</div>
</ui:fragment>
@ -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('');
}
}
/*]]>*/
</script>