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