Bug 30952: Staff interface redesign (header)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / member-search-box.inc
1 [% USE Branches %]
2 [% USE Koha %]
3 [% PROCESS 'patronfields.inc' %]
4 [% IF CAN_user_borrowers_edit_borrowers %]
5     <div id="patron_search" class="residentsearch">
6         <form method="post" action="/cgi-bin/koha/members/member.pl">
7             <input type="hidden" name="quicksearch" value="1" />
8
9             <span class="form-title">
10                 <label class="control-label">Search patrons</label>
11             </span>
12
13             <span class="form-content">
14                 [% IF ( Koha.Preference('RetainPatronsSearchTerms') ) %]
15                     <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 %]"/>
16                 [% ELSE %]
17                     <input name="searchmember" id="searchmember" class="head-searchbox form-control" type="text" placeholder="Enter patron card number or partial name" size="25"/>
18                 [% END %]
19
20                 <button type="button" class="form-extra-content-toggle"><i class="fa fa-sliders"></i></button>
21             </span>
22
23             <button type="submit"><i class="fa fa-arrow-right"></i></button>
24
25             <div class="form-extra-content">
26                 <div>
27                     <label for="searchfieldstype" class="control-label">Search fields</label>
28                     <select name="searchfieldstype" id="searchfieldstype" class="form-control">
29                         [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' %]
30                         [% default_fields = [ standard, 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %]
31                         [% search_options = default_fields.merge(standard.split(',')).unique %]
32                         [% FOREACH s_o IN search_options %]
33                             [% display_name = PROCESS patron_fields name=s_o %]
34                             [% NEXT IF !display_name.length %]
35                             [% IF searchfieldstype == s_o %]
36                                 <option value="[% s_o | html %]">[% display_name | $raw %]</option>
37                             [% ELSE %]
38                                 <option value="[% s_o | html %]">[% display_name | $raw %]</option>
39                             [% END %]
40                         [% END %]
41                     </select>
42                 </div>
43
44                 <div>
45                     <label for="searchtype" class="control-label">Search type</label>
46                     <select name="searchtype" id="searchtype" class="form-control">
47                     [% IF searchtype == 'start_with' %]
48                         <option value='start_with'>Starts with</option>
49                         <option value='contain'>Contains</option>
50                     [% ELSE %]
51                         <option value='start_with'>Starts with</option>
52                         <option value='contain'>Contains</option>
53                     [% END %]
54                     </select>
55                 </div>
56
57                 <div>
58                     [% SET branches = Branches.all( selected => branchcode_filter, only_from_group => 1 ) %]
59                     <label for="branchcode" class="control-label">Library</label>
60                     <select name="branchcode_filter" id="branchcode" class="form-control">
61                         [% IF branches.size != 1 %]
62                         <option value="">Any</option>
63                         [% END %]
64                         [% PROCESS options_for_libraries libraries => branches %]
65                     </select>
66                 </div>
67
68                 <div>
69                     [% SET categories = Categories.all() %]
70                     <label for="categorycode" class="control-label">Category</label>
71                     <select name="categorycode_filter" id="categorycode" class="form-control">
72                         <option value="">Any</option>
73                         [% FOREACH category IN categories %]
74                             [% IF category.categorycode == categorycode_filter %]
75                                 <option value="[% category.categorycode | html %]" selected="selected">[% category.description | html %]</option>
76                             [% ELSE %]
77                                 <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
78                             [% END %]
79                         [% END %]
80                     </select>
81                 </div>
82             </div>
83         </form>
84     </div>
85 [% END %]