Bug 16962: Remove the use of "onclick" from serial collection template
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / serials-collection.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AuthorisedValues %]
4 [% USE Branches %]
5 [% USE KohaDates %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Serials &rsaquo; Serial collection information for [% bibliotitle | html %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="ser_serials-collection" class="ser">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'serials-search.inc' %]
15
16 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Serial collection information for  <i>[% bibliotitle | html %]</i></div>
17
18 <div class="main container-fluid">
19     <div class="row">
20         <div class="col-sm-10 col-sm-push-2">
21             <main>
22
23     [% INCLUDE 'modals/serials_multi_receiving.inc' %]
24
25 [% UNLESS ( popup ) %]
26         [% INCLUDE 'serials-toolbar.inc' %]
27
28         <h1>Serial collection information for  <i>[% bibliotitle | html %]</i>
29         [% IF location %] ([% AuthorisedValues.GetByCode( 'LOC', location ) | html %]) [% END %]
30                 [% IF ( callnumber ) %]callnumber: [% callnumber | html %][% END %]</h1>
31 [% END %]
32
33 [% IF ( delete ) %]
34     <div class="dialog alert">
35         <h3>You are about to delete [% serialnumber | html %] serial(s). Do you want to continue?</h3>
36         <form action="/cgi-bin/koha/serials/serials-collection.pl/#">
37             [% IF countitems > 0 %]
38                 <h5>Number of items available: [% countitems | html %]</h5>
39                 <p>
40                   <label>Delete associated items? <input type="checkbox" name="delitems" value="Yes" />Yes</label>
41                 </p>
42             [% END %]
43             <input type="hidden" name="op" value="delete_confirmed" />
44             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
45             <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
46             [% FOREACH serialid IN serialsid %]
47                 <input type="hidden" name="serialid" value="[% serialid | html %]" />
48             [% END %]
49             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
50         </form>
51         <form action="/cgi-bin/koha/serials/serials-collection.pl">
52             <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
53             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
54         </form>
55     </div>
56 [% END %]
57
58 [% IF ( error_delitem ) %]
59     <div class="dialog alert">
60         <p><strong>Error</strong>: one or more associated items could not be deleted at this time.</p>
61     </div>
62 [% END %]
63
64 [% IF ( subscriptions ) %]
65 <table>
66 [% IF ( subscriptions.size == 1 ) %]
67 <caption> Subscription summary</caption>
68 [% ELSE %]
69 <caption> Subscription summaries</caption>
70 [% END %]
71 <tr>
72   <th>Subscription num.</th>
73   <th>Frequency</th>
74   <th>Numbering pattern</th>
75   <th>Library</th>
76   <th>Call number</th>
77   <th>Notes</th>
78   <th>&nbsp;</th>
79 </tr>
80 [% FOREACH subscription IN subscriptions %]
81     <tr>
82         <td><a href="subscription-detail.pl?subscriptionid=[% subscription.subscriptionid | uri %]"># [% subscription.subscriptionid | html %]</a> </td>
83         <td>[% subscription.frequency.description | html %]</td>
84         <td>[% subscription.numberpattern.label | html %]</td>
85         <td>[% IF subscription.branchcode %][% Branches.GetName( subscription.branchcode ) | html %][% END %]</td>
86         <td> [% subscription.callnumber | html %]</td>
87         <td> [% subscription.notes | html | html_line_break %]
88             [% UNLESS subscription.closed %]
89                 [% IF ( subscription.subscriptionexpired ) %]
90                     <br /><span class="problem"> Subscription expired</span>
91                 [% END %]
92             [% ELSE %]
93                 <br /> Subscription closed
94             [% END %]
95         </td>
96         [% IF ( subscription.abouttoexpire ) || ( subscription.subscriptionexpired ) %]<td class="problem actions">[% ELSE %]<td class="actions">[% END %]
97         [% UNLESS subscription.closed %]
98             [% IF ( routing && CAN_user_serials_routing ) %]
99                 [% IF ( subscription.hasRouting ) %]
100                     <a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid | html %]"><i class="fa fa-pencil"></i> Edit routing list</a>
101                 [% ELSE %]
102                     <a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid | html %]&amp;op=new"><i class="fa fa-plus"></i> Create routing list</a>
103                 [% END %]
104             [% END %]
105             [% IF ( subscription.abouttoexpire || subscription.subscriptionexpired) %]
106                 <a class="btn btn-default btn-xs subscription_renew" data-subscriptionid="[% subscription.subscriptionid | html %]" href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscription.subscriptionid | html %]"><i class="fa fa-refresh"></i> Renew</a>
107             [% END %]
108         [% ELSE %]
109             &nbsp;
110         [% END %]
111         </td>
112       </tr>
113 [% END %]
114 [% IF ( subscr ) %]
115 [% IF ( subscriptioncount > 1 ) %]
116 <tr ><td colspan="8">  <a href="serials-collection.pl?biblionumber=[% biblionumber | uri %]">See any subscription attached to this biblio</a></td>
117 </tr>
118 [% END %]
119 [% END %]
120 </table>
121 [% END %]
122
123
124 [% IF ( years ) %]<form name="edition" action="serials-edit.pl" method="post">
125 <div id="subscription_years" class="toptabs numbered">
126 <ul>
127         [% FOREACH year IN years %]
128         [% IF ( year.year ) %]
129             [% IF year.year == 'manage' %]
130                 <li><a href="#subscription-year-manage">Manage</a></li>
131             [% ELSE %]
132                 <li><a href="#subscription-year-[% year.year | uri %]">[% year.year | html %]</a></li>
133             [% END %]
134         [% END %]
135     [% END %]
136 </ul>
137
138  [% FOREACH year IN years %]
139 <div id="subscription-year-[% year.year | html %]">
140     [% IF ( CAN_user_serials_receive_serials ) %]
141         <p>
142             <div class="btn-group"><input type="submit" value="Edit serials" class="btn btn-default btn-sm" /></div>
143             [% UNLESS subscription.closed %]
144                 <div class="btn-group">
145                     <input type="button" value="Generate next" data-subscriptionid="[% subscriptionidlist | html %]" class="btn btn-default btn-sm generatenext" />
146                 </div>
147                 [% IF ( subscriptions.size == 1 and !serialsadditems ) %]&nbsp;
148                     <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
149                 [% END %]
150             [% END %]
151             <input type="button" value="Delete selected issues" class="delete-issues btn btn-default btn-sm" data-subscriptionids="[% subscriptionidlist | html %]" />
152         </p>
153     [% END %]
154       <span class="checkall">
155         <a class="CheckAll" href="#" data-year="[% year.year | html %]">Select all</a>
156       </span> |
157       <span class="clearall">
158         <a class="CheckNone" href="#" data-year="[% year.year | html %]">Clear all</a>
159       </span>
160         <table class="subscription-year-table">
161           <thead>
162             <tr>
163                 [% IF ( CAN_user_serials_receive_serials ) %]<th>Edit</th>[% END %]
164 [% IF ( subscriptions.size > 1 ) %]
165                 <th># Subs</th>
166 [% END %]
167                 <th class="title-string">Date published
168                 </th>
169                 <th class="title-string">Date published (text)
170                 </th>
171                 <th class="title-string">Date received
172                 </th>
173                 <th>Number
174                 </th>
175                 <th>Status
176                 </th>
177                 <th>Notes
178                 </th>
179                 <th>Library
180                 </th>
181                 [% IF ( routing ) %]<th>Routing</th>[% END %]
182             </tr>
183           </thead>
184           <tbody>
185       [% FOREACH serial IN year.serials %]
186         <tr>
187             [% IF ( CAN_user_serials_receive_serials ) %]
188                 <td>
189                   [% UNLESS CAN_user_serials_receive_serials %]
190                     disabled
191                   [% ELSE %]
192                     [% IF ( serial.subscriptionexpired ) %]
193                     <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled="disabled" />
194                     [% ELSE %]
195                       [% IF ( delete ) %]
196                         [% IF serialsid.grep("${serial.serialid}").size %]
197                           <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" disabled checked />
198                         [% ELSE %]
199                           <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" disabled />
200                         [% END %]
201                       [% ELSE %]
202                     <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" />
203                       [% END %]
204                     [% END %]
205                   [% END %]
206                 </td>
207             [% END %]
208 [% IF ( subscriptions.size > 1 ) %]
209                  <td><a href="serials-collection.pl?subscriptionid=[% serial.subscriptionid | uri %]">[% serial.subscriptionid | html %]</a></td>
210 [% END %]
211                 <td>
212                     <span title="[% serial.publisheddate | html %]">
213                       [% IF serial.publisheddate %]
214                         [% serial.publisheddate | $KohaDates %]
215                       [% ELSE %]
216                         Unknown
217                       [% END %]
218                     </span>
219                 </td>
220                 <td>
221                    [% IF serial.publisheddatetext %]
222                       <span title="[% serial.publisheddatetext | html %]">
223                         [% serial.publisheddatetext | html %]
224                       </span>
225                    [% END %]
226                 </td>
227                 <td>
228                     <span title="[% serial.planneddate | html %]">
229                       [% IF serial.planneddate %]
230                         [% serial.planneddate | $KohaDates %]
231                       [% ELSE %]
232                         Unknown
233                       [% END %]
234                     </span>
235                 </td>
236                 <td>
237                     [% IF ( matches = serial.serialseq.match('(.*)Spring(.*)') ) %]
238                         [% matches.0 | html %]Spring[% matches.1 | html %]
239                     [% ELSIF ( matches = serial.serialseq.match('(.*)Summer(.*)') ) %]
240                         [% matches.0 | html %]Summer[% matches.1 | html %]
241                     [% ELSIF ( matches = serial.serialseq.match('(.*)Fall(.*)') ) %]
242                         [% matches.0 | html %]Fall[% matches.1 | html %]
243                     [% ELSIF ( matches = serial.serialseq.match('(.*)Winter(.*)') ) %]
244                         [% matches.0 | html %]Winter[% matches.1 | html %]
245                     [% ELSIF ( matches = prediction.number.match('(.*)Spr(.*)') ) %]
246                         [% matches.0 | html %]Spr[% matches.1 | html %]
247                     [% ELSIF ( matches = prediction.number.match('(.*)Sum(.*)') ) %]
248                         [% matches.0 | html %]Sum[% matches.1 | html %]
249                     [% ELSIF ( matches = prediction.number.match('(.*)Fal(.*)') ) %]
250                         [% matches.0 | html %]Fal[% matches.1 | html %]
251                     [% ELSIF ( matches = prediction.number.match('(.*)Win(.*)') ) %]
252                         [% matches.0 | html %]Win[% matches.1 | html %]
253                     [% ELSE %]
254                         [% serial.serialseq | html %]
255                     [% END %]
256                 </td>
257                 <td>
258                     [% IF ( serial.status1 ) %]Expected[% END %]
259                     [% IF ( serial.status2 ) %]Arrived[% END %]
260                     [% IF ( serial.status3 ) %]Late[% END %]
261                     [% IF ( serial.status4 ) %]Missing[% END %]
262                     [% IF ( serial.status41 ) %]Missing (never received)[% END %]
263                     [% IF ( serial.status42 ) %]Missing (sold out)[% END %]
264                     [% IF ( serial.status43 ) %]Missing (damaged)[% END %]
265                     [% IF ( serial.status44 ) %]Missing (lost)[% END %]
266                     [% IF ( serial.status5 ) %]Not issued[% END %]
267                     [% IF ( serial.status6 ) %]Delete[% END %]
268                     [% IF ( serial.status7 ) %]Claimed[% END %]
269                     [% IF ( serial.status8 ) %]Stopped[% END %]
270                 </td>
271                 <td>
272                     [% serial.notes | html %]
273                 </td>
274                 <td>
275                     [% Branches.GetName( serial.branchcode ) | html %]
276                 </td>
277                 [% IF ( routing ) %]
278                 <td class="actions">
279                     <a href="/cgi-bin/koha/serials/routing-preview.pl?ok=1&amp;subscriptionid=[% serial.subscriptionid | uri %]&amp;issue=[% serial.serialseq.replace("'", "\\'") | uri %]%20([% serial.publisheddate | $KohaDates %])" class="btn btn-default btn-xs print_list"><i class="fa fa-print"></i> Print list</a>
280                 </td>
281                 [% END %]
282             </tr>
283           [% END %]
284         </tbody>
285       </table>
286     </div>
287     [% END %]
288   <input type="hidden" name="subscriptionid" value="[% subscriptionidlist | html %]" />
289
290 </div>
291 </form>
292 [% END %]
293
294             </main>
295         </div> <!-- /.col-sm-10.col-sm-push-2 -->
296
297         <div class="col-sm-2 col-sm-pull-10">
298             <aside>
299                 [% INCLUDE 'serials-menu.inc' %]
300             </aside>
301         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
302      </div> <!-- /.row -->
303
304 [% MACRO jsinclude BLOCK %]
305     [% INCLUDE 'datatables.inc' %]
306     <script>
307         var subscriptionid = "[% subscriptionid | html %]";
308         var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
309         var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
310         var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
311     </script>
312     [% Asset.js("js/serials-toolbar.js") | $raw %]
313     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
314
315     <script>
316
317         function deleteIssues(subscriptionid) {
318             var serialschecked = $("form[name='edition'] input[name='serialid']:checked");
319             if (serialschecked.length > 0) {
320                 var location = 'serials-collection.pl?subscriptionid='+subscriptionid+'&op=delete_confirm';
321                 for (i=0; i < serialschecked.length; i++) {
322                     location += '&serialid=' + serialschecked[i].value;
323                 }
324                 document.location = location;
325             } else {
326                 alert(_("No serials selected"));
327             }
328         }
329
330         function generateNext(subscriptionid) {
331             if(confirm(_("Do you really want to generate next serial?"))){
332                 document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid;
333             }
334         }
335
336         $(document).ready(function() {
337             $('#subscription_years').tabs();
338             $(".subscription-year-table").dataTable($.extend(true, {}, dataTablesDefaults, {
339                 "aoColumnDefs": [
340                     { "aTargets": [ 0,-1 ], "bSortable": false, "bSearchable": false },
341                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
342                 ],
343                 "aaSorting": [[0, 'desc']],
344                 "sDom": 't',
345                 "bAutoWidth": false,
346                 "bPaginate": false,
347                 "bInfo": false,
348                 "bFilter": false,
349             } ));
350
351             $(".CheckAll").on("click", function(e){
352                 e.preventDefault();
353                 var years = $(this).data("year");
354                 $("#subscription-year-" + years ).checkCheckboxes();
355             });
356
357             $(".CheckNone").on("click", function(e){
358                 e.preventDefault();
359                 var years = $(this).data("year");
360                 $("#subscription-year-" + years ).unCheckCheckboxes();
361             });
362
363             $(".generatenext").on("click", function(e){
364                 e.preventDefault();
365                 var subscriptionid = $(this).data("subscriptionid");
366                 generateNext( subscriptionid );
367             });
368
369             $(".subscription_renew").on("click", function(e){
370                 e.preventDefault();
371                 var subscriptionid = $(this).data("subscriptionid");
372                 popup( subscriptionid );
373             });
374
375             $(".print_list").on("click", function(e){
376                 e.preventDefault();
377                 var url = $(this).attr("href");
378                 window.open( url,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
379             });
380
381             $('#multi_receiving').on('show', function () {
382                $(this).find(".modal-body").html($(".serials_multi_receiving")[0].outerHTML);
383             });
384
385             $("form[name='edition']").on('submit', function(e){
386                 if ( $(this).find("input[name='serialid']:checked").size() == 0 ) {
387                     e.preventDefault();
388                     alert(_("You must select at least one serial to edit"));
389                     return 0;
390                 }
391                 return 1;
392             });
393
394             $(".delete-issues").on("click", function(e){
395                 e.preventDefault();
396                 deleteIssues("[% subscriptionidlist | html %]");
397             });
398         });
399
400     </script>
401 [% END %]
402
403 [% INCLUDE 'intranet-bottom.inc' %]