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