Sha256: 69229b34887d21652fe9906eae4659993a1146378fa9198efa42c66ebe199cb8
Contents?: true
Size: 1.29 KB
Versions: 53
Compression:
Stored size: 1.29 KB
Contents
Spree.ready(function() { function checkAddItemBox() { $(this).closest('tr').find('input.add-item').attr('checked', 'checked'); updateSuggestedAmount(); } function updateSuggestedAmount() { var totalPretaxRefund = 0; var checkedItems = formFields.find('input.add-item:checked'); $.each(checkedItems, function(i, checkbox) { totalPretaxRefund += parseFloat($(checkbox).parents('tr').find('.refund-amount-input').val()); }); var displayTotal = isNaN(totalPretaxRefund) ? '' : totalPretaxRefund.toFixed(2); formFields.find('span#total_pre_tax_refund').html(displayTotal); } var formFields = $("[data-hook='admin_customer_return_form_fields'], \ [data-hook='admin_return_authorization_form_fields']"); if(formFields.length > 0) { updateSuggestedAmount(); formFields.find('input#select-all').on('change', function(ev) { var checkBoxes = $(ev.currentTarget).parents('table:first').find('input.add-item'); checkBoxes.prop('checked', this.checked); updateSuggestedAmount(); }); formFields.find('input.add-item').on('change', updateSuggestedAmount); formFields.find('.refund-amount-input').on('keyup', updateSuggestedAmount); formFields.find('input, select').not('.add-item').on('change', checkAddItemBox); } });
Version data entries
53 entries across 53 versions & 2 rubygems