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