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