Bug 19700: Move template JavaScript to the footer: Some circulation pages
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / article-requests.tt
1 [% USE KohaDates %]
2 [% USE ItemTypes %]
3 [% USE Branches %]
4 [% USE AuthorisedValues %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Circulation &rsaquo; Article requests</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 <style type="text/css"> p { margin-top: 0; }</style>
10 </head>
11
12 <body id="circ_article-requests" class="circ">
13     [% INCLUDE 'header.inc' %]
14     [% INCLUDE 'cat-search.inc' %]
15
16     <div id="breadcrumbs">
17         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
18         &rsaquo;
19         <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
20         &rsaquo;
21         <a href="/cgi-bin/koha/circ/article-requests.pl">Article requests</a>
22     </div>
23
24 <div id="doc" class="yui-t7">
25     <div id="bd">
26         <div id="yui-main">
27             <div class="yui-g">
28
29                 <h1>Article requests</h1>
30
31                 <form id="ar-branchcode-form" method="post">
32                     <select name="branchcode" id="branchcode">
33                         <option value="">All libraries</option>
34                         [% FOREACH b IN Branches.all %]
35                             [% IF b.branchcode == branchcode %]
36                                 <option value="[% b.branchcode %]" selected="selected">[% b.branchname %]</option>
37                             [% ELSE %]
38                                 <option value="[% b.branchcode %]">[% b.branchname %]</option>
39                             [% END %]
40                         [% END %]
41                     </select>
42                     <button type="submit" class="btn btn-default btn-sm" type="submit">
43                         <i class="fa fa-refresh"></i> Update
44                     </button>
45                 </form>
46
47                 <div id="article-request-tabs" class="toptabs">
48                     <ul>
49                         <li>
50                             <a href="#article-requests-pending">
51                                 Pending (<span id="ar_pending_count">[% article_requests_pending.count %]</span>)
52                             </a>
53                         </li>
54
55                         <li>
56                             <a href="#article-requests-processing">
57                                 Processing (<span id="ar_processing_count">[% article_requests_processing.count %]</span>)
58                             </a>
59                         </li>
60                     </ul>
61
62                     <div id="article-requests-pending">
63                         <table id="article-requests-pending-table">
64                             <thead>
65                                 <tr>
66                                     <th class="ar-title">Title</th>
67                                     <th class="ar-request">Requested article</th>
68                                     <th class="ar-collection">Collection</th>
69                                     <th class="ar-itemtype">Item type</th>
70                                     <th class="ar-callnumber">Call number</th>
71                                     <th class="ar-copynumber">Copy number</th>
72                                     <th class="ar-enumchron">Enumeration</th>
73                                     <th class="ar-barcode">Barcode</th>
74                                     <th class="ar-patron">Patron</th>
75                                     <th class="ar-date">Date</th>
76                                     <th class="ar-actions">Actions</th>
77                                 </tr>
78                             </thead>
79
80                              <tbody>
81                                 <tr class="ar-pending-none">
82                                     <td colspan="11">
83                                         There are no pending article requests at this time.
84                                     </td>
85                                 </tr>
86
87                                 [% FOREACH ar IN article_requests_pending %]
88                                     <tr class="ar-row ar-pending">
89                                         <td class="ar-title">
90                                             <p>
91                                                 <a href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber %]">
92                                                     <strong>[% ar.biblio.title | html %]</strong>
93                                                     [% FOREACH s IN itemsloo.subtitle %] [% s %][% END %]
94                                                 </a>
95                                             </p>
96
97                                             <p>
98                                                 <div class="ar-biblionumber content_hidden">[% ar.biblionumber %]</div>
99                                                 <div class="ar-author">[% ar.biblio.author %]</div>
100                                                 <div class="ar-pubdata">
101                                                     [% ar.biblio.biblioitem.publishercode %]
102
103                                                     [% IF ar.biblio.biblioitem.publicationyear %]
104                                                         [% ar.biblio.biblioitem.publicationyear %]
105                                                     [% ELSIF ar.biblio.copyrightdate %]
106                                                         [% ar.biblio.copyrightdate %]
107                                                     [% END %]
108
109                                                     [% IF ar.biblio.biblioitem.pages %]
110                                                         : [% ar.biblio.biblioitem.pages %]
111                                                     [% END %]
112
113                                                     [%  r.biblio.biblioitem.size %]
114
115                                                     [% IF ar.biblio.biblioitem.isbn %]
116                                                         ISBN: [% ar.biblio.biblioitem.isbn %]
117                                                     [% END %]
118                                                 </div>
119                                             </p>
120                                         </td>
121                                         <td class="ar-request">
122                                             [% IF ar.title %]        <p><strong>Title:</strong>        [% ar.title %]        </p> [% END %]
123                                             [% IF ar.author %]       <p><strong>Author:</strong>       [% ar.author %]       </p> [% END %]
124                                             [% IF ar.volume %]       <p><strong>Volume:</strong>       [% ar.volume %]       </p> [% END %]
125                                             [% IF ar.issue %]        <p><strong>Issue:</strong>        [% ar.issue %]        </p> [% END %]
126                                             [% IF ar.date %]         <p><strong>Date:</strong>         [% ar.date %]         </p> [% END %]
127                                             [% IF ar.pages %]        <p><strong>Pages:</strong>        [% ar.pages %]        </p> [% END %]
128                                             [% IF ar.chapters %]     <p><strong>Chapters:</strong>     [% ar.chapters %]     </p> [% END %]
129                                             [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes %] </p> [% END %]
130                                         </td>
131                                         <td class="ar-collection">[% AuthorisedValues.GetByCode( 'CCODE', ar.item.ccode ) %]</td>
132                                         <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) %]</td>
133                                         <td class="ar-callnumber">
134                                             [% IF ar.item.location %]
135                                                 <em>[% AuthorisedValues.GetByCode( 'LOC', ar.item.location ) %]</em>
136                                             [% END %]
137
138                                             [% ar.item.itemcallnumber %]
139                                         </td>
140                                         <td class="ar-copynumber">[% ar.item.copynumber %]</td>
141                                         <td class="ar-enumchron">[% ar.item.enumchron %]</td>
142                                         <td class="ar-barcode">[% ar.item.barcode %]</td>
143                                         <td class="ar-patron">
144                                             <p>
145                                                 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber %]">
146                                                     [% ar.borrower.surname %][% IF ar.borrower.firstname %], [% ar.borrower.firstname %][% END %] ([% ar.borrower.cardnumber %])
147                                                 </a>
148                                             </p>
149
150                                             <p>[% ar.borrower.phone %]</p>
151                                         </td>
152                                         <td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td>
153                                         <td class="ar-actions">
154                                             <div class="dropdown">
155                                                 <a class="btn btn-default btn-xs dropdown-toggle" id="ar-actions" role="button" data-toggle="dropdown" href="#">
156                                                     Actions <b class="caret"></b>
157                                                 </a>
158
159                                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="ar-actions">
160                                                     <li>
161                                                         <a class="ar-process-request" href="#" onclick="Process( [% ar.id %], $(this) ); return false;">
162                                                             <i class="fa fa-cog"></i>
163                                                             Process request
164                                                         </a>
165
166                                                         <a class="ar-complete-request" href="#" onclick="Complete( [% ar.id %], $(this) ); return false;">
167                                                             <i class="fa fa-check-circle"></i>
168                                                             Complete request
169                                                         </a>
170
171                                                         <a class="ar-cancel-request" href="#" onclick="Cancel( [% ar.id %], $(this) ); return false;">
172                                                             <i class="fa fa-minus-circle"></i>
173                                                             Cancel request
174                                                         </a>
175
176                                                         <a class="ar-print-request" href="#" onclick="PrintSlip('article-request-slip.pl?id=[% ar.id %]'); return false;">
177                                                             <i class="fa fa-print"></i>
178                                                             Print slip
179                                                         </a>
180                                                     </li>
181                                                 </ul>
182                                             </div>
183                                         </td>
184                                     </tr>
185                                 [% END %]
186                             </tbody>
187                         </table>
188                     </div>
189
190                     <div id="article-requests-processing">
191                         <table id="article-requests-processing-table">
192                             <thead>
193                                 <tr>
194                                     <th class="ar-title">Title</th>
195                                     <th class="ar-request">Requested article</th>
196                                     <th class="ar-collection">Collection</th>
197                                     <th class="ar-itemtype">Item type</th>
198                                     <th class="ar-callnumber">Call number</th>
199                                     <th class="ar-copynumber">Copy number</th>
200                                     <th class="ar-enumchron">Enumeration</th>
201                                     <th class="ar-barcode">Barcode</th>
202                                     <th class="ar-patron">Patron</th>
203                                     <th class="ar-date">Date</th>
204                                     <th class="ar-actions">Actions</th>
205                                 </tr>
206                             </thead>
207
208                              <tbody>
209                                 <tr class="ar-processing-none">
210                                     <td colspan="11">
211                                         There are no article requests in processing at this time.
212                                     </td>
213                                 </tr>
214
215                                 [% FOREACH ar IN article_requests_processing %]
216                                     <tr class="ar-row ar-processing">
217                                         <td class="ar-title">
218                                             <p>
219                                                 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% ar.biblionumber %]">
220                                                     <strong>[% ar.biblio.title | html %]</strong>
221                                                     [% FOREACH s IN itemsloo.subtitle %] [% s %][% END %]
222                                                 </a>
223                                             </p>
224
225                                             <p>
226                                                 <div class="ar-biblionumber content_hidden">[% ar.biblionumber %]</div>
227                                                 <div class="ar-author">[% ar.biblio.author %]</div>
228                                                 <div class="ar-pubdata">
229                                                     [% ar.biblio.biblioitem.publishercode %]
230
231                                                     [% IF ar.biblio.biblioitem.publicationyear %]
232                                                         [% ar.biblio.biblioitem.publicationyear %]
233                                                     [% ELSIF ar.biblio.copyrightdate %]
234                                                         [% ar.biblio.copyrightdate %]
235                                                     [% END %]
236
237                                                     [% IF ar.biblio.biblioitem.pages %]
238                                                         : [% ar.biblio.biblioitem.pages %]
239                                                     [% END %]
240
241                                                     [%  r.biblio.biblioitem.size %]
242
243                                                     [% IF ar.biblio.biblioitem.isbn %]
244                                                         ISBN: [% ar.biblio.biblioitem.isbn %]
245                                                     [% END %]
246                                                 </div>
247                                             </p>
248                                         </td>
249                                         <td class="ar-request">
250                                             [% IF ar.title %]        <p><strong>Title:</strong>        [% ar.title %]        </p> [% END %]
251                                             [% IF ar.author %]       <p><strong>Author:</strong>       [% ar.author %]       </p> [% END %]
252                                             [% IF ar.volume %]       <p><strong>Volume:</strong>       [% ar.volume %]       </p> [% END %]
253                                             [% IF ar.issue %]        <p><strong>Issue:</strong>        [% ar.issue %]        </p> [% END %]
254                                             [% IF ar.date %]         <p><strong>Date:</strong>         [% ar.date %]         </p> [% END %]
255                                             [% IF ar.pages %]        <p><strong>Pages:</strong>        [% ar.pages %]        </p> [% END %]
256                                             [% IF ar.chapters %]     <p><strong>Chapters:</strong>     [% ar.chapters %]     </p> [% END %]
257                                             [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes %] </p> [% END %]
258                                         </td>
259                                         <td class="ar-collection">[% AuthorisedValues.GetByCode( 'CCODE', ar.item.ccode ) %]</td>
260                                         <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) %]</td>
261                                         <td class="ar-callnumber">
262                                             [% IF ar.item.location %]
263                                                 <em>[% AuthorisedValues.GetByCode( 'LOC', ar.item.location ) %]</em>
264                                             [% END %]
265
266                                             [% ar.item.itemcallnumber %]
267                                         </td>
268                                         <td class="ar-copynumber">[% ar.item.copynumber %]</td>
269                                         <td class="ar-enumchron">[% ar.item.enumchron %]</td>
270                                         <td class="ar-barcode">[% ar.item.barcode %]</td>
271                                         <td class="ar-patron">
272                                             <p>
273                                                 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber %]">
274                                                     [% ar.borrower.surname %][% IF ar.borrower.firstname %], [% ar.borrower.firstname %][% END %] ([% ar.borrower.cardnumber %])
275                                                 </a>
276                                             </p>
277
278                                             <p>[% ar.borrower.phone %]</p>
279                                         </td>
280                                         <td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td>
281                                         <td class="ar-actions">
282                                             <div class="dropdown">
283                                                 <a class="btn btn-default btn-xs dropdown-toggle" id="ar-actions" role="button" data-toggle="dropdown" href="#">
284                                                     Actions <b class="caret"></b>
285                                                 </a>
286
287                                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="ar-actions">
288                                                     <li>
289                                                         <a href="#" onclick="Complete( [% ar.id %], $(this) ); return false;">
290                                                             <i class="icon-ok-circle"></i>
291                                                             Complete request
292                                                         </a>
293
294                                                         <a href="#" onclick="Cancel( [% ar.id %], $(this) ); return false;">
295                                                             <i class="icon-remove-circle"></i>
296                                                             Cancel request
297                                                         </a>
298
299                                                         <a href="#" onclick="PrintSlip('article-request-slip.pl?id=[% ar.id %]'); return false;">
300                                                             <i class="icon-print"></i>
301                                                             Print slip
302                                                         </a>
303                                                     </li>
304                                                 </ul>
305                                             </div>
306                                         </td>
307                                     </tr>
308                                 [% END %]
309                             </tbody>
310                         </table>
311                     </div>
312                 </div>
313             </div>
314         </div>
315     </div>
316
317 [% MACRO jsinclude BLOCK %]
318     <script type="text/javascript">
319         $(document).ready(function() {
320             $('#article-request-tabs').tabs();
321
322             [% IF article_requests_pending.count %]
323                 $(".ar-pending-none").hide();
324             [% END %]
325
326             [% IF article_requests_processing.count %]
327                 $(".ar-processing-none").hide();
328             [% END %]
329         });
330
331         function PrintSlip(link) {
332             window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
333         }
334
335         function Cancel( id, a ) {
336             notes = prompt(_("Reason for cancellation:"));
337             if ( notes == null ) {
338                 return;
339             }
340
341             a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/spinner-small.gif"/>');
342             a.closest('div').hide();
343             $.ajax({
344                 type: "POST",
345                 url: '/cgi-bin/koha/svc/article_request',
346                 data: {
347                     action: 'cancel',
348                     id: id,
349                     notes: notes
350                 },
351                 success: function( data ) {
352                     a.closest('tr').remove();
353                     UpdateTabCounts()
354                 },
355                 dataType: 'json'
356             });
357         }
358
359         function Process( id, a ) {
360             var table_row = a.closest('tr').clone();
361             table_row.find('.ar-process-request').remove();
362
363             a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/spinner-small.gif"/>');
364             a.closest('div').hide();
365             $.ajax({
366                 type: "POST",
367                 url: '/cgi-bin/koha/svc/article_request',
368                 data: {
369                     action: 'process',
370                     id: id,
371                 },
372                 success: function( data ) {
373                     a.closest('tr').remove();
374                     $("#article-requests-processing-table").append( table_row );
375                     $("#article-requests-processing-table .ar-processing-none").hide();
376                     UpdateTabCounts()
377                 },
378                 dataType: 'json'
379             });
380         }
381
382         function Complete( id, a ) {
383             a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/spinner-small.gif"/>');
384             a.closest('div').hide();
385             $.ajax({
386                 type: "POST",
387                 url: '/cgi-bin/koha/svc/article_request',
388                 data: {
389                     action: 'complete',
390                     id: id,
391                 },
392                 success: function( data ) {
393                     a.closest('tr').remove();
394                     UpdateTabCounts()
395                 },
396                 dataType: 'json'
397             });
398         }
399
400         function UpdateTabCounts() {
401             var pending_count = $('#article-requests-pending-table tbody tr.ar-row').length;
402             $("#ar_pending_count").html( pending_count );
403             if ( pending_count == 0 ) $(".ar-pending-none").show();
404
405             var processing_count = $('#article-requests-processing-table tbody tr.ar-row').length;
406             $("#ar_processing_count").html( processing_count );
407             if ( processing_count == 0 ) $(".ar-processing-none").show();
408         }
409     </script>
410 [% END %]
411
412 [% INCLUDE 'intranet-bottom.inc' %]