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