Bug 30438: Add select all/clear all buttons to invoices.tt

To test:
1. Apply patch
2. Have a bunch of invoices, some open and some closed.
3. Go to Home > Acquisitions > Invoices and do a search that will
   return you many of those invoices, some open and some closed.
4. Notice the 'Select all' and 'Clear all' buttons.
5. Try clicking 'Select all' on the Open invoices tab. All Open invoices
   should become checked.
6. Try clicking 'Clear all' on the Open invoices tab. All open invoices
   should become unchecked.
7. Try 5 - 6 again but on the Closed invoices tab.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Lucas Gass 2022-04-15 14:00:01 +00:00 committed by Fridolin Somers
parent 81ed12df8c
commit b40d475029
1 changed files with 14 additions and 0 deletions

View File

@ -48,6 +48,7 @@
<label for="show_only_subscription_[% tab | html %]">
Show only subscriptions
</label>
<p><a id="CheckAll[% tab | html %]table" data-cb="[% tab | html %]" class="checkall" href="#"><i class="fa fa-check"></i> Select all</a> | <a id="UncheckAll[% tab | html %]table" data-cb="[% tab | html %]" class="uncheckall" href="#"><i class="fa fa-remove"></i> Clear all</a></p>
<table id="[% tab | html %]resultst" class="result">
<thead>
<tr>
@ -399,6 +400,19 @@
[% INCLUDE 'calendar.inc' %]
<script>
$(document).ready(function() {
$('[id^="CheckAll"]').click( function() {
var table_id = "#" + $(this).attr('data-cb') + "resultst";
$(table_id).find('.select-invoice[type="checkbox"]').each( function() {
$(this).prop("checked" , true );
});
});
$('[id^="UncheckAll"]').click( function() {
var table_id = "#" + $(this).attr('data-cb') + "resultst";
$(table_id).find('.select-invoice[type="checkbox"]').each( function() {
$(this).prop("checked" , false );
});
});
$(".delete_invoice").click(function(){
return confirmDelete(_("Are you sure you want to delete this invoice?"));
});