Bug 9811: Patron search improvement
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / patron-search.inc
1 [% USE Koha %]
2 <div class="gradient">
3 <h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Patrons Resident Search Box -->
4 <div id="header_search">
5         <div id="patron_search" class="residentsearch">
6         <p class="tip">Enter patron card number or partial name:</p>
7         <form action="/cgi-bin/koha/members/member.pl" method="post">
8     <input id="searchmember" data-toggle="tooltip" size="25" class="focus" name="searchmember" type="text" value="[% searchmember %]"/>
9     <input type="hidden" name="quicksearch" value="1" />
10         <span class="filteraction" id="filteraction_off"> <a href="#" onclick="$('#filters').toggle();$('.filteraction').toggle();">[-]</a></span>
11         <span class="filteraction" id="filteraction_on"> <a href="#" onclick="$('#filters').toggle();$('.filteraction').toggle();">[+]</a></span>
12
13       <label for="searchfieldstype">Search fields:</label>
14       <select name="searchfieldstype" id="searchfieldstype">
15         [% IF searchfieldstype == "standard" %]
16           <option selected="selected" value='standard'>Standard</option>
17         [% ELSE %]
18           <option value='standard'>Standard</option>
19         [% END %]
20         [% IF searchfieldstype == "email" %]
21           <option selected="selected" value='email'>Email</option>
22         [% ELSE %]
23           <option value='email'>Email</option>
24         [% END %]
25         [% IF searchfieldstype == "borrowernumber" %]
26           <option selected="selected" value='borrowernumber'>Borrower number</option>
27         [% ELSE %]
28           <option value='borrowernumber'>Borrower number</option>
29         [% END %]
30         [% IF searchfieldstype == "phone" %]
31           <option selected="selected" value='phone'>Phone number</option>
32         [% ELSE %]
33           <option value='phone'>Phone number</option>
34         [% END %]
35         [% IF searchfieldstype == "address" %]
36           <option selected="selected" value='address'>Street Address</option>
37         [% ELSE %]
38           <option value='address'>Street Address</option>
39         [% END %]
40         [% IF searchfieldstype == "dateofbirth" %]
41           <option selected="selected" value='dateofbirth'>Date of birth</option>
42         [% ELSE %]
43           <option value='dateofbirth'>Date of birth</option>
44         [% END %]
45         [% IF searchfieldstype == "sort1" %]
46           <option selected="selected" value='sort1'>Sort field 1</option>
47         [% ELSE %]
48           <option value='sort1'>Sort field 1</option>
49         [% END %]
50         [% IF searchfieldstype == "sort2" %]
51           <option selected="selected" value='sort2'>Sort field 2</option>
52         [% ELSE %]
53           <option value='sort2'>Sort field 2</option>
54         [% END %]
55       </select>
56
57       <script type="text/javascript">
58           [% SET dateformat = Koha.Preference('dateformat') %]
59           $("#searchfields").change(function() {
60               if ( $(this).val() == 'dateofbirth' ) {
61                   [% IF dateformat == 'us' %]
62                       var MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'MM/DD/YYYY'");
63                   [% ELSIF dateformat == 'iso' %]
64                       var MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'YYYY-MM-DD'");
65                   [% ELSIF dateformat == 'metric' %]
66                       var MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'DD/MM/YYYY'");
67                   [% END %]
68                   $('#searchmember').attr("title",MSG_DATE_FORMAT).tooltip('show');
69               } else {
70                   $('#searchmember').tooltip('destroy');
71               }
72           });
73
74       </script>
75
76       <label for="searchtype">Search type:</label>
77       <select name="searchtype" id="searchtype">
78           <option selected="selected" value='start_with'>Starts with</option>
79           <option value='contain'>Contains</option>
80       </select>
81
82     <input value="Search" class="submit" type="submit" />
83     [% IF ( branchloop ) %]
84     <p id="filters"> <label for="branchcode">Library: </label>
85     <select name="branchcode" id="branchcode">
86         [% IF branchloop.size != 1 %]
87           <option value="">Any</option>
88         [% END %]
89         [% FOREACH branchloo IN branchloop %]
90         [% IF ( branchloo.selected ) %]
91         <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]
92         <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
93       [% END %]</select>
94                  <label for="categorycode">Category: </label><select name="categorycode" id="categorycode">
95         <option value="">Any</option>[% FOREACH categorie IN categories %]
96         [% IF ( categorie.selected ) %]
97         <option value="[% categorie.categorycode %]" selected="selected">[% categorie.description |html_entity %]</option>[% ELSE %]
98         <option value="[% categorie.categorycode %]">[% categorie.description |html_entity %]</option>[% END %]
99       [% END %]</select>
100     </p>
101     [% END %]
102 </form>
103         </div>
104
105     [% INCLUDE 'patron-search-box.inc' %]
106
107         [% IF ( CAN_user_catalogue ) %]
108     <div id="catalog_search" class="residentsearch">
109         <p class="tip">Enter search keywords:</p>
110                 <form action="/cgi-bin/koha/catalogue/search.pl"  method="get" id="cat-search-block">
111                          <input type="text" name="q" id="search-form" size="40" value="" title="Enter the terms you wish to search for." class="form-text" />
112                                 <input type="submit" name="op" id="opac-submit" value="Submit" class="submit" />
113                 </form>
114         </div>[% END %]
115     [% IF ( CAN_user_circulate ) %]
116     <div id="checkin_search" class="residentsearch">
117     <p class="tip">Scan a barcode to check in:</p>
118     <form method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off">
119     <input name="barcode" id="ret_barcode" size="40" accesskey="r" />
120     <input value="Submit" class="submit" type="submit" />
121     </form>
122     </div>
123     [% END %]
124                         <ul>
125             <li><a href="#patron_search">Search patrons</a></li>
126             [% IF ( CAN_user_circulate ) %]<li><a href="#circ_search">Check out</a></li>[% END %]
127     [% IF ( CAN_user_circulate ) %]<li><a href="#checkin_search">Check in</a></li>[% END %]
128             [% IF ( CAN_user_catalogue ) %]<li><a href="#catalog_search">Search the catalog</a></li>[% END %]
129                         </ul>
130 </div><!-- /header_search -->
131 </div><!-- /gradient -->
132 <script type="text/javascript">//<![CDATA[
133 $(document).ready(function() {
134     [% IF ( advsearch ) %]$("#filteraction_on").toggle();
135     [% ELSE %]$("#filters").toggle();
136     $("#filteraction_off").toggle();[% END %]
137 });
138 //]]>
139 </script>
140 <!-- End Patrons Resident Search Box -->