Bug 29007: Add cancellation reason input on check in
[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         [% WRAPPER breadcrumbs %]
22             [% IF ( done_searched ) %]
23                 [% WRAPPER breadcrumb_item %]
24                     <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a>
25                 [% END %]
26                 [% WRAPPER breadcrumb_item bc_active= 1 %]
27                     <span>Search results</span>
28                 [% END %]
29             [% ELSE %]
30                 [% WRAPPER breadcrumb_item bc_active= 1 %]
31                     <span>Serials</span>
32                 [% END %]
33             [% END %]
34         [% END #/ WRAPPER breadcrumbs %]
35     [% END #/ WRAPPER sub-header.inc %]
36
37     [% url_params = [] %]
38     [% FOREACH param IN CGI.params.pairs %]
39         [% escaped_value = BLOCK %][% param.value | uri %][% END %]
40         [% url_params.push(param.key _ '=' _ escaped_value) %]
41     [% END %]
42
43     [% SET referrer = '/cgi-bin/koha/serials/serials-search.pl?' %]
44     [% referrer = BLOCK %][% referrer | url %][% url_params.join("&amp;") |uri %][% END %]
45     [% SET edit_action_link = '/cgi-bin/koha/serials/subscription-batchedit.pl?referrer=' _ referrer %]
46
47     [% BLOCK subscriptions_table %]
48         <form method="post">
49             [% IF closed %]
50                 [% SET tab = 'closed' %]
51             [% ELSE %]
52                 [% SET tab = 'opened' %]
53             [% END %]
54             [% IF CAN_user_serials_edit_subscription %]
55                 <div class="actions">
56                     <a class="select-all" href="#" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</a>
57                     |
58                     <a class="clear-all" href="#" data-tab="[% tab | html %]"><i class="fa fa-times"></i> Clear all</a>
59                     <span class="itemselection_actions [% tab | html %]">
60                         | Actions:
61                         <a href="#" data-tab="[% tab | html %]" class="itemselection_action_modify"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit selected serials</a>
62                     </span>
63                 </div>
64             [% END %]
65             <table>
66                 <thead>
67                     <tr>
68                         <th class="NoSort noExport"></th>
69                         <th>ISSN</th>
70                         <th class="anti-the">Title</th>
71                         <th>Notes</th>
72                         <th>Library</th>
73                         <th>Location</th>
74                         <th>Call number</th>
75                         [% UNLESS closed %]
76                             <th>Expiration date</th>
77                         [% END %]
78                         [% FOR field IN additional_fields_for_subscription %]
79                             <th>[% field.name | html %]</th>
80                         [% END %]
81                         <th class="NoSort noExport">Actions</th>
82                     </tr>
83                 </thead>
84                 <tbody>
85                     [% FOREACH subscription IN subscriptions %]
86                         [% UNLESS subscription.cannotdisplay %]
87                             <tr>
88                                 <td>
89                                     [% UNLESS subscription.cannotedit %]
90                                         <input type="checkbox" name="subscriptionid" value="[% subscription.subscriptionid | html %]" class="[% tab | html %]" />
91                                     [% ELSE %]
92                                         <input type="checkbox" name="subscriptionid" value="[% subscription.subscriptionid | html %]" disabled="disabled" title="You cannot edit this subscription" />
93                                     [% END %]
94                                 </td>
95                                 <td>
96                                     [% IF ( subscription.issn ) %]
97                                         [% subscription.issn | html %]
98                                     [% END %]
99                                 </td>
100                                 <td>
101                                     <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscription.subscriptionid | uri %]" class="button" title="subscription detail">[% subscription.title | html %] [% subscription.subtitle | html %] [% subscription.part_number | html %] [%subscription.part_name | html %]</a>
102                                 </td>
103                                 <td>
104                                     [% IF ( subscription.publicnotes ) %][% subscription.publicnotes | html %][% END %]
105                                     [% IF ( subscription.internalnotes ) %]([% subscription.internalnotes | html %])[% END %]
106                                 </td>
107                                 <td>
108                                     [% IF ( subscription.branchcode ) %][% Branches.GetName( subscription.branchcode ) | html %][% END %]
109                                 </td>
110                                 <td>
111                                     [% IF ( subscription.location ) %]
112                                         [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => subscription.location ) | html %]
113                                     [% END %]
114                                 </td>
115                                 <td>
116                                     [% IF ( subscription.callnumber ) %][% subscription.callnumber | html %][% END %]
117                                 </td>
118                                 [% UNLESS closed %]
119                                     <td data-order="[% subscription.enddate | html %]">
120                                         [% subscription.enddate | $KohaDates %]
121                                     </td>
122                                 [% END %]
123
124                                 [% FOR field IN additional_fields_for_subscription %]
125                                     [% IF field.authorised_value_category %]
126                                         <td>[% AuthorisedValues.GetByCode( field.authorised_value_category, subscription.additional_fields.${field.name} ) | html %]</td>
127                                     [% ELSE %]
128                                         <td>[% subscription.additional_fields.${field.name} | html %]</td>
129                                     [% END %]
130                                 [% END %]
131
132                                 <td>
133                                     <div class="btn-group dropup">
134                                         [% IF closed %]
135                                             <a class="btn btn-default btn-xs dropdown-toggle" id="closedsubactions[% subscription.subscriptionid | html %]" role="button" data-toggle="dropdown" href="#">
136                                             Actions <b class="caret"></b>
137                                             </a>
138                                             <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="closedsubactions[% subscription.subscriptionid | html %]">
139
140                                                 [% IF ( routing && CAN_user_serials_routing ) %]
141                                                     [% UNLESS ( subscription.cannotedit ) %]
142                                                         <li>
143                                                             <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-solid fa-arrow-rotate-right"></i> Reopen</a>
144                                                         </li>
145                                                     [% END %]
146                                                 [% END # IF ( routing && CAN_user_serials_routing ) %]
147
148                                                 <li>
149                                                     <a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% subscription.subscriptionid | uri %]"><i class="fa-solid fa-rectangle-list"></i> Issue history</a>
150                                                 </li>
151
152                                             </ul>
153                                         [% ELSE %]
154                                             <div class="btn-group">
155                                                 [% IF ( CAN_user_serials_receive_serials ) %]
156                                                     [%# There should be no space between these two buttons, it would render badly %]
157                                                     <a class="btn btn-default btn-xs" role="button"
158                                                     href="/cgi-bin/koha/serials/serials-edit.pl?subscriptionid=[% subscription.subscriptionid | html %]&amp;serstatus=1,3,7"><i
159                                                     class="fa fa-inbox"></i> Serial receive</a><a
160                                                     class="btn btn-default btn-xs dropdown-toggle" id="subactions[% subscription.subscriptionid | html %]" role="button"
161                                                     data-toggle="dropdown" href="#"><b class="caret"></b></a>
162                                                 [% ELSE %]
163                                                     <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>
164                                                 [% END %]
165                                             <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="subactions[% subscription.subscriptionid | html %]">
166
167                                                 [% IF ( routing && CAN_user_serials_routing ) %]
168                                                     [% IF ( subscription.cannotedit ) %]
169                                                     [% ELSE %]
170                                                         [% IF ( subscription.routingedit ) %]
171                                                             <li>
172                                                                 <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit routing list ([% subscription.routingedit | html %])</a>
173                                                             </li>
174                                                         [% ELSE %]
175                                                             <li>
176                                                                 <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>
177                                                             </li>
178                                                         [% END %]
179                                                     [% END %]
180                                                 [% END # IF ( routing && CAN_user_serials_routing ) %]
181
182                                                 <li>
183                                                     <a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% subscription.subscriptionid | uri %]"><i class="fa-solid fa-rectangle-list"></i> Issue history</a>
184                                                 </li>
185                                             </ul>
186                                             </div>
187                                         [% END # IF closed %]
188                                     </div> <!-- /.btn-group -->
189                                 </td>
190
191                             </tr>
192                         [% END # /UNLESS subscription.cannotdisplay %]
193                     [% END  # /FOREACH subscription %]
194                 </tbody>
195                 <tfoot>
196                     <tr>
197                         <td></td>
198                         <td><input type="text" class="dt-filter" data-column_num="1" placeholder="Search ISSN" /></td>
199                         <td><input type="text" class="dt-filter" data-column_num="2" placeholder="Search title" /></td>
200                         <td><input type="text" class="dt-filter" data-column_num="3" placeholder="Search notes" /></td>
201                         <td><input type="text" class="dt-filter" data-column_num="4" placeholder="Search library" /></td>
202                         <td><input type="text" class="dt-filter" data-column_num="5" placeholder="Search location" /></td>
203                         <td><input type="text" class="dt-filter" data-column_num="6" placeholder="Search callnumber" /></td>
204                         [% SET column_num = 6 %]
205                         [% UNLESS closed %]
206                             <td><input type="text" class="dt-filter" data-column_num="7" placeholder="Search expiration date" /></td>
207                             [% SET column_num = column_num + 1 %]
208                         [% END %]
209                         [% FOR field IN additional_fields_for_subscription %]
210                             <td><input type="text" class="dt-filter" data-column_num="[% loop.count + column_num | html %]" placeholder="Search [% field.name | html %]" /></td>
211                         [% END %]
212                         <td></td>
213                     </tr>
214                 </tfoot>
215             </table>
216         </form>
217     [% END # /BLOCK subscriptions_table %]
218
219     <div class="main container-fluid">
220         <div class="row">
221             <div class="col-sm-10 col-sm-push-2">
222                 <main>
223
224                     [% INCLUDE 'serials-toolbar.inc' %]
225
226                     [% IF ( mana ) %]
227                         [% IF ( done_searched ) %]
228                             <h1>Mana subscriptions ([% total | html %] found)</h1>
229                         [% ELSE %]
230                             <h1>Mana subscriptions search</h1>
231                         [% END %]
232                     [% ELSE %]
233                         [% IF ( done_searched ) %]
234                             [% IF orig_total > total %]
235                                 <div class="dialog alert">
236                                     <p>The search originally produced [% orig_total | html %] results and was limited to [% total | html %].</p>
237                                 </div>
238                             [% END %]
239                             <h1>Serials subscriptions ([% total | html %] found)</h1>
240                         [% ELSE %]
241                             <h1>Serials subscriptions search</h1>
242                         [% END %]
243                     [% END %]
244
245                     [% UNLESS ( done_searched ) %]
246                         [% INCLUDE 'serials-advsearch.inc' %]
247                     [% END # /UNLESS ( done_searched )%]
248
249                     [% IF ( done_searched ) %]
250                         [% IF ( total ) %]
251
252                             [% WRAPPER tabs id= "serialstabs" %]
253                                 [% WRAPPER tabs_nav %]
254                                     [% IF mana %]
255                                         [% WRAPPER tab_item tabname= "mana" bt_active= 1 %] <span>Mana</span> ([% total || 0 | html %]) [% END %]
256                                     [% ELSE %]
257                                         [% WRAPPER tab_item tabname= "opened" bt_active= 1 %] <span>Open</span> ([% openedsubscriptions.size || 0 | html %]) [% END %]
258                                         [% WRAPPER tab_item tabname= "closed" %] <span>Closed</span> ([% closedsubscriptions.size || 0 | html %]) [% END %]
259                                     [% END %]
260                                 [% END # /WRAPPER tabs_nav %]
261                                 [% WRAPPER tab_panels %]
262                                     [% IF mana %]
263                                         [% WRAPPER tab_panel tabname="mana" bt_active= 1 %]
264                                             [% INCLUDE 'mana/mana-subscription-search-result.inc' %]
265                                         [% END # /WRAPPER tab_panel#mana %]
266                                     [% ELSE %]
267                                         [% WRAPPER tab_panel tabname="opened" bt_active= 1 %]
268                                             [% IF openedsubscriptions %]
269                                                 [% INCLUDE subscriptions_table subscriptions = openedsubscriptions %]
270                                             [% ELSE %]
271                                                 <div class="dialog message">
272                                                     <p>Your search returned no open subscriptions.</p>
273                                                 </div>
274                                             [% END %]
275                                         [% END # /WRAPPER tab_panel#opened %]
276                                         [% WRAPPER tab_panel tabname="closed" %]
277                                             [% IF closedsubscriptions %]
278                                                 [% INCLUDE subscriptions_table subscriptions = closedsubscriptions closed = 1 %]
279                                             [% ELSE %]
280                                                 <div class="dialog message">
281                                                     <p>Your search returned no closed subscriptions.</p>
282                                                 </div>
283                                             [% END %]
284                                         [% END # /WRAPPER tab_panel#closed %]
285                                     [% END # /IF mana %]
286                                 [% END # /WRAPPER tab_panels %]
287                             [% END # /WRAPPER tabs#serialstabs %]
288
289                         [% ELSE %]
290                             <div class="dialog message">
291                                 <p>Your search returned no results.</p>
292                             </div>
293                         [% END # IF ( total ) %]
294                     [% END # /IF done_searched %]
295
296                 </main>
297             </div> <!-- /.col-sm-10.col-sm-push-2 -->
298
299             <div class="col-sm-2 col-sm-pull-10">
300                 <aside>
301
302                     [% IF ( done_searched ) %]
303                         [% UNLESS ( mana ) %]
304                             [% INCLUDE 'serials-advsearch.inc' brief=1 %]
305                         [% END # / UNLESS ( mana ) %]
306                     [% END # / IF ( done_searched ) %]
307                     [% INCLUDE 'serials-menu.inc' %]
308                 </aside>
309             </div> <!-- /.col-sm-2.col-sm-pull-10 -->
310         </div> <!-- /.row -->
311
312 [% MACRO jsinclude BLOCK %]
313     [% INCLUDE 'calendar.inc' %]
314     [% INCLUDE 'datatables.inc' %]
315     <script>
316         var subscriptionid = "[% subscriptionid | html %]";
317     </script>
318     [% Asset.js("js/serials-toolbar.js") | $raw %]
319     <script>
320
321         function itemSelectionBuildEditLink( tab ) {
322             var subscription_ids = new Array();
323             $( "input:checkbox." + tab + ":checked" ).each(function() {
324                 subscription_ids.push( $(this).val() );
325             });
326
327             if (subscription_ids.length > 0) {
328                 var url = "[% edit_action_link | html %]";
329                 url += '&subscriptionid=' + subscription_ids.join('&subscriptionid=');
330                 location.href = url;
331             } else {
332                 return false;
333             }
334         }
335
336         function enableCheckboxActions( tab ){
337             // Enable/disable controls if checkboxes are checked
338             var checked_count = $("input:checkbox." + tab + ":checked").length;
339             if( checked_count > 0 ){
340                 $(".itemselection_actions." + tab ).show();
341             } else {
342                 $(".itemselection_actions." + tab ).hide();
343             }
344         }
345
346         $(document).ready(function() {
347             var osrlt = $("#opened_panel table").dataTable($.extend(true, {}, dataTablesDefaults, {
348                 "sPaginationType": "full",
349                 "order": [[ 2, "asc" ]],
350                 "aoColumnDefs": [
351                     { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
352                     { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
353                 ]
354             }));
355
356             var csrlt = $("#closed_panel table").dataTable($.extend(true, {}, dataTablesDefaults, {
357                 // FIXME sort function of additional_fields!
358                 "order": [[ 2, "asc" ]],
359                 "sPaginationType": "full",
360                 "aoColumnDefs": [
361                     { 'bSortable': false, 'aTargets': [ 'NoSort' ] },
362                     { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
363                 ]
364             }));
365
366             var manarlt = $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, {
367                 "sPaginationType": "full",
368                 "aoColumnDefs": [
369                     { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
370                     { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
371                 ]
372             }));
373
374             osrlt.fnAddFilters("dt-filter", 750);
375             csrlt.fnAddFilters("dt-filter", 750);
376             manarlt.fnAddFilters("dt-filter", 750);
377
378             $("#reopensub").click(function(){
379                 return confirm(_("Are you sure you want to reopen this subscription?"));
380             });
381
382             $('.select-all, .clear-all').on('click', function(e) {
383                 e.preventDefault();
384                 var tab = $(this).data("tab");
385                 var checkboxes = $("input:checkbox." + tab );
386                 checkboxes.prop('checked', $(this).hasClass('select-all')).change();
387                 enableCheckboxActions(tab);
388             });
389
390             enableCheckboxActions("opened");
391             enableCheckboxActions("closed");
392
393             $("input[name='subscriptionid'][type='checkbox']").change(function() {
394                 var tab = $(this).attr("class");
395                 enableCheckboxActions( tab );
396             });
397
398             $(".itemselection_action_modify").on("click", function(e){
399                 e.preventDefault();
400                 var tab = $(this).data("tab");
401                 itemSelectionBuildEditLink( tab );
402             });
403
404             [% IF ( mana ) %]
405                 $(".local").hide();
406                 [% FOR field IN additional_fields_for_subscription %]
407                       $("label[for=additional_field_[% field.id | $raw %]], input#additional_field_[% field.id | $raw %]").hide();
408                 [% END %]
409             [% END %]
410         });
411     </script>
412 [% END %]
413
414 [% INCLUDE 'intranet-bottom.inc' %]