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