Bug 35127: Fix 'Search type' for patron search
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / member-search-box.inc
1 <!-- member-search-box.inc -->
2 [% USE Branches %]
3 [% USE Categories %]
4 [% USE Koha %]
5 [% PROCESS 'patronfields.inc' %]
6 [% IF CAN_user_borrowers_edit_borrowers %]
7     [%- SET searchtype = searchtype || Koha.Preference('DefaultPatronSearchMethod') -%]
8     [% IF( bs_tab_active ) %]
9         <div id="patron_search" role="tabpanel" class="tab-pane active">
10     [% ELSE %]
11         <div id="patron_search" role="tabpanel" class="tab-pane">
12     [% END %]
13         <form method="post" action="/cgi-bin/koha/members/member.pl">
14             <input type="hidden" name="quicksearch" value="1" />
15
16             <div class="form-title">
17                 <label class="control-label">Search patrons</label>
18             </div>
19
20             <div class="form-content">
21                 [% IF ( Koha.Preference('RetainPatronsSearchTerms') ) %]
22                     <input name="searchmember" id="searchmember" class="head-searchbox form-control" type="text" placeholder="Enter patron card number or partial name" size="25" value="[% searchmember | html %]"/>
23                 [% ELSE %]
24                     <input name="searchmember" id="searchmember" class="head-searchbox form-control" type="text" placeholder="Enter patron card number or partial name" size="25"/>
25                 [% END %]
26
27                 <button type="button" class="form-extra-content-toggle"><i class="fa fa-sliders"></i></button>
28             </div>
29
30             <button type="submit"><i class="fa fa-arrow-right"></i></button>
31
32             <div class="form-extra-content">
33                 <div>
34                     [% INCLUDE patron_fields_dropdown search_box=1 %]
35                 </div>
36
37                 <div>
38                     <label for="searchtype" class="control-label">Search type</label>
39                     <select name="searchtype" id="searchtype" class="form-control">
40                         [% IF searchtype == 'starts_with' %]
41                             <option value='starts_with' selected='selected'>Starts with</option>
42                             <option value='contains'>Contains</option>
43                         [% ELSE %]
44                             <option value='starts_with'>Starts with</option>
45                             <option value='contains' selected='selected'>Contains</option>
46                         [% END %]
47                     </select>
48                 </div>
49
50                 <div>
51                     [% SET branches = Branches.all( selected => branchcode_filter, only_from_group => 1 ) %]
52                     <label for="branchcode" class="control-label">Library</label>
53                     <select name="branchcode_filter" id="branchcode" class="form-control">
54                         [% IF branches.size != 1 %]
55                             <option value="">Any</option>
56                         [% END %]
57                         [% PROCESS options_for_libraries libraries => branches %]
58                     </select>
59                 </div>
60
61                 <div>
62                     [% SET categories = Categories.all() %]
63                     <label for="categorycode" class="control-label">Category</label>
64                     <select name="categorycode_filter" id="categorycode" class="form-control">
65                         <option value="">Any</option>
66                         [% FOREACH category IN categories %]
67                             [% IF category.categorycode == categorycode_filter %]
68                                 <option value="[% category.categorycode | html %]" selected="selected">[% category.description | html %]</option>
69                             [% ELSE %]
70                                 <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
71                             [% END %]
72                         [% END %]
73                     </select>
74                 </div>
75             </div>
76         </form>
77     </div>
78 [% END %]
79 <!-- /member-search-box.inc -->