|
Lines 585-595
Link Here
|
| 585 |
const change_given = "[% change_given | html %]"; |
585 |
const change_given = "[% change_given | html %]"; |
| 586 |
const payment_id = "[% payment_id | html %]"; |
586 |
const payment_id = "[% payment_id | html %]"; |
| 587 |
</script> |
587 |
</script> |
| 588 |
|
|
|
| 589 |
<script> |
588 |
<script> |
| 590 |
$(document).ready(function() { |
589 |
$(document).ready(function () { |
| 591 |
if (payment_id && prefs.FinePaymentAutoPopup){ |
590 |
if (payment_id && prefs.FinePaymentAutoPopup) { |
| 592 |
window.open(`/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=${change_given}&accountlines_id=${payment_id}`, '_blank'); |
591 |
window.open(`/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=${change_given}&accountlines_id=${payment_id}`, "_blank"); |
| 593 |
} |
592 |
} |
| 594 |
|
593 |
|
| 595 |
var txtActivefilter = _("Filter paid transactions"); |
594 |
var txtActivefilter = _("Filter paid transactions"); |
|
Lines 602-686
Link Here
|
| 602 |
}, |
601 |
}, |
| 603 |
table_settings |
602 |
table_settings |
| 604 |
); |
603 |
); |
| 605 |
$("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>'); |
604 |
$("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> ' + txtActivefilter + "</a>"); |
| 606 |
$('#filter_transacs').click(function(e) { |
605 |
$("#filter_transacs").click(function (e) { |
| 607 |
e.preventDefault(); |
606 |
e.preventDefault(); |
| 608 |
if ($(this).hasClass('filtered')) { |
607 |
if ($(this).hasClass("filtered")) { |
| 609 |
var filteredValue = ''; |
608 |
var filteredValue = ""; |
| 610 |
$(this).html('<i class="fa fa-filter"></i> '+txtActivefilter); |
609 |
$(this).html('<i class="fa fa-filter"></i> ' + txtActivefilter); |
| 611 |
} else { //Not filtered. Let's do it! |
610 |
} else { |
| 612 |
var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408 |
611 |
//Not filtered. Let's do it! |
| 613 |
$(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter); |
612 |
var filteredValue = "^((?!0.00).*)$"; //Filter not matching 0.00 http://stackoverflow.com/a/406408 |
|
|
613 |
$(this).html('<i class="fa fa-filter"></i> ' + txtInactivefilter); |
| 614 |
} |
614 |
} |
| 615 |
table_account_fines.DataTable().columns( 14 ).search( filteredValue, true, false ).draw(); |
615 |
table_account_fines.DataTable().columns(14).search(filteredValue, true, false).draw(); |
| 616 |
$(this).toggleClass('filtered'); |
616 |
$(this).toggleClass("filtered"); |
| 617 |
}); |
617 |
}); |
| 618 |
|
618 |
|
| 619 |
$("#issuePayoutModal").on("shown.bs.modal", function(e){ |
619 |
$("#issuePayoutModal").on("shown.bs.modal", function (e) { |
| 620 |
var button = $(e.relatedTarget); |
620 |
var button = $(e.relatedTarget); |
| 621 |
var accountline = button.data('accountline'); |
621 |
var accountline = button.data("accountline"); |
| 622 |
$('#payoutline').val(accountline); |
622 |
$("#payoutline").val(accountline); |
| 623 |
var amount = button.data('amount') * -1; |
623 |
var amount = button.data("amount") * -1; |
| 624 |
$("#paid + span").text(amount.format_price()); |
624 |
$("#paid + span").text(amount.format_price()); |
| 625 |
$("#amount").attr({ "value": amount.format_price(), "max": amount, "min": 0 }); |
625 |
$("#amount").attr({ value: amount.format_price(), max: amount, min: 0 }); |
| 626 |
$("#amount, #payout_transaction_type").focus(); |
626 |
$("#amount, #payout_transaction_type").focus(); |
| 627 |
}); |
627 |
}); |
| 628 |
|
628 |
|
| 629 |
$("#issueRefundModal").on("shown.bs.modal", function(e){ |
629 |
$("#issueRefundModal").on("shown.bs.modal", function (e) { |
| 630 |
var button = $(e.relatedTarget); |
630 |
var button = $(e.relatedTarget); |
| 631 |
var item = button.data('item'); |
631 |
var item = button.data("item"); |
| 632 |
$("#item + span").replaceWith(item); |
632 |
$("#item + span").replaceWith(item); |
| 633 |
var accountline = button.data('accountline'); |
633 |
var accountline = button.data("accountline"); |
| 634 |
$('#refundline').val(accountline); |
634 |
$("#refundline").val(accountline); |
| 635 |
var amount = button.data('amount'); |
635 |
var amount = button.data("amount"); |
| 636 |
var amountoutstanding = button.data('amountoutstanding') || 0; |
636 |
var amountoutstanding = button.data("amountoutstanding") || 0; |
| 637 |
var paid = amount - amountoutstanding; |
637 |
var paid = amount - amountoutstanding; |
| 638 |
$("#paid + span").text(paid.format_price()); |
638 |
$("#paid + span").text(paid.format_price()); |
| 639 |
$("#returned").attr({ "value": paid.format_price(), "max": paid.format_price(), "min": 0 }); |
639 |
$("#returned").attr({ value: paid.format_price(), max: paid.format_price(), min: 0 }); |
| 640 |
var member = button.data('member'); |
640 |
var member = button.data("member"); |
| 641 |
if ( member === '' ) { |
641 |
if (member === "") { |
| 642 |
$("#refund_type option[value='AC']").remove(); |
642 |
$("#refund_type option[value='AC']").remove(); |
| 643 |
} else if ( $("#refund_type option[value='AC']").length == 0 ) { |
643 |
} else if ($("#refund_type option[value='AC']").length == 0) { |
| 644 |
$("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>'); |
644 |
$("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>'); |
| 645 |
} |
645 |
} |
| 646 |
$("#returned, #refund_type").focus(); |
646 |
$("#returned, #refund_type").focus(); |
| 647 |
}); |
647 |
}); |
| 648 |
|
648 |
|
| 649 |
$("#applyDiscountModal").on("shown.bs.modal", function(e){ |
649 |
$("#applyDiscountModal").on("shown.bs.modal", function (e) { |
| 650 |
var button = $(e.relatedTarget); |
650 |
var button = $(e.relatedTarget); |
| 651 |
var item = button.data('item'); |
651 |
var item = button.data("item"); |
| 652 |
$("#apply_discount_item + span").replaceWith(item); |
652 |
$("#apply_discount_item + span").replaceWith(item); |
| 653 |
var accountline = button.data('accountline'); |
653 |
var accountline = button.data("accountline"); |
| 654 |
$('#discountline').val(accountline); |
654 |
$("#discountline").val(accountline); |
| 655 |
var amountoutstanding = button.data('amountoutstanding'); |
655 |
var amountoutstanding = button.data("amountoutstanding"); |
| 656 |
$("#charged + span").text(amountoutstanding); |
656 |
$("#charged + span").text(amountoutstanding); |
| 657 |
$("#discount").attr({ "value": (0).format_price(), "max": amountoutstanding, "min": 0 }); |
657 |
$("#discount").attr({ value: (0).format_price(), max: amountoutstanding, min: 0 }); |
| 658 |
$("#discount").focus(); |
658 |
$("#discount").focus(); |
| 659 |
}); |
659 |
}); |
| 660 |
|
660 |
|
| 661 |
$("#voidPaymentModal").on("shown.bs.modal", function(e){ |
661 |
$("#voidPaymentModal").on("shown.bs.modal", function (e) { |
| 662 |
var button = $(e.relatedTarget); |
662 |
var button = $(e.relatedTarget); |
| 663 |
var item = button.data('accountline'); |
663 |
var item = button.data("accountline"); |
| 664 |
$('#voidline').val(item); |
664 |
$("#voidline").val(item); |
| 665 |
}); |
665 |
}); |
| 666 |
|
666 |
|
| 667 |
$("#cancelChargeModal").on("shown.bs.modal", function(e){ |
667 |
$("#cancelChargeModal").on("shown.bs.modal", function (e) { |
| 668 |
var button = $(e.relatedTarget); |
668 |
var button = $(e.relatedTarget); |
| 669 |
var item = button.data('accountlines_id'); |
669 |
var item = button.data("accountlines_id"); |
| 670 |
$('#accountlines_id').val(item); |
670 |
$("#accountlines_id").val(item); |
| 671 |
}); |
671 |
}); |
| 672 |
|
672 |
|
| 673 |
$("#editNoteModal").on("shown.bs.modal", function(e) { |
673 |
$("#editNoteModal").on("shown.bs.modal", function (e) { |
| 674 |
var button = $(e.relatedTarget); |
674 |
var button = $(e.relatedTarget); |
| 675 |
var accountline = button.data('accountline'); |
675 |
var accountline = button.data("accountline"); |
| 676 |
$('#noteline').val(accountline); |
676 |
$("#noteline").val(accountline); |
| 677 |
var note = button.data('note'); |
677 |
var note = button.data("note"); |
| 678 |
$('#edited_note').val(note); |
678 |
$("#edited_note").val(note); |
| 679 |
}); |
679 |
}); |
| 680 |
|
680 |
|
| 681 |
$(".receipt-email-action").on("click", function(e){ |
681 |
$(".receipt-email-action").on("click", function (e) { |
| 682 |
e.preventDefault(); |
682 |
e.preventDefault(); |
| 683 |
return $(this).siblings('form').submit(); |
683 |
return $(this).siblings("form").submit(); |
| 684 |
}); |
684 |
}); |
| 685 |
}); |
685 |
}); |
| 686 |
</script> |
686 |
</script> |