6ea103367b3cccde90d90c873f6c8bc953fe54ce
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / serials-search.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AuthorisedValues %]
4 [% USE Branches %]
5 [% USE CGI %]
6 [% USE KohaDates %]
7 [% USE Koha %]
8 [% SET footerjs = 1 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Koha &rsaquo; Serials [% biblionumber | html %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 <style>input.dt-filter { width : 100%; font-size : 85%; }</style>
13 </head>
14
15 <body id="ser_serials-home" class="ser">
16 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'serials-search.inc' %]
18
19 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; [% IF ( done_searched ) %]<a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Search results[% ELSE %]Serials [% END %] </div>
20
21 [% url_params = [] %]
22 [% FOREACH param IN CGI.params.pairs %]
23     [% escaped_value = BLOCK %][% param.value | uri %][% END %]
24     [% url_params.push(param.key _ '=' _ escaped_value) %]
25 [% END %]
26 [% SET referrer = '/cgi-bin/koha/serials/serials-search.pl?' %]
27 [% referrer = BLOCK %][% referrer | url %][% url_params.join("&amp;") |uri %][% END %]
28 [% SET edit_action_link = '/cgi-bin/koha/serials/subscription-batchedit.pl?referrer=' _ referrer %]
29
30 [% BLOCK subscriptions_table %]
31   <form method="post">
32
33     [% IF closed %]
34         [% SET tab = 'closed' %]
35     [% ELSE %]
36         [% SET tab = 'opened' %]
37     [% END %]
38     [% IF CAN_user_serials_edit_subscription %]
39         <div class="actions">
40             <a class="select-all" href="#" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</a>
41             |
42             <a class="clear-all" href="#" data-tab="[% tab | html %]"><i class="fa fa-remove"></i> Clear all</a>
43             <span class="itemselection_actions">
44                 | Actions:
45                 <a class="itemselection_action_modify"><i class="fa fa-pencil"></i> Edit selected serials</a>
46             </span>
47         </div>
48     [% END %]
49     <table>
50       <thead>
51         <tr>
52             <th></th>
53             <th>ISSN</th>
54             <th class="anti-the">Title</th>
55             <th>Notes</th>
56             <th>Library</th>
57             <th>Location</th>
58             <th>Call number</th>
59             [% UNLESS closed %]
60                 <th class="title-string">Expiration date</th>
61             [% END %]
62             [% FOR field IN additional_fields_for_subscription %]
63               <th>[% field.name | html %]</th>
64             [% END %]
65             <th class="NoSort">Actions</th>
66         </tr>
67       </thead>
68       <tfoot>
69         <tr>
70           <td></td>
71           <td><input type="text" class="dt-filter" data-column_num="0" placeholder="Search ISSN" /></td>
72           <td><input type="text" class="dt-filter" data-column_num="1" placeholder="Search title" /></td>
73           <td><input type="text" class="dt-filter" data-column_num="2" placeholder="Search notes" /></td>
74           <td><input type="text" class="dt-filter" data-column_num="3" placeholder="Search library" /></td>
75           <td><input type="text" class="dt-filter" data-column_num="4" placeholder="Search location" /></td>
76           <td><input type="text" class="dt-filter" data-column_num="5" placeholder="Search callnumber" /></td>
77           [% UNLESS closed %]
78               <td><input type="text" class="dt-filter" data-column_num="6" placeholder="Search expiration date" /></td>
79           [% END %]
80           [% FOR field IN additional_fields_for_subscription %]
81             <td><input type="text" class="dt-filter" data-column_num="[% loop.count + 6 | html %]" placeholder="Search [% field.name | html %]" /></td>
82           [% END %]
83           <td></td>
84         </tr>
85       </tfoot>
86       <tbody>
87         [% FOREACH subscription IN subscriptions %]
88         [% UNLESS subscription.cannotdisplay %]
89           <tr>
90             <td>
91                 [% UNLESS subscription.cannotedit %]
92                     <input type="checkbox" name="subscriptionid" value="[% subscription.subscriptionid | html %]" />
93                 [% ELSE %]
94                     <input type="checkbox" name="subscriptionid" value="[% subscription.subscriptionid | html %]" disabled="disabled" title="You cannot edit this subscription" />
95                 [% END %]
96             </td>
97             <td>
98             [% IF ( subscription.issn ) %][% subscription.issn | html %]
99             [% END %]
100             </td>
101             <td><a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscription.subscriptionid | uri %]" class="button" title="subscription detail">[% subscription.title | html %]</a>
102             </td>
103             <td>[% IF ( subscription.publicnotes ) %][% subscription.publicnotes | html %][% END %]
104             [% IF ( subscription.internalnotes ) %]([% subscription.internalnotes | html %])[% END %]
105             </td>
106             <td>
107               [% IF ( subscription.branchcode ) %][% Branches.GetName( subscription.branchcode ) | html %][% END %]
108             </td>
109             <td>
110               [% IF ( subscription.location ) %][% AuthorisedValues.GetByCode( 'LOC', subscription.location ) | html %][% END %]
111             </td>
112             <td>
113               [% IF ( subscription.callnumber ) %][% subscription.callnumber | html %][% END %]
114             </td>
115             [% UNLESS closed %]
116                 <td>
117                     [% IF ( subscription.enddate ) %]
118                         <span title="[% subscription.enddate | html %]">[% subscription.enddate | $KohaDates %]</span>
119                     [% ELSE %]
120                         <span title="0000-00-00"></span>
121                     [% END %]
122                 </td>
123             [% END %]
124
125             [% FOR field IN additional_fields_for_subscription %]
126               [% IF field.authorised_value_category %]
127                 <td>[% AuthorisedValues.GetByCode( field.authorised_value_category, subscription.additional_fields.${field.name} ) | html %]</td>
128               [% ELSE %]
129                 <td>[% subscription.additional_fields.${field.name} | html %]</td>
130               [% END %]
131             [% END %]
132
133             <td>
134                 <div class="dropdown">
135                     [% IF closed %]
136                         <a class="btn btn-default btn-xs dropdown-toggle" id="closedsubactions[% subscription.subscriptionid | html %]" role="button" data-toggle="dropdown" href="#">
137                            Actions <b class="caret"></b>
138                         </a>
139                         <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="closedsubactions[% subscription.subscriptionid | html %]">
140
141                             [% IF ( routing && CAN_user_serials_routing ) %]
142                                 [% UNLESS ( subscription.cannotedit ) %]
143                                     <li>
144                                         <a href="/cgi-bin/koha/serials/serials-search.pl?subscriptionid=[% subscription.subscriptionid | uri %]&amp;op=reopen&amp;routing=[% subscription.routing | uri %]&amp;searched=1&amp;title_filter=[% title_filter | uri %]&amp;ISSN_filter=[% ISSN_filter | uri %]&amp;EAN_filter=[% EAN_filter | uri %]&amp;published_filter=[% publisher_filter | uri %]&amp;bookseller_filter=[% bookseller_filter | uri %]&amp;branch_filter=[% branch_filter | uri %]" id="reopensub"> <i class="fa fa-repeat"></i> Reopen</a>
145                                     </li>
146                                 [% END %]
147                             [% END # IF ( routing && CAN_user_serials_routing ) %]
148
149                             <li>
150                                 <a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% subscription.subscriptionid | uri %]"><i class="fa fa-list-alt"></i> Issue history</a>
151                             </li>
152
153                         </ul>
154                     [% ELSE %]
155                         <div class="btn-group">
156                             [% IF ( CAN_user_serials_receive_serials ) %]
157                                 [%# There should be no space between these two buttons, it would render badly %]
158                                 <a class="btn btn-default btn-xs" role="button"
159                                    href="/cgi-bin/koha/serials/serials-edit.pl?subscriptionid=[% subscription.subscriptionid | html %]&amp;serstatus=1,3,7"><i
160                                    class="fa fa-inbox"></i> Serial receive</a><a
161                                    class="btn btn-default btn-xs dropdown-toggle" id="subactions[% subscription.subscriptionid | html %]" role="button"
162                                    data-toggle="dropdown" href="#"><b class="caret"></b></a>
163                             [% ELSE %]
164                                 <a class="btn btn-default btn-xs dropdown-toggle" id="subactions[% subscription.subscriptionid | html %]" role="button" data-toggle="dropdown" href="#">Actions <b class="caret"></b></a>
165                             [% END %]
166                         <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="subactions[% subscription.subscriptionid | html %]">
167
168                             [% IF ( routing && CAN_user_serials_routing ) %]
169                                 [% IF ( subscription.cannotedit ) %]
170                                 [% ELSE %]
171                                     [% IF ( subscription.routingedit ) %]
172                                         <li>
173                                             <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid | uri %]"><i class="fa fa-pencil"></i> Edit routing list ([% subscription.routingedit | html %])</a>
174                                         </li>
175                                     [% ELSE %]
176                                         <li>
177                                             <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid | uri %]&amp;op=new"> <i class="fa fa-plus"></i> New routing list</a>
178                                         </li>
179                                     [% END %]
180                                 [% END %]
181                             [% END # IF ( routing && CAN_user_serials_routing ) %]
182
183                             <li>
184                                 <a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% subscription.subscriptionid | uri %]"><i class="fa fa-list-alt"></i> Issue history</a>
185                             </li>
186                         </ul>
187                         </div>
188                     [% END %]
189                 </div>
190             </td>
191
192           </tr>
193           [% END %]
194         [% END %]
195       </tbody>
196     </table>
197   </form>
198 [% END %]
199
200 <div class="main container-fluid">
201     <div class="row">
202         <div class="col-sm-10 col-sm-push-2">
203             <main>
204
205       [% INCLUDE 'serials-toolbar.inc' %]
206
207       [% IF ( done_searched ) %]
208         <h2>Serials subscriptions ([% total | html %] found)</h2>
209       [% ELSE %]
210         <h2>Serials subscriptions search</h2>
211       [% END %]
212
213       [% UNLESS ( done_searched ) %]
214       <div id="advsearch" style="padding-bottom:3em;">
215         <form action="/cgi-bin/koha/serials/serials-search.pl" method="get">
216           <fieldset class="rows">
217           <legend>Search subscriptions</legend>
218               <ol>
219                 <li>
220                   <label for="issn">ISSN:</label>
221                   <input type="text" id="issn" name="ISSN_filter" value="[% ISSN_filter | html %]" />
222                 </li>
223                 <li>
224                   <label for="title">Title:</label>
225                   <input type="text" id="title" name="title_filter" value="[% title_filter | html %]" />
226                 </li>
227                 [% IF ( marcflavour == "UNIMARC" ) %]
228                 <li>
229                   <label for="ean">EAN:</label>
230                   <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter | html %]" />
231                 </li>
232                 [% END %]
233                 <li>
234                   <label for="callnumber">Call number:</label>
235                   <input type="text" id="callnumber" name="callnumber_filter" value="[% callnumber_filter | html %]" />
236                 </li>
237                 <li>
238                   <label for="publisher">Publisher:</label>
239                   <input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter | html %]" />
240                 </li>
241                 <li>
242                   <label for="bookseller">Vendor:</label>
243                   <input type="text" id="bookseller" name="bookseller_filter" value="[% bookseller_filter | html %]" />
244                 </li>
245                 <li>
246                   <label for="branch">Library:</label>
247                   <select id="branch" name="branch_filter">
248                     <option value="">All</option>
249                     [%# FIXME Should not we filter the libraries? %]
250                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branch_filter, unfiltered => 1 ) %]
251                   </select>
252                 </li>
253                 <li>
254                   <label for="location">Location:</label>
255                   [% PROCESS 'av-build-dropbox.inc' name="location_filter", category="LOC", default=location_filter, all=1 %]
256                 </li>
257                 <li>
258                   <label for="to">Expires before:</label>
259                   <input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
260                 </li>
261                 [% INCLUDE 'additional-fields-entry.inc' available=additional_fields_for_subscription values=additional_field_filters wrap_fieldset=0 %]
262               </ol>
263               <input type="hidden" name="searched" value="1" />
264               [% IF ( mana ) %]<input type="hidden" name="mana" value="1" />[% END %]
265               <fieldset class="action">
266                 <input type="submit" value="Search" />
267               </fieldset>
268           </fieldset>
269         </form>
270       </div>
271       [% END %]
272       [% IF ( done_searched ) %]
273         [% IF ( total ) %]
274           <div id="serialstabs" class="toptabs" style="clear:both;">
275             <ul class="ui-tabs-nav">
276               [% IF mana %]
277                 <li><a href="#mana">Mana ([% total || 0 | html %])</a></li>
278               [% ELSE %]
279                 <li><a href="#opened">Open ([% openedsubscriptions.size || 0 | html %])</a></li>
280                 <li><a href="#closed">Closed ([% closedsubscriptions.size || 0 | html %])</a></li>
281               [% END %]
282             </ul>
283             [% IF mana %]
284                 <div id="mana">
285                     [% INCLUDE 'mana/mana-subscription-search-result.inc' %]
286                 </div>
287             [% ELSE %]
288             <div id="opened">
289               [% IF openedsubscriptions %]
290                   [% INCLUDE subscriptions_table subscriptions = openedsubscriptions %]
291               [% ELSE %]
292                 <div class="dialog message">
293                   <p>Your search returned no open subscriptions.</p>
294                 </div>
295               [% END %]
296             </div>
297             <div id="closed">
298               [% IF closedsubscriptions %]
299                 [% INCLUDE subscriptions_table subscriptions = closedsubscriptions closed = 1 %]
300               [% ELSE %]
301                 <div class="dialog message">
302                   <p>Your search returned no closed subscriptions.</p>
303                 </div>
304               [% END %]
305             </div>
306             [% END %]
307           </div>
308         [% ELSE %]
309             <div class="dialog message">
310               <p>Your search returned no results.</p>
311             </div>
312         [% END %]
313       [% END %]
314
315             </main>
316         </div> <!-- /.col-sm-10.col-sm-push-2 -->
317
318         <div class="col-sm-2 col-sm-pull-10">
319             <aside>
320
321     [% INCLUDE 'serials-menu.inc' %]
322     [% IF ( done_searched ) %]
323     [% UNLESS ( mana ) %]
324     <div id="advsearch">
325         <form action="/cgi-bin/koha/serials/serials-search.pl" method="get">
326           <fieldset class="brief">
327             <h4>Search subscriptions</h4>
328               <ol>
329                 <li>
330                   <label for="issn">ISSN:</label>
331                   <input type="text" id="issn" name="ISSN_filter" value="[% ISSN_filter | html %]" />
332                 </li>
333                 <li>
334                   <label for="title">Title:</label>
335                   <input type="text" id="title" name="title_filter" value="[% title_filter | html %]" />
336                 </li>
337                 [% IF ( marcflavour == "UNIMARC" ) %]
338                 <li>
339                   <label for="ean">EAN:</label>
340                   <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter | html %]" />
341                 </li>
342                 [% END %]
343                 <li>
344                   <label for="callnumber">Call number:</label>
345                   <input type="text" id="callnumber" name="callnumber_filter" value="[% callnumber_filter | html %]" />
346                 </li>
347                 <li>
348                   <label for="publisher">Publisher:</label>
349                   <input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter | html %]" />
350                 </li>
351                 <li>
352                   <label for="bookseller">Vendor:</label>
353                   <input type="text" id="bookseller" name="bookseller_filter" value="[% bookseller_filter | html %]" />
354                 </li>
355                 <li>
356                   <label for="branch">Library:</label>
357                   <select id="branch" name="branch_filter">
358                     <option value="">All</option>
359                     [%# FIXME Should not we filter the libraries? %]
360                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branch_filter, unfiltered => 1 ) %]
361                   </select>
362                 </li>
363                 <li>
364                   <label for="location">Location:</label>
365                   [% PROCESS 'av-build-dropbox.inc' name="location_filter", category="LOC", default=location_filter, all=1 %]
366                 </li>
367                 <li>
368                   <label for="to">Expires before:</label>
369                   <input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
370                 </li>
371
372                 [% FOR field IN additional_fields_for_subscription %]
373                   <li>
374                     <label for="additional_field_[% field.id | html %]ID"> [% field.name | html %]: </label>
375                     [% IF field.authorised_value_category %]
376                       <select id="additional_field_[% field.id | html %]" name="additional_field_[% field.id | html %]">
377                         <option value="">All</option>
378                         [% FOREACH av IN AuthorisedValues.GetAuthValueDropbox(field.authorised_value_category) %]
379                           [% IF av.authorised_value == additional_field_filters.${field.id} %]
380                             <option value="[% av.authorised_value | html %]" selected="selected">[% av.lib | html %]</option>
381                           [% ELSE %]
382                             <option value="[% av.authorised_value | html %]">[% av.lib | html %]</option>
383                           [% END %]
384                         [% END %]
385                       </select>
386                     [% ELSE %]
387                       <input id="additional_field_[% field.id | html %]" type="text" value="[% additional_field_filters.${field.id} | html %]" name="additional_field_[% field.id | html %]" />
388                     [% END %]
389                   </li>
390                 [% END %]
391               </ol>
392               <input type="hidden" name="searched" value="1" />
393               <fieldset class="action">
394                 <input type="submit" value="Search" />
395               </fieldset>
396
397             </div>
398           </fieldset>
399         </form>
400       [% END %]
401       [% END %]
402             </aside>
403         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
404      </div> <!-- /.row -->
405
406 [% MACRO jsinclude BLOCK %]
407     [% INCLUDE 'calendar.inc' %]
408     [% INCLUDE 'datatables.inc' %]
409     <script>
410         var subscriptionid = "[% subscriptionid | html %]";
411         var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
412         var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
413         var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
414     </script>
415     [% Asset.js("js/serials-toolbar.js") | $raw %]
416     <script>
417
418             function itemSelectionBuildEditLink(div) {
419                 var subscription_ids = new Array();
420                 $("input[name='subscriptionid'][type='checkbox']:checked", div).each(function() {
421                     subscription_ids.push($(this).val());
422                 });
423                 if (subscription_ids.length > 0) {
424                     var url = "[% edit_action_link | html %]";
425                     url += '&subscriptionid=' + subscription_ids.join('&subscriptionid=');
426                     $('a.itemselection_action_modify').attr('href', url);
427                 } else {
428                     return false;
429                 }
430                 return true;
431             }
432
433             function itemSelectionBuildActionLinks(tab) {
434                 var div = $("#" + tab);
435                 var modify_link_ok = itemSelectionBuildEditLink(div);
436                 if (modify_link_ok) {
437                     $('.itemselection_actions', div).show();
438                 } else {
439                     $('.itemselection_actions', div).hide();
440                 }
441             }
442
443         $(document).ready(function() {
444             var osrlt = $("#opened table").dataTable($.extend(true, {}, dataTablesDefaults, {
445                 "sPaginationType": "four_button",
446                 "order": [[ 2, "asc" ]],
447                 "aoColumnDefs": [
448                     { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
449                     { "sType": "title-string", "aTargets" : [ "title-string" ] },
450                     { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
451                 ]
452             }));
453
454             var csrlt = $("#closed table").dataTable($.extend(true, {}, dataTablesDefaults, {
455                 // FIXME sort function of additional_fields!
456                 "order": [[ 2, "asc" ]],
457                 "sPaginationType": "four_button",
458                 "aoColumnDefs": [
459                     { 'bSortable': false, 'aTargets': [ 'NoSort' ] },
460                     { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
461                 ]
462             }));
463
464             var manarlt = $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, {
465                 "sPaginationType": "four_button",
466                 "aoColumnDefs": [
467                     { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
468                     { "sType": "title-string", "aTargets" : [ "title-string" ] },
469                     { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
470                 ]
471             }));
472
473             osrlt.fnAddFilters("dt-filter", 750);
474             csrlt.fnAddFilters("dt-filter", 750);
475             manarlt.fnAddFilters("dt-filter", 750);
476
477             $('#serialstabs').tabs();
478             $("#reopensub").click(function(){
479                 return confirm(_("Are you sure you want to reopen this subscription?"));
480             });
481
482             $('.select-all, .clear-all').on('click', function(e) {
483                 e.preventDefault();
484                 var checkboxes = $(this).parents('form').find('input[type="checkbox"]');
485                 checkboxes.prop('checked', $(this).hasClass('select-all'));
486                 var tab = $(this).data("tab");
487                 itemSelectionBuildActionLinks(tab);
488             });
489
490             itemSelectionBuildActionLinks("opened");
491             itemSelectionBuildActionLinks("closed");
492             $("input[name='subscriptionid'][type='checkbox']").change(function() {
493                 var div = $(this).parents('form').parent().attr("id");
494                 itemSelectionBuildActionLinks(div);
495             });
496
497             [% IF ( mana ) %]
498                 $("label[for=callnumber], input#callnumber").hide();
499                 $("label[for=bookseller], input#bookseller").hide();
500                 $("label[for=branch], select#branch").hide();
501                 $("label[for=to], input#to").hide();
502                 $(".ui-datepicker-trigger").hide();
503                 $("label[for=location], select#location_filter").hide();
504                 [% FOR field IN additional_fields_for_subscription %]
505                       $("label[for=additional_field_[% field.id | $raw %]], input#additional_field_[% field.id | $raw %]").hide();
506                 [% END %]
507             [% END %]
508         });
509     </script>
510 [% END %]
511
512 [% INCLUDE 'intranet-bottom.inc' %]