fix toggle_all sepa_exported when only one is downloaded

This commit is contained in:
viehlieb 2024-01-04 11:47:02 +01:00
parent 24c25b5278
commit fc46281de8
2 changed files with 14 additions and 5 deletions

View file

@ -39,10 +39,19 @@ function doTheDownload(selectedGroupOrderIds, orderId, url, supplier, mode = "al
var modalSelector = "#order_" + orderId + "_modal"; var modalSelector = "#order_" + orderId + "_modal";
// Update the value attribute of checkboxes with IDs starting with "sepa_downloaded" to '1' // Update the value attribute of checkboxes with IDs starting with "sepa_downloaded" to '1'
if (selectedGroupOrderIds.length >= 1) {
selectedGroupOrderIds.forEach(function (groupOrderId) {
var modalSelector = "#group_order_" + groupOrderId;
checkbox_element = $(modalSelector + ' input[id^="sepa_downloaded"]');
checkbox_element.val('1');
checkbox_element.prop('checked', true);
});
} else {
$(modalSelector + ' input[id^="sepa_downloaded"]').each(function () { $(modalSelector + ' input[id^="sepa_downloaded"]').each(function () {
$(this).val('1'); $(this).val('1');
$(this).prop('checked', true); $(this).prop('checked', true);
}); });
}
}, },
error: function (error) { error: function (error) {
// Handle error // Handle error

View file

@ -24,7 +24,7 @@
%tbody %tbody
- order.group_orders.includes([:group_order_invoice, :ordergroup]).each do |go| - order.group_orders.includes([:group_order_invoice, :ordergroup]).each do |go|
- if go.group_order_invoice - if go.group_order_invoice
%tr.order-row %tr.order-row{id: "group_order_#{go.id}"}
%td= link_to go.ordergroup.name, edit_admin_ordergroup_path(go.ordergroup) %td= link_to go.ordergroup.name, edit_admin_ordergroup_path(go.ordergroup)
%td %td
.div{id: "paid_#{go.group_order_invoice.id}"} .div{id: "paid_#{go.group_order_invoice.id}"}