Bug 22990: Add CSRF protection to boraccount, pay and suggestion
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / search.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE Categories %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 [% SET libraries = Branches.all %]
9 [% SET categories = Categories.all.unblessed %]
10 [% PROCESS 'patron-search.inc' %]
11 <title>Patron search &rsaquo; Koha</title>
12 [% INCLUDE 'doc-head-close.inc' %]
13 <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 %]
14 </head>
15
16 <body id="common_patron_search" class="common">
17 <div id="patron_search">
18     <div class="container-fluid">
19
20         [% PROCESS patron_search_filters categories => categories, libraries => libraries, filters => ['branch','category','sort1','sort2'], search_filter => searchmember %]
21         </form>
22
23         <div id="searchresults">
24         [% IF columns.grep('checkbox').size %]
25             <div class="searchheader fh-fixedHeader" id="searchheader" style="display:none;">
26                 <div>
27                     <a href="#" class="btn btn-link" id="select_all"><i class="fa fa-check"></i> Select all</a>
28                     |
29                     <a href="#" class="btn btn-link" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
30                     [% IF selection_type == 'add' %]
31                     <button id="add-selected" class="btn btn-sm btn-default" type="submit">Add selected patrons</button>
32                     [% END %]
33                 </div>
34             </div>
35         [% END %]
36         [% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %]
37         </div>
38
39         <div id="closewindow"><a href="#" class="btn btn-default btn-default close">Close</a></div>
40
41     </div>
42 </div>
43
44 [% MACRO jsinclude BLOCK %]
45 [% INCLUDE 'select2.inc' %]
46 <script>
47     $(document).ready(function() {
48         $("#select_all").on("click",function(e){
49             e.preventDefault();
50             $(".selection").prop("checked", true).change();
51         });
52         $("#clear_all").on("click",function(e){
53             e.preventDefault();
54             $(".selection").prop("checked", false).change();
55         });
56         $("#searchheader").hide();
57         $("#patron_search_form").on('submit', function(){$("#searchheader").show();});
58         $("#clear_search").on("click",function(e){$("#searchheader").hide();});
59
60         $('#add-selected').on('click', function(e) {
61             e.preventDefault();
62             var counter = 0;
63             $('tr:has(.selection:checked) .add_user').each(function(){
64                 var borrowernumber = $(this).data('borrowernumber');
65                 var firstname = $(this).data('firstname');
66                 var surname = $(this).data('surname');
67                 add_user( borrowernumber, firstname + ' ' + surname );
68                 counter++;
69             });
70             $('#info').html(_("%s Patrons added.").format(counter));
71         });
72     });
73 </script>
74
75     [% 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 %]
76 [% END %]
77
78 [% SET popup_window = 1 %]
79 [% INCLUDE 'intranet-bottom.inc' %]