Koha/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt
Michael Hafen f1e90cc4c2
Bug 28726: Add sort1 and sort2 to patron card creator - patron search.
Also adds a select all / clear all and checkboxes.

Test plan:

1. start a new batch in the patron card creator (Tools -> Patron card creator -> New -> card batch)
2. click the Add patron(s) button.  Observe that Category and Library are the only options.
3. Close search for patron window.
4. Apply patch.
5. click the Add patron(s) button.  Observe that you can now search for patrons by their sort1 and sort2 values.
6. perform a search and observe the 'Select all | Clear all | Add selected patrons' links and button.
7. use the Select all link to select all the patrons found by the search.
8. use the Add selected patrons button to add the selected patrons to the card batch's Add by borrowernumber(s) text input field.
9. close the search for patron window.

Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 79f8e148af)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2023-07-17 16:02:12 +01:00

78 lines
3.2 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE Branches %]
[% USE Categories %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
[% SET libraries = Branches.all %]
[% SET categories = Categories.all.unblessed %]
[% PROCESS 'patron-search.inc' %]
<title>Patron search &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
<style> .modal-body .close { display: none; } </style>[%# FIXME This is not great, we should make members/memberentrygen.tt use a modal as well and we won't need that here %]
</head>
<body id="common_patron_search" class="common">
<div id="patron_search">
<div class="container-fluid">
[% PROCESS patron_search_filters categories => categories, libraries => libraries, filters => ['branch','category','sort1','sort2'], search_filter => searchmember %]
</form>
<div id="searchresults">
<div class="searchheader fh-fixedHeader" id="searchheader" style="display:none;">
<div>
[% IF columns.grep('checkbox').size %]
<a href="#" class="btn btn-link" id="select_all"><i class="fa fa-check"></i> Select all</a>
|
<a href="#" class="btn btn-link" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
[% IF selection_type == 'add' %]
<button id="add-selected" class="btn btn-sm btn-default" type="submit">Add selected patrons</button>
[% END %]
[% END %]
</div>
</div>
[% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %]
</div>
<div id="closewindow"><a href="#" class="btn btn-default btn-default close">Close</a></div>
</div>
</div>
[% MACRO jsinclude BLOCK %]
<script>
$(document).ready(function() {
$("#select_all").on("click",function(e){
e.preventDefault();
$(".selection").prop("checked", true).change();
});
$("#clear_all").on("click",function(e){
e.preventDefault();
$(".selection").prop("checked", false).change();
});
$("#searchheader").hide();
$("#patron_search_form").on('submit', function(){$("#searchheader").show();});
$("#clear_search").on("click",function(e){$("#searchheader").hide();});
$('#add-selected').on('click', function(e) {
e.preventDefault();
var counter = 0;
$('tr:has(.selection:checked) .add_user').each(function(){
var borrowernumber = $(this).data('borrowernumber');
var firstname = $(this).data('firstname');
var surname = $(this).data('surname');
add_user( borrowernumber, firstname + ' ' + surname );
counter++;
});
$('#info').html(_("%s Patrons added.").format(counter));
});
});
</script>
[% PROCESS patron_search_js table_id => 'memberresultst', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, filter => filter, actions => [selection_type], preview_on_name_click => 1, callback => callback %]
[% END %]
[% SET popup_window = 1 %]
[% INCLUDE 'intranet-bottom.inc' %]