5 [% USE AuthorisedValues %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Article requests › Circulation › Koha</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 <style>p { margin-top: 0; } [id^="article-menu-"] { display: none; } [id^="article-menu-"]:before { content: "|"; } .starthidden { display:none; }</style>
16 <div id="[% menuid | html %]" class="btn-group dropup">
18 <a class="btn btn-default btn-xs dropdown-toggle ar-actions" role="button" data-toggle="dropdown" href="#">
19 Actions <b class="caret"></b>
22 <ul class="dropdown-menu [% pull_right | html %]" role="menu" aria-labelledby="[% aria_menu | html %]">
24 <a class="ar-set-pending-request" href="#" onclick="HandleMulti( SetPending, [% id_arg | html %], $(this) ); return false;">
25 <i class="fa fa-bars"></i>
26 Set request as pending
29 <a class="ar-process-request" href="#" onclick="HandleMulti( Process, [% id_arg | html %], $(this) ); return false;">
30 <i class="fa fa-cog"></i>
34 [% IF id_arg && format=='SCAN' %]
35 <a class="ar-edit-urls" href="#" onclick="HandleMulti( EditURLs, [% id_arg | html %], $(this) ); return false;">
36 <i class="fa fa-edit"></i>
41 <a class="ar-complete-request" href="#" onclick="HandleMulti( Complete, [% id_arg | html %], $(this) ); return false;">
42 <i class="fa fa-check-circle"></i>
46 <a class="ar-cancel-request" href="#" onclick="Cancel( [% id_arg | html %], $(this) ); return false;">
47 <i class="fa fa-minus-circle"></i>
52 <a class="ar-print-request" href="#" onclick="HandleMulti( PrintSlip, [% id_arg | html %], $(this) ); return false;">
53 <i class="fa fa-print"></i>
57 <a class="ar-print-request" href="#" onclick="PrintMultipleSlip(); return false;">
58 <i class="fa fa-print"></i>
68 [% BLOCK item_status %]
69 [% IF myitem.onloan %]<span>Checked out</span>
70 [% ELSIF myitem.holds({ found => ['W', 'T'] }).count > 0 %]<span>On hold</span>
71 [% ELSIF myitem.notforloan > 0 OR myitem.itemtype.notforloan %]<span>Not for loan</span>
72 [% ELSIF myitem.notforloan < 0 %]<span>On order</span>
75 [% BLOCK urls_modal %]
76 <div id="myModal" class="modal fade modal-lg" role="dialog">
77 <div class="modal-dialog">
78 <div class="modal-content">
79 <div class="modal-header">
80 <h4 class="modal-title">Edit URL(s)</h4>
82 <div class="modal-body">
83 <textarea id="urls" style="width:100%;"></textarea>
85 <div class="modal-footer">
86 <button type="button" class="btn btn-default" data-dismiss="modal">Save</button>
92 [% BLOCK cancel_modal %]
93 <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
94 <div class="modal-dialog" role="document">
95 <div class="modal-content">
96 <div class="modal-header">
97 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
98 <h3>Confirm deletion</h3>
101 <div class="modal-body">
102 <p>Are you sure you want to cancel this article request?</p>
104 <fieldset class="action">
105 [% SET ar_cancellation = AuthorisedValues.GetAuthValueDropbox('AR_CANCELLATION') %]
106 [% IF ar_cancellation.count %]
107 <label for="cancellation-reason" class="col-sm-4">Cancellation reason: </label>
108 <select class="cancellation-reason col-sm-8" name="cancellation-reason" id="modal-cancellation-reason">
109 <option value="" selected>Other reasons</option>
110 [% FOREACH reason IN ar_cancellation %]
111 <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
116 <fieldset class="action">
117 <div class="hint col-sm-offset-4">Enter reason</div>
118 <input type="text" class="notes col-sm-offset-4 col-sm-8" name="notes" id="modal-notes"/>
122 <div class="modal-footer">
123 <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger" data-dismiss="modal">Confirm cancellation</button>
124 <a href="#" data-dismiss="modal">Cancel</a>
131 <body id="circ_article-requests" class="circ">
132 [% WRAPPER 'header.inc' %]
133 [% INCLUDE 'cat-search.inc' %]
137 [% WRAPPER 'sub-header.inc' %]
138 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
141 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
144 <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
147 <a href="#" aria-current="page">Article requests</a>
153 <div class="main container-fluid starthidden">
156 [% IF Koha.Preference('CircSidebar') %]
157 <div class="col-sm-10 col-sm-push-2">
159 <div class="col-md-12 col-lg-10 col-lg-offset-1">
162 <h1>Article requests</h1>
163 [% PROCESS urls_modal %]
165 <form id="ar-branchcode-form" method="post">
166 <select name="branchcode" id="branchcode">
167 <option value="">All libraries</option>
168 [% FOREACH b IN Branches.all( only_from_group => 1 ) %]
169 [% IF b.branchcode == branchcode %]
170 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
172 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
176 <button type="submit" class="btn btn-default btn-xs">
177 <i class="fa fa-refresh"></i> Update
181 <div id="article-request-tabs" class="toptabs">
182 <ul class="nav nav-tabs" role="tablist">
183 <li role="presentation" class="active">
184 <a href="#article-requests-requested" aria-controls="article-requests-requested" role="tab" data-toggle="tab">
185 New (<span id="ar_requested_count">[% article_requests_requested.count | html %]</span>)
189 <li role="presentation">
190 <a href="#article-requests-pending" aria-controls="article-requests-pending" role="tab" data-toggle="tab">
191 Pending (<span id="ar_pending_count">[% article_requests_pending.count | html %]</span>)
193 </li role="presentation">
196 <a href="#article-requests-processing" aria-controls="article-requests-processing" role="tab" data-toggle="tab">
197 Processing (<span id="ar_processing_count">[% article_requests_processing.count | html %]</span>)
201 <div class="tab-content">
202 <div id="article-requests-requested" role="tabpanel" class="tab-pane active">
203 <div class="article-requests-requested_table_controls">
204 <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
205 [% PROCESS actions menuid='article-menu-requested' id_arg=0 pull_right='' aria_menu='table_controls' %]
208 <table id="article-requests-requested-table">
212 <th class="ar-title">Title</th>
213 <th class="ar-request">Requested article</th>
214 <th class="ar-collection">Collection</th>
215 <th class="ar-itemtype">Item type</th>
216 <th class="ar-callnumber">Call number</th>
217 <th class="ar-status">Status</th>
218 <th class="ar-copynumber">Copy number</th>
219 <th class="ar-enumchron">Enumeration</th>
220 <th class="ar-barcode">Barcode</th>
221 <th class="ar-format">Format</th>
222 <th class="ar-urls">URLs</th>
223 <th class="ar-patron">Patron</th>
224 <th class="ar-date">Date</th>
225 <th class="ar-actions noExport">Actions</th>
230 [% FOREACH ar IN article_requests_requested %]
231 <tr class="ar-row ar-requested">
232 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
233 <td class="ar-title">
235 <a class="title" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber | uri %]">
236 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
241 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
242 <div class="ar-author">[% ar.biblio.author | html %]</div>
243 <div class="ar-pubdata">
244 [% ar.biblio.biblioitem.publishercode | html %]
246 [% IF ar.biblio.biblioitem.publicationyear %]
247 [% ar.biblio.biblioitem.publicationyear | html %]
248 [% ELSIF ar.biblio.copyrightdate %]
249 [% ar.biblio.copyrightdate | html %]
252 [% IF ar.biblio.biblioitem.pages %]
253 : [% ar.biblio.biblioitem.pages | html %]
256 [% r.biblio.biblioitem.size | html %]
258 [% IF ar.biblio.biblioitem.isbn %]
259 <span>ISBN: [% ar.biblio.biblioitem.isbn | html %]</span>
264 <td class="ar-request">
265 [% IF ar.toc_request %] <p><strong>Include TOC</strong> </p> [% END %]
266 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
267 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
268 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
269 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
270 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
271 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
272 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
273 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
275 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
276 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
277 <td class="ar-callnumber">
278 [% IF ar.item.location %]
279 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
282 [% ar.item.itemcallnumber | html %]
284 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
285 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
286 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
287 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
288 <td class="ar-format">[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
289 <td class="ar-urls">[% IF ar.format == 'SCAN' %]<span id="url_yesno_[% ar.id | html %]">[% IF ar.urls %]Yes[% ELSE %]No[% END%]</span><span id="url_[% ar.id | html %]" style="display:none;">[% ar.urls | url %]</span>[% END %]</td>
290 <td class="ar-patron">
292 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
293 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
297 <p>[% ar.borrower.phone | html %]</p>
299 <td class="ar-date"><span title="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</span></td>
300 <td class="ar-actions">
301 [% PROCESS actions menuid = "row" _ ar.id id_arg=ar.id format=ar.format pull_right='pull-right' aria_menu='ar-actions' %]
309 <div id="article-requests-pending" role="tabpanel" class="tab-pane">
310 <div class="article-requests-pending_table_controls">
311 <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
312 [% PROCESS actions menuid='article-menu-pending' id_arg=0 pull_right='' aria_menu='table_controls' %]
315 <table id="article-requests-pending-table">
319 <th class="ar-title">Title</th>
320 <th class="ar-request">Requested article</th>
321 <th class="ar-collection">Collection</th>
322 <th class="ar-itemtype">Item type</th>
323 <th class="ar-callnumber">Call number</th>
324 <th class="ar-status">Status</th>
325 <th class="ar-copynumber">Copy number</th>
326 <th class="ar-enumchron">Enumeration</th>
327 <th class="ar-barcode">Barcode</th>
328 <th class="ar-format">Format</th>
329 <th class="ar-urls">URLs</th>
330 <th class="ar-patron">Patron</th>
331 <th class="ar-date">Date</th>
332 <th class="ar-actions noExport">Actions</th>
337 [% FOREACH ar IN article_requests_pending %]
338 <tr class="ar-row ar-pending">
339 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
340 <td class="ar-title">
342 <a class="title" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber | uri %]">
343 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
348 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
349 <div class="ar-author">[% ar.biblio.author | html %]</div>
350 <div class="ar-pubdata">
351 [% ar.biblio.biblioitem.publishercode | html %]
353 [% IF ar.biblio.biblioitem.publicationyear %]
354 [% ar.biblio.biblioitem.publicationyear | html %]
355 [% ELSIF ar.biblio.copyrightdate %]
356 [% ar.biblio.copyrightdate | html %]
359 [% IF ar.biblio.biblioitem.pages %]
360 : [% ar.biblio.biblioitem.pages | html %]
363 [% r.biblio.biblioitem.size | html %]
365 [% IF ar.biblio.biblioitem.isbn %]
366 <span>ISBN: [% ar.biblio.biblioitem.isbn | html %]</span>
371 <td class="ar-request">
372 [% IF ar.toc_request %] <p><strong>Include TOC</strong> </p> [% END %]
373 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
374 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
375 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
376 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
377 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
378 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
379 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
380 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
382 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
383 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
384 <td class="ar-callnumber">
385 [% IF ar.item.location %]
386 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
389 [% ar.item.itemcallnumber | html %]
391 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
392 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
393 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
394 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
395 <td class="ar-format">[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
396 <td class="ar-urls">[% IF ar.format == 'SCAN' %]<span id="url_yesno_[% ar.id | html %]">[% IF ar.urls %]Yes[% ELSE %]No[% END%]</span><span id="url_[% ar.id | html %]" style="display:none;">[% ar.urls | url %]</span>[% END %]</td>
397 <td class="ar-patron">
399 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
400 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
404 <p>[% ar.borrower.phone | html %]</p>
406 <td class="ar-date" data-order="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</td>
407 <td class="ar-actions">
408 [% PROCESS actions menuid = "row" _ ar.id id_arg=ar.id format=ar.format pull_right='pull-right' aria_menu='ar-actions' %]
416 <div id="article-requests-processing" role="tabpanel" class="tab-pane">
417 <div class="article-requests-processing_table_controls">
418 <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
419 [% PROCESS actions menuid='article-menu-processing' id_arg=0 pull_right='' aria_menu='table_controls' %]
421 <table id="article-requests-processing-table">
425 <th class="ar-title">Title</th>
426 <th class="ar-request">Requested article</th>
427 <th class="ar-collection">Collection</th>
428 <th class="ar-itemtype">Item type</th>
429 <th class="ar-callnumber">Call number</th>
430 <th class="ar-status">Status</th>
431 <th class="ar-copynumber">Copy number</th>
432 <th class="ar-enumchron">Enumeration</th>
433 <th class="ar-barcode">Barcode</th>
434 <th class="ar-format">Format</th>
435 <th class="ar-urls">URLs</th>
436 <th class="ar-patron">Patron</th>
437 <th class="ar-date">Date</th>
438 <th class="ar-actions noExport">Actions</th>
443 [% FOREACH ar IN article_requests_processing %]
444 <tr class="ar-row ar-processing">
445 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
446 <td class="ar-title">
448 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio link = 1%]
452 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
453 <div class="ar-author">[% ar.biblio.author | html %]</div>
454 <div class="ar-pubdata">
455 [% ar.biblio.biblioitem.publishercode | html %]
457 [% IF ar.biblio.biblioitem.publicationyear %]
458 [% ar.biblio.biblioitem.publicationyear | html %]
459 [% ELSIF ar.biblio.copyrightdate %]
460 [% ar.biblio.copyrightdate | html %]
463 [% IF ar.biblio.biblioitem.pages %]
464 : [% ar.biblio.biblioitem.pages | html %]
467 [% r.biblio.biblioitem.size | html %]
469 [% IF ar.biblio.biblioitem.isbn %]
470 <span>ISBN: [% ar.biblio.biblioitem.isbn | html %]</span>
475 <td class="ar-request">
476 [% IF ar.toc_request %] <p><strong>Include TOC</strong> </p> [% END %]
477 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
478 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
479 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
480 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
481 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
482 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
483 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
484 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
486 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
487 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
488 <td class="ar-callnumber">
489 [% IF ar.item.location %]
490 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
493 [% ar.item.itemcallnumber | html %]
495 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
496 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
497 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
498 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
499 <td class="ar-format">[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
500 <td class="ar-urls">[% IF ar.format == 'SCAN' %]<span id="url_yesno_[% ar.id | html %]">[% IF ar.urls %]Yes[% ELSE %]No[% END%]</span><span id="url_[% ar.id | html %]" style="display:none;">[% ar.urls | url %]</span>[% END %]</td>
501 <td class="ar-patron">
503 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
504 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
508 <p>[% ar.borrower.phone | html %]</p>
510 <td class="ar-date" data-order="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</td>
511 <td class="ar-actions">
512 [% PROCESS actions menuid="table_" _ ar.id id_arg=ar.id format=ar.format pull_right='pull-right' aria_menu='ar-actions' %]
519 </div> <!-- /.tab-content -->
524 [% IF Koha.Preference('CircSidebar') %]
525 <div class="col-sm-2 col-sm-pull-10">
527 [% INCLUDE 'circ-nav.inc' %]
533 [% PROCESS cancel_modal %]
535 [% MACRO jsinclude BLOCK %]
536 [% INCLUDE 'datatables.inc' %]
538 var active_tab = "#article-requests-requested";
539 var last_cancel_reason, requested_datatable, pending_datatable, processing_datatable, active_datatable;
540 $(document).ready(function() {
542 $("#article-request-tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) {
543 active_tab = e.target.hash;
544 if( active_tab == "#article-requests-requested" ){
545 active_datatable = requested_datatable;
546 } else if( active_tab == "#article-requests-pending" ){
547 active_datatable = pending_datatable;
549 active_datatable = processing_datatable;
551 activateBatchActions( active_tab );
554 $( "input:checkbox, #article-request-tabs" ).on("change", function(){
555 activateBatchActions( active_tab );
558 $(".SelectAll").on("click", function(e) {
560 $( active_tab + " input[type='checkbox']").prop('checked', true);
561 activateBatchActions( active_tab );
563 $(".ClearAll").on("click", function(e) {
565 $( active_tab + " input[type='checkbox']").prop('checked', false);
566 activateBatchActions( active_tab );
568 $("a.ar-actions").on('click', function(e) {
569 // Hide menu option ?
570 if( $('#article-requests-requested-table:visible,#article-requests-pending-table:visible').length )
571 $('a.ar-process-request').show();
572 else $('a.ar-process-request').hide();
574 if( $('#article-requests-requested-table').is(":visible") )
575 $('a.ar-set-pending-request').show();
576 else $('a.ar-set-pending-request').hide();
579 $('#myModal').on("shown.bs.modal", function () {
580 $('#myModal textarea').focus();
582 $('#myModal').on("hidden.bs.modal", function () {
583 // Set focus back to dropdown
584 var id = $('#myModal textarea').attr('ar_id');
585 var link = $('span#url_'+ id).parent().parent().find('td.ar-actions').find('div.dropdown a');
586 if( link.length > 0 ) link[0].focus();
588 $( '#myModal button' ).on("click", function () {
589 SaveURLs( $('#myModal textarea').val() );
592 requested_datatable = $("#article-requests-requested-table").DataTable($.extend(true, {}, dataTablesDefaults, {
594 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
598 pending_datatable = $("#article-requests-pending-table").DataTable($.extend(true, {}, dataTablesDefaults, {
600 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
603 processing_datatable = $("#article-requests-processing-table").DataTable($.extend(true, {}, dataTablesDefaults, {
605 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
608 active_datatable = requested_datatable;
609 activateBatchActions( active_tab );
610 $(".starthidden").show();
613 function activateBatchActions( active_tab ){
614 // Check to see whether batch menu should be shown based on state of checkboxes
615 if ( $( "input:checkbox", active_tab ).length > 0 ) {
616 // There are rows with checkboxes
617 $( "[class$='_table_controls']", active_tab ).show();
618 if ( $( "input:checkbox:checked", active_tab ).length > 0 ) {
619 $( "[id^='article-menu-']", active_tab ).css("display","inline-block");
621 $( "[id^='article-menu-']", active_tab ).hide();
624 // All rows have been removed
625 $("[class$='_table_controls']", active_tab ).hide();
629 function HandleMulti( fnHandler, id, a ) {
630 last_cancel_reason = undefined;
631 if( id !== 0 ) { fnHandler( id, a ); return; }
632 $( active_tab + " input[type='checkbox']:checked").each(function() {
633 fnHandler( $(this).attr('reqid'), $(this).closest('tr').find('td.ar-actions div a') );
637 function PrintSlip(id, a) {
638 var link = 'article-request-slip.pl?id='+id;
639 window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
642 $('#modal-cancellation-reason').on('change', function(e) {
643 let reason = $(this).val();
644 $('#modal-notes').attr('disabled', !!reason);
647 // Confirm cancellation of article requests
650 $("#cancelModalConfirmBtn").on("click",function(e) {
651 let reason = $("#modal-cancellation-reason").val();
652 let notes = $("#modal-notes").val();
653 let query = '?'+(reason?'cancellation_reason='+reason:'notes='+notes)
655 HandleMulti(function(id, a) {
656 var table_row = a.closest('tr');
657 table_row.find('.ar-process-request').remove();
658 table_row.find('input[type="checkbox"]').prop('checked', false);
661 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide();
665 url: '/api/v1/article_requests/'+id+query,
666 success: function( data ) {
667 active_datatable.row( a.closest('tr') ).remove().draw();
669 activateBatchActions( active_tab );
672 }, cancel_id, cancel_a)
675 function PrintMultipleSlip() {
677 $( active_tab + " input[type='checkbox']:checked").each(function() {
678 ids.push($(this).attr('reqid'));
680 var link = 'article-request-slip.pl?multi=1&id='+ids.join(',');
681 window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
685 function Cancel( id, a ) {
689 $('#cancelModal').modal();
692 function SetPending( id, a ) {
693 var table_row = a.closest('tr');
694 table_row.find('.ar-set-pending-request').remove();
695 table_row.find('input[type="checkbox"]').prop('checked', false);
696 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide();
699 url: '/cgi-bin/koha/svc/article_request',
704 success: function( data ) {
705 $("img.spinner").remove();
706 requested_datatable.row( table_row ).remove().draw();
707 pending_datatable.row.add( table_row ).draw();
709 activateBatchActions( active_tab );
715 function Process( id, a ) {
716 var table_row = a.closest('tr');
717 var table = a.closest('table');
718 var orig_datatable = table.attr('id')==='article-requests-pending-table'?pending_datatable:requested_datatable;
719 table_row.find('.ar-process-request').remove();
720 table_row.find('input[type="checkbox"]').prop('checked', false);
722 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide();
725 url: '/cgi-bin/koha/svc/article_request',
730 success: function( data ) {
731 $("img.spinner").remove();
732 orig_datatable.row( table_row ).remove().draw();
733 processing_datatable.row.add( table_row ).draw();
735 activateBatchActions( active_tab );
741 function Complete( id, a ) {
742 // if it is a scan, check if urls field is filled
743 var urlspan = $('span#url_'+id);
744 if( urlspan.length>0 && urlspan.text() === '' ) {
745 alert( _("Please fill URL before completing request.") );
748 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide();
751 url: '/cgi-bin/koha/svc/article_request',
756 success: function( data ) {
757 active_datatable.row( a.closest('tr') ).remove().draw();
759 activateBatchActions( active_tab );
765 function UpdateTabCounts() {
766 $("#ar_requested_count").html( requested_datatable.rows().count() );
767 $("#ar_pending_count").html( pending_datatable.rows().count() );
768 $("#ar_processing_count").html( processing_datatable.rows().count() );
771 function EditURLs(id) {
772 var urls = $('span#url_'+ id).text();
773 $('#myModal textarea').val(urls);
774 $('#myModal textarea').attr('ar_id', id);
775 $('#myModal').modal('show');
778 function SaveURLs(newurl) {
779 var id = $('#myModal textarea').attr('ar_id');
780 $('span#url_'+ id).text(newurl);
782 $('span#url_yesno_'+id).text(_("Yes"));
784 $('span#url_yesno_'+id).text(_("No"));
788 url: '/cgi-bin/koha/svc/article_request',
789 data: { action: 'update_urls', id: id, urls: newurl },
791 error: function() { alert('Error: Saving URL failed!'); },
792 success: function(data) { if(!data.success) alert('Saving URL failed!'); },
798 [% INCLUDE 'intranet-bottom.inc' %]