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