Bug 13941: [2/2] Fix <body> tags missing id/class
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / common / patron_search.tt
1 [% USE Koha %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Patron search</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7
8 <script type="text/javascript">
9 //<![CDATA[
10
11 var search = 1;
12 $(document).ready(function(){
13     $("#info").hide();
14     $("#error").hide();
15
16     [% IF view != "show_results" %]
17         $("#searchresults").hide();
18         search = 0;
19     [% END %]
20
21     // Apply DataTables on the results table
22     dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
23         'bServerSide': true,
24         'sAjaxSource': "/cgi-bin/koha/svc/members/search",
25         'fnServerData': function(sSource, aoData, fnCallback) {
26             if ( ! search ) {
27                 return;
28             }
29             aoData.push({
30                 'name': 'searchmember',
31                 'value': $("#searchmember_filter").val()
32             },{
33                 'name': 'firstletter',
34                 'value': $("#firstletter_filter").val()
35             },{
36                 'name': 'categorycode',
37                 'value': $("#categorycode_filter").val()
38             },{
39                 'name': 'branchcode',
40                 'value': $("#branchcode_filter").val()
41             },{
42                 'name': 'name_sorton',
43                 'value': 'borrowers.surname borrowers.firstname'
44             },{
45                 'name': 'category_sorton',
46                 'value': 'categories.description',
47             },{
48                 'name': 'branch_sorton',
49                 'value': 'branches.branchname'
50             },{
51                 'name': 'template_path',
52                 'value': '[% json_template %]',
53             },{
54                 'name': 'selection_type',
55                 'value': '[% selection_type %]',
56             }
57             [% IF patrons_with_acq_perm_only %]
58             ,{
59                 'name': 'has_permission',
60                 'value': 'acquisition.order_manage',
61             }
62             [% END %]
63             );
64             $.ajax({
65                 'dataType': 'json',
66                 'type': 'POST',
67                 'url': sSource,
68                 'data': aoData,
69                 'success': function(json){
70                     fnCallback(json);
71                 }
72             });
73         },
74         'aoColumns':[
75             [% FOR column IN columns %]
76                 [% IF column == 'action' %]
77                     { 'mDataProp': 'dt_action', 'bSortable': false }
78                 [% ELSIF column == 'address' %]
79                     { 'mDataProp': 'dt_address', 'bSortable': false }
80                 [% ELSE %]
81                     { 'mDataProp': 'dt_[% column %]' }
82                 [% END %]
83                 [% UNLESS loop.last %],[% END %]
84             [% END %]
85         ],
86         'bAutoWidth': false,
87         [% IF patrons_with_acq_perm_only %]
88             'bPaginate': false,
89         [% ELSE %]
90             'sPaginationType': 'full_numbers',
91             "iDisplayLength": [% Koha.Preference('PatronsPerPage') %],
92         [% END %]
93         'bFilter': false,
94         'bProcessing': true,
95     }));
96
97     $("#searchform").on('submit', filter);
98 });
99
100 function filter() {
101     search = 1;
102     $("#firstletter_filter").val('');
103     $("#searchresults").show();
104     dtMemberResults.fnDraw();
105     return false;
106 }
107
108 // User has clicked on a letter
109 function filterByFirstLetterSurname(letter) {
110     $("#firstletter_filter").val(letter);
111     search = 1;
112     $("#searchresults").show();
113     dtMemberResults.fnDraw();
114 }
115
116
117     // modify parent window owner element
118     [% IF selection_type == 'add' %]
119         function add_user(borrowernumber, borrowername) {
120             var p = window.opener;
121             // In one place (serials/routing.tt), the page is reload on every add
122             // We have to wait for the page to be there
123             function wait_for_opener () {
124                 if ( ! $(opener.document).find('body').size() ) {
125                     setTimeout(wait_for_opener, 500);
126                 } else {
127                     [%# Note that add_user could sent data instead of borrowername too %]
128                     $("#info").hide();
129                     $("#error").hide();
130                     if ( p.add_user(borrowernumber, borrowername) < 0 ) {
131                         $("#error").html(_("Borrower '%s' is already in the list.").format(borrowername));
132                         $("#error").show();
133                     } else {
134                         $("#info").html(_("Borrower '%s' added.").format(borrowername));
135                         $("#info").show();
136                     }
137                 }
138             }
139             wait_for_opener();
140         }
141     [% ELSIF selection_type == 'select' %]
142         function select_user(borrowernumber, data) {
143             var p = window.opener;
144             p.select_user(borrowernumber, data);
145             window.close();
146         }
147     [% END %]
148 //]]>
149 </script>
150
151 </head>
152 <body id="common_patron_search" class="common">
153 <div id="patron_search" class="yui-t7">
154   <div id="bd">
155     <div class="yui-g">
156
157         <form id="searchform">
158             <fieldset class="brief">
159                 <h3>Search for patron</h3>
160                 <ol>
161                     <li>
162                         <label for="searchmember_filter">Search:</label>
163                         <input type="text" id="searchmember_filter" value="[% searchmember %]"/>
164                     </li>
165                     <li>
166                         <label for="categorycode_filter">Category:</label>
167                         <select id="categorycode_filter">
168                             <option value="">Any</option>
169                             [% FOREACH category IN categories %]
170                                 <option value="[% category.categorycode %]">[% category.description %]</option>
171                             [% END %]
172                         </select>
173                     </li>
174                     <li>
175                         <label for="branchcode_filter">Library:</label>
176                         <select id="branchcode_filter">
177                             [% IF branches.size != 1 %]
178                                 <option value="">Any</option>
179                             [% END %]
180                             [% FOREACH branch IN branches %]
181                                 <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
182                             [% END %]
183                         </select>
184                     </li>
185                 </ol>
186                 <fieldset class="action">
187                     <input type="submit" value="Search" />
188                 </fieldset>
189             </fieldset>
190         <form>
191
192         [% IF patrons_with_acq_perm_only %]
193             <div class="hint">Only staff with superlibrarian or acquisitions permissions (or order_manage permission if granular permissions are enabled) are returned in the search results</div>
194         [% END %]
195
196         <div class="browse">
197             Browse by last name:
198             [% FOREACH letter IN alphabet.split(' ') %]
199                 <a style="cursor:pointer" onclick="filterByFirstLetterSurname('[% letter %]');">[% letter %]</a>
200             [% END %]
201         </div>
202
203         <div id="info" class="dialog message"></div>
204         <div id="error" class="dialog alert"></div>
205
206         <input type="hidden" id="firstletter_filter" value="" />
207         <div id="searchresults">
208             <table id="memberresultst">
209                 <thead>
210                     <tr>
211                         [% FOR column IN columns %]
212                             [% SWITCH column %]
213                                 [% CASE 'cardnumber' %]<th>Card</th>
214                                 [% CASE 'dateofbirth' %]<th>Date of birth</th>
215                                 [% CASE 'address' %]<th>Address</th>
216                                 [% CASE 'name' %]<th>Name</th>
217                                 [% CASE 'branch' %]<th>Library</th>
218                                 [% CASE 'category' %]<th>Category</th>
219                                 [% CASE 'dateexpiry' %]<th>Expires on</td>
220                                 [% CASE 'borrowernotes' %]<th>Notes</th>
221                                 [% CASE 'action' %]<th>&nbsp;</th>
222                             [% END %]
223                         [% END %]
224                     </tr>
225                   </thead>
226                 <tbody></tbody>
227             </table>
228         </div>
229
230 <div id="closewindow"><a href="#" class="close">Close</a></div>
231 </div>
232 </div>
233 [% INCLUDE 'intranet-bottom.inc' %]