[% USE Koha %]
[% USE I18N %]
[% USE Branches %]
[% USE raw %]
[% USE Asset %]
[% USE To %]
[%# Display a simple form %]
[% BLOCK patron_search_filters_simple %]
[% END %]
[%# Display a complex patron search form %]
[%# - Search: input %]
[%# You can then pass a list of filters %]
[%# - branch: select library list %]
[%# - category: select patron category list %]
[%# - sort1: select patron sort1 field %]
[%# - sort2: select patron sort2 field %]
[%# - search_field: select patron field list %]
[%# - search_type: select 'contains' or 'starts with' %]
[%- searchtype = searchtype || Koha.Preference('DefaultPatronSearchMethod') -%]
[% BLOCK patron_search_filters %]
[% END %]
[%# Display the table with: %]
[%# - At the top a hint about a possible filter %]
[%# - Browse by last name %]
[%# - The table %]
[%# Get the following parameters: %]
[%# - filter: can be 'suggestions_managers', 'orders_managers', 'funds_owners', 'funds_users' or 'erm_users' to filter patrons on their permissions %]
[%# - table_id: the ID of the table %]
[%# open_on_row_click: See patron_search_js %]
[%# columns: See patron_search_js %]
[% BLOCK patron_search_table %]
[% IF filter == 'suggestions_managers' %]
Only staff with superlibrarian or suggestions_manage permissions are returned in the search results
[% ELSIF filter == 'orders_managers' %]
Only staff with superlibrarian or acquisitions permissions (or order_manage permission if granular permissions are enabled) are returned in the search results
[% ELSIF filter == 'funds_owners' OR filter == 'funds_users' %]
Only staff with superlibrarian or acquisitions permissions (or budget_modify permission if granular permissions are enabled) are returned in the search results
[% ELSIF filter == 'erm_users' %]
Only staff with superlibrarian or ERM permissions are returned in the search results
[% END %]
Browse by last name:
[% SET alphabet = Koha.Preference('alphabet').split(' ') %]
[% UNLESS alphabet.size %]
[% alphabet = ['A' .. 'Z'] %]
[% END %]
[% FOREACH letter IN alphabet %]
[% letter | html %]
[% END %]
Patrons found for:
[% IF open_on_row_click %]
[% ELSE %]
[% END %]
[% FOR column IN columns %]
[% SWITCH column %]
[% CASE 'checkbox' %]
[% CASE 'cardnumber' %]
Card
[% CASE 'dateofbirth' %]
Date of birth
[% CASE 'name' %]
Name
[% CASE 'name-address' %]
Name
[% CASE 'address' %]
Address
[% CASE 'address-library' %]
Address
[% CASE 'branch' %]
Library
[% CASE 'category' %]
Category
[% CASE 'dateexpiry' %]
Expires on
[% CASE 'borrowernotes' %]
Notes
[% CASE 'phone' %]
Phone
[% CASE 'checkouts' %]
Checkouts
[% CASE 'account_balance' %]
Fines
[% CASE 'action' %]
[% END %]
[% END %]
Loading
[% END %]
[%# Integrate all the JS code, outside of a script tag %]
[%# Get the following parameters: %]
[%# - redirect_if_one_result: Redirect to the patron if the search returns only one result, note that it will not redirect if filters of the DT are used (this is a feature) %]
[%# - redirect_url: The URL to use, the borrowernumber parameter will be added %]
[%# - redirect_if_attribute_equal: Name of the attribute to use for the redirect. Query using this attribute, before the normal search %]
[%# filter: Same as patron_search_table %]
[%# open_on_row_click: boolean, default off. Will allow to select a patron by clicking on the whole tr element %]
[%# columns: list of columns that will be displayed. Possible values are: 'checkbox', 'cardnumber', 'dateofbirth', 'address', 'name', 'name-address', 'branch', 'category', 'dateexpiry', 'borrowernotes, 'phone', 'checkouts', 'account_balance', 'action' %]
[%# preview_on_name_click: Open a modal window with patron's info when the name is clicked %]
[%# actions: list of buttons to display in the action column. Possible values are: 'select', 'add', 'edit', 'checkout' %]
[%# sticky_header and sticky_to: If we need a sticky header %]
[%# callback: name of the JS function that will be called when a patron is selected. Only work with action=select %]
[%# display_search_description: boolean, default off. Display the description of the search %]
[% BLOCK patron_search_js %]
[% IF redirect_if_one_result && !redirect_url %]
[% END %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'js-patron-get-age.inc' %]
[% INCLUDE 'js-patron-format.inc' %]
[% INCLUDE 'js-patron-format-address.inc' %]
[% IF sticky_header %]
[% Asset.js("lib/hc-sticky.js") | $raw %]
[% END %]
[% END %]