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