fix - rechnungsauswahl in stapelverarbeitung
This commit is contained in:
parent
831ace7b42
commit
1cd4980ce0
1 changed files with 64 additions and 69 deletions
|
|
@ -8,12 +8,8 @@
|
|||
|
||||
<!-- zeigt alle rechnungen an die von einem Abteilungsleiter verteilt werden können -->
|
||||
|
||||
<h:panelGroup id="search_result" >
|
||||
|
||||
<ui:param name="invoiceList"
|
||||
value="#{invoiceDispatchController.invoices}"></ui:param>
|
||||
|
||||
|
||||
<h:panelGroup id="invoice_list" >
|
||||
<ui:param name="invoiceList" value="#{invoiceDispatchController.invoices}"></ui:param>
|
||||
|
||||
<div class="imixs-form-section-2">
|
||||
<dl>
|
||||
|
|
@ -23,55 +19,42 @@
|
|||
<dd>
|
||||
<h:inputText
|
||||
value="#{invoiceDispatchController.filter}">
|
||||
<f:ajax listener="#{invoiceDispatchController.searchInvoices()}" render="search_result"/>
|
||||
|
||||
<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>
|
||||
|
|
@ -86,41 +69,53 @@
|
|||
// collect all selected ids form the checkboxes in the first column
|
||||
$(document).ready(
|
||||
function() {
|
||||
initInvoiceSelection();
|
||||
$('.invoice_selection_list').val('');
|
||||
}
|
||||
);
|
||||
|
||||
// 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;
|
||||
updateSelectionList(checkbox.id, true);
|
||||
updateInvoiceSelection(checkbox.id, true);
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelector('input[id="unclickallid"]').addEventListener('click', function() {
|
||||
document.querySelectorAll('.selection_checkbox').forEach(checkbox => {
|
||||
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 updateSelectionList(id, 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(','));
|
||||
}
|
||||
|
||||
$('input[type="checkbox"].selection_checkbox').change(function() {
|
||||
updateSelectionList($(this).attr('id'), $(this).prop('checked'));
|
||||
});
|
||||
});
|
||||
// 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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue