Lines 524-530
Link Here
|
524 |
[% INCLUDE 'datatables.inc' %] |
524 |
[% INCLUDE 'datatables.inc' %] |
525 |
<script> |
525 |
<script> |
526 |
var active_tab = "#article-requests-requested_panel"; |
526 |
var active_tab = "#article-requests-requested_panel"; |
527 |
var last_cancel_reason, requested_datatable, pending_datatable, processing_datatable, active_datatable; |
527 |
var last_cancel_reason, requested_datatable, pending_datatable, processing_datatable, active_datatable, requested_dt, pending_dt, processing_dt; |
528 |
$(document).ready(function() { |
528 |
$(document).ready(function() { |
529 |
|
529 |
|
530 |
$("#article-request-tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { |
530 |
$("#article-request-tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { |
Lines 575-582
Link Here
|
575 |
}); |
575 |
}); |
576 |
|
576 |
|
577 |
requested_datatable = $("#article-requests-requested-table").kohaTable(); |
577 |
requested_datatable = $("#article-requests-requested-table").kohaTable(); |
|
|
578 |
requested_dt = requested_datatable.DataTable(); |
579 |
|
578 |
pending_datatable = $("#article-requests-pending-table").kohaTable(); |
580 |
pending_datatable = $("#article-requests-pending-table").kohaTable(); |
|
|
581 |
pending_dt = pending_datatable.DataTable(); |
582 |
|
579 |
processing_datatable = $("#article-requests-processing-table").kohaTable(); |
583 |
processing_datatable = $("#article-requests-processing-table").kohaTable(); |
|
|
584 |
processing_dt = processing_datatable.DataTable(); |
585 |
|
580 |
active_datatable = requested_datatable; |
586 |
active_datatable = requested_datatable; |
581 |
activateBatchActions( active_tab ); |
587 |
activateBatchActions( active_tab ); |
582 |
}); |
588 |
}); |
Lines 634-645
Link Here
|
634 |
|
640 |
|
635 |
|
641 |
|
636 |
a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide(); |
642 |
a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide(); |
637 |
|
|
|
638 |
$.ajax({ |
643 |
$.ajax({ |
639 |
type: "DELETE", |
644 |
type: "DELETE", |
640 |
url: '/api/v1/article_requests/'+id+query, |
645 |
url: '/api/v1/article_requests/'+id+query, |
641 |
success: function( data ) { |
646 |
success: function( data ) { |
642 |
active_datatable.row( a.closest('tr') ).remove().draw(); |
647 |
active_datatable.DataTable().row( table_row ).remove().draw(); |
643 |
UpdateTabCounts(); |
648 |
UpdateTabCounts(); |
644 |
activateBatchActions( active_tab ); |
649 |
activateBatchActions( active_tab ); |
645 |
} |
650 |
} |
Lines 674-680
Link Here
|
674 |
async function Process( id, a ) { |
679 |
async function Process( id, a ) { |
675 |
var table_row = a.closest('tr'); |
680 |
var table_row = a.closest('tr'); |
676 |
var table = a.closest('table'); |
681 |
var table = a.closest('table'); |
677 |
var orig_datatable = table.attr('id')==='article-requests-pending-table'?pending_datatable:requested_datatable; |
682 |
var orig_dt = table.attr('id')==='article-requests-pending-table'?pending_dt:requested_dt; |
678 |
|
683 |
|
679 |
a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide(); |
684 |
a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide(); |
680 |
|
685 |
|
Lines 684-691
Link Here
|
684 |
$("img.spinner").remove(); |
689 |
$("img.spinner").remove(); |
685 |
table_row.find('.ar-process-request').remove(); |
690 |
table_row.find('.ar-process-request').remove(); |
686 |
table_row.find('input[type="checkbox"]').prop('checked', false); |
691 |
table_row.find('input[type="checkbox"]').prop('checked', false); |
687 |
orig_datatable.row( table_row ).remove().draw(); |
692 |
orig_dt.row( table_row ).remove().draw(); |
688 |
processing_datatable.row.add( table_row ).draw(); |
693 |
processing_dt.row.add( table_row ).draw(); |
689 |
UpdateTabCounts(); |
694 |
UpdateTabCounts(); |
690 |
activateBatchActions( active_tab ); |
695 |
activateBatchActions( active_tab ); |
691 |
}, |
696 |
}, |
Lines 711-717
Link Here
|
711 |
await client.articleRequests.complete(id).then( |
716 |
await client.articleRequests.complete(id).then( |
712 |
success => { |
717 |
success => { |
713 |
$("img.spinner").remove(); |
718 |
$("img.spinner").remove(); |
714 |
active_datatable.row( a.closest('tr') ).remove().draw(); |
719 |
active_datatable.DataTable().row( a.closest('tr') ).remove().draw(); |
715 |
UpdateTabCounts(); |
720 |
UpdateTabCounts(); |
716 |
activateBatchActions( active_tab ); |
721 |
activateBatchActions( active_tab ); |
717 |
}, |
722 |
}, |
Lines 734-741
Link Here
|
734 |
await client.articleRequests.pending(id).then( |
739 |
await client.articleRequests.pending(id).then( |
735 |
success => { |
740 |
success => { |
736 |
$("img.spinner").remove(); |
741 |
$("img.spinner").remove(); |
737 |
requested_datatable.row( table_row ).remove().draw(); |
742 |
requested_dt.row( table_row ).remove().draw(); |
738 |
pending_datatable.row.add( table_row ).draw(); |
743 |
pending_dt.row.add( table_row ).draw(); |
739 |
UpdateTabCounts(); |
744 |
UpdateTabCounts(); |
740 |
activateBatchActions( active_tab ); |
745 |
activateBatchActions( active_tab ); |
741 |
}, |
746 |
}, |
Lines 750-758
Link Here
|
750 |
}); |
755 |
}); |
751 |
|
756 |
|
752 |
function UpdateTabCounts() { |
757 |
function UpdateTabCounts() { |
753 |
$("#ar_requested_count").html( requested_datatable.rows().count() ); |
758 |
$("#ar_requested_count").html( requested_dt.rows().count() ); |
754 |
$("#ar_pending_count").html( pending_datatable.rows().count() ); |
759 |
$("#ar_pending_count").html( pending_dt.rows().count() ); |
755 |
$("#ar_processing_count").html( processing_datatable.rows().count() ); |
760 |
$("#ar_processing_count").html( processing_dt.rows().count() ); |
756 |
} |
761 |
} |
757 |
|
762 |
|
758 |
function EditURLs(id) { |
763 |
function EditURLs(id) { |
759 |
- |
|
|