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