|
Lines 531-587
Link Here
|
| 531 |
const interface = "[% interface | html %]"; |
531 |
const interface = "[% interface | html %]"; |
| 532 |
const theme = "[% theme | html %]"; |
532 |
const theme = "[% theme | html %]"; |
| 533 |
</script> |
533 |
</script> |
| 534 |
|
|
|
| 535 |
<script> |
534 |
<script> |
| 536 |
var active_tab = "#article-requests-requested_panel"; |
535 |
var active_tab = "#article-requests-requested_panel"; |
| 537 |
var last_cancel_reason, requested_datatable, pending_datatable, processing_datatable, active_datatable, requested_dt, pending_dt, processing_dt; |
536 |
var last_cancel_reason, requested_datatable, pending_datatable, processing_datatable, active_datatable, requested_dt, pending_dt, processing_dt; |
| 538 |
$(document).ready(function() { |
537 |
$(document).ready(function () { |
| 539 |
|
|
|
| 540 |
$("#article-request-tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { |
538 |
$("#article-request-tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { |
| 541 |
active_tab = e.target.hash; |
539 |
active_tab = e.target.hash; |
| 542 |
if( active_tab == "#article-requests-requested_panel" ){ |
540 |
if (active_tab == "#article-requests-requested_panel") { |
| 543 |
active_datatable = requested_datatable; |
541 |
active_datatable = requested_datatable; |
| 544 |
} else if( active_tab == "#article-requests-pending_panel" ){ |
542 |
} else if (active_tab == "#article-requests-pending_panel") { |
| 545 |
active_datatable = pending_datatable; |
543 |
active_datatable = pending_datatable; |
| 546 |
} else { |
544 |
} else { |
| 547 |
active_datatable = processing_datatable; |
545 |
active_datatable = processing_datatable; |
| 548 |
} |
546 |
} |
| 549 |
activateBatchActions( active_tab ); |
547 |
activateBatchActions(active_tab); |
| 550 |
}); |
548 |
}); |
| 551 |
|
549 |
|
| 552 |
$( "input:checkbox, #article-request-tabs" ).on("change", function(){ |
550 |
$("input:checkbox, #article-request-tabs").on("change", function () { |
| 553 |
activateBatchActions( active_tab ); |
551 |
activateBatchActions(active_tab); |
| 554 |
}); |
552 |
}); |
| 555 |
|
553 |
|
| 556 |
$(".SelectAll").on("click", function(e) { |
554 |
$(".SelectAll").on("click", function (e) { |
| 557 |
e.preventDefault(); |
555 |
e.preventDefault(); |
| 558 |
$( active_tab + " input[type='checkbox']").prop('checked', true); |
556 |
$(active_tab + " input[type='checkbox']").prop("checked", true); |
| 559 |
activateBatchActions( active_tab ); |
557 |
activateBatchActions(active_tab); |
| 560 |
}); |
558 |
}); |
| 561 |
$(".ClearAll").on("click", function(e) { |
559 |
$(".ClearAll").on("click", function (e) { |
| 562 |
e.preventDefault(); |
560 |
e.preventDefault(); |
| 563 |
$( active_tab + " input[type='checkbox']").prop('checked', false); |
561 |
$(active_tab + " input[type='checkbox']").prop("checked", false); |
| 564 |
activateBatchActions( active_tab ); |
562 |
activateBatchActions(active_tab); |
| 565 |
}); |
563 |
}); |
| 566 |
$("a.ar-actions").on('click', function(e) { |
564 |
$("a.ar-actions").on("click", function (e) { |
| 567 |
// Hide menu option ? |
565 |
// Hide menu option ? |
| 568 |
if( $('#article-requests-requested-table:visible,#article-requests-pending-table:visible').length ) |
566 |
if ($("#article-requests-requested-table:visible,#article-requests-pending-table:visible").length) $("a.ar-process-request").show(); |
| 569 |
$('a.ar-process-request').show(); |
567 |
else $("a.ar-process-request").hide(); |
| 570 |
else $('a.ar-process-request').hide(); |
|
|
| 571 |
|
568 |
|
| 572 |
if( $('#article-requests-requested-table').is(":visible") ) |
569 |
if ($("#article-requests-requested-table").is(":visible")) $("a.ar-set-pending-request").show(); |
| 573 |
$('a.ar-set-pending-request').show(); |
570 |
else $("a.ar-set-pending-request").hide(); |
| 574 |
else $('a.ar-set-pending-request').hide(); |
|
|
| 575 |
}); |
571 |
}); |
| 576 |
|
572 |
|
| 577 |
$('#myModal').on("shown.bs.modal", function () { |
573 |
$("#myModal").on("shown.bs.modal", function () { |
| 578 |
$('#myModal textarea').focus(); |
574 |
$("#myModal textarea").focus(); |
| 579 |
}); |
575 |
}); |
| 580 |
$('#myModal').on("hidden.bs.modal", function () { |
576 |
$("#myModal").on("hidden.bs.modal", function () { |
| 581 |
// Set focus back to dropdown |
577 |
// Set focus back to dropdown |
| 582 |
var id = $('#myModal textarea').attr('ar_id'); |
578 |
var id = $("#myModal textarea").attr("ar_id"); |
| 583 |
var link = $('span#url_'+ id).parent().parent().find('td.ar-actions').find('div.dropdown a'); |
579 |
var link = $("span#url_" + id) |
| 584 |
if( link.length > 0 ) link[0].focus(); |
580 |
.parent() |
|
|
581 |
.parent() |
| 582 |
.find("td.ar-actions") |
| 583 |
.find("div.dropdown a"); |
| 584 |
if (link.length > 0) link[0].focus(); |
| 585 |
}); |
585 |
}); |
| 586 |
|
586 |
|
| 587 |
requested_datatable = $("#article-requests-requested-table").kohaTable({}, requested_table_settings); |
587 |
requested_datatable = $("#article-requests-requested-table").kohaTable({}, requested_table_settings); |
|
Lines 594-805
Link Here
|
| 594 |
processing_dt = processing_datatable.DataTable(); |
594 |
processing_dt = processing_datatable.DataTable(); |
| 595 |
|
595 |
|
| 596 |
active_datatable = requested_datatable; |
596 |
active_datatable = requested_datatable; |
| 597 |
activateBatchActions( active_tab ); |
597 |
activateBatchActions(active_tab); |
| 598 |
}); |
598 |
}); |
| 599 |
|
599 |
|
| 600 |
function activateBatchActions( active_tab ){ |
600 |
function activateBatchActions(active_tab) { |
| 601 |
// Check to see whether batch menu should be shown based on state of checkboxes |
601 |
// Check to see whether batch menu should be shown based on state of checkboxes |
| 602 |
if ( $( "input:checkbox", active_tab ).length > 0 ) { |
602 |
if ($("input:checkbox", active_tab).length > 0) { |
| 603 |
// There are rows with checkboxes |
603 |
// There are rows with checkboxes |
| 604 |
$( "[class$='_table_controls']", active_tab ).show(); |
604 |
$("[class$='_table_controls']", active_tab).show(); |
| 605 |
if ( $( "input:checkbox:checked", active_tab ).length > 0 ) { |
605 |
if ($("input:checkbox:checked", active_tab).length > 0) { |
| 606 |
$( "[id^='article-menu-']", active_tab ).css("display","inline-block"); |
606 |
$("[id^='article-menu-']", active_tab).css("display", "inline-block"); |
| 607 |
} else { |
607 |
} else { |
| 608 |
$( "[id^='article-menu-']", active_tab ).hide(); |
608 |
$("[id^='article-menu-']", active_tab).hide(); |
| 609 |
} |
609 |
} |
| 610 |
} else { |
610 |
} else { |
| 611 |
// All rows have been removed |
611 |
// All rows have been removed |
| 612 |
$("[class$='_table_controls']", active_tab ).hide(); |
612 |
$("[class$='_table_controls']", active_tab).hide(); |
| 613 |
} |
613 |
} |
| 614 |
} |
614 |
} |
| 615 |
|
615 |
|
| 616 |
function HandleMulti( fnHandler, id, a ) { |
616 |
function HandleMulti(fnHandler, id, a) { |
| 617 |
last_cancel_reason = undefined; |
617 |
last_cancel_reason = undefined; |
| 618 |
if( id !== 0 ) { fnHandler( id, a ); return; } |
618 |
if (id !== 0) { |
| 619 |
$( active_tab + " input[type='checkbox']:checked").each(function() { |
619 |
fnHandler(id, a); |
| 620 |
fnHandler( $(this).attr('reqid'), $(this).closest('tr').find('td.ar-actions div a') ); |
620 |
return; |
|
|
621 |
} |
| 622 |
$(active_tab + " input[type='checkbox']:checked").each(function () { |
| 623 |
fnHandler($(this).attr("reqid"), $(this).closest("tr").find("td.ar-actions div a")); |
| 621 |
}); |
624 |
}); |
| 622 |
} |
625 |
} |
| 623 |
|
626 |
|
| 624 |
function PrintSlip(id, a) { |
627 |
function PrintSlip(id, a) { |
| 625 |
var link = 'article-request-slip.pl?id='+id; |
628 |
var link = "article-request-slip.pl?id=" + id; |
| 626 |
window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top'); |
629 |
window.open(link, "popup", "width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top"); |
| 627 |
} |
630 |
} |
| 628 |
$(".ar-print-request").on("click", function (e){ |
631 |
$(".ar-print-request").on("click", function (e) { |
| 629 |
e.preventDefault(); |
632 |
e.preventDefault(); |
| 630 |
HandleMulti(PrintSlip, $(this).data('ar-id')); |
633 |
HandleMulti(PrintSlip, $(this).data("ar-id")); |
| 631 |
}); |
634 |
}); |
| 632 |
|
635 |
|
| 633 |
$('#modal-cancellation-reason').on('change', function(e) { |
636 |
$("#modal-cancellation-reason").on("change", function (e) { |
| 634 |
let reason = $(this).val(); |
637 |
let reason = $(this).val(); |
| 635 |
$('#modal-notes').attr('disabled', !!reason); |
638 |
$("#modal-notes").attr("disabled", !!reason); |
| 636 |
}) |
639 |
}); |
| 637 |
|
640 |
|
| 638 |
// Confirm cancellation of article requests |
641 |
// Confirm cancellation of article requests |
| 639 |
let cancel_id; |
642 |
let cancel_id; |
| 640 |
let cancel_a; |
643 |
let cancel_a; |
| 641 |
$("#cancelModalConfirmBtn").on("click",function(e) { |
644 |
$("#cancelModalConfirmBtn").on("click", function (e) { |
| 642 |
let reason = $("#modal-cancellation-reason").val(); |
645 |
let reason = $("#modal-cancellation-reason").val(); |
| 643 |
let notes = $("#modal-notes").val(); |
646 |
let notes = $("#modal-notes").val(); |
| 644 |
let query = '?'+(reason?'cancellation_reason='+reason:'notes='+notes) |
647 |
let query = "?" + (reason ? "cancellation_reason=" + reason : "notes=" + notes); |
| 645 |
|
648 |
|
| 646 |
HandleMulti(function(id, a) { |
649 |
HandleMulti( |
| 647 |
var table_row = a.closest('tr'); |
650 |
function (id, a) { |
| 648 |
table_row.find('.ar-process-request').remove(); |
651 |
var table_row = a.closest("tr"); |
| 649 |
table_row.find('input[type="checkbox"]').prop('checked', false); |
652 |
table_row.find(".ar-process-request").remove(); |
| 650 |
|
653 |
table_row.find('input[type="checkbox"]').prop("checked", false); |
| 651 |
|
654 |
|
| 652 |
a.closest('td').prepend('<img src="' + interface + '/' + theme + '/img/spinner-small.gif"/>').find('div.dropdown').hide(); |
655 |
a.closest("td") |
| 653 |
$.ajax({ |
656 |
.prepend('<img src="' + interface + "/" + theme + '/img/spinner-small.gif"/>') |
| 654 |
type: "DELETE", |
657 |
.find("div.dropdown") |
| 655 |
url: '/api/v1/article_requests/'+id+query, |
658 |
.hide(); |
| 656 |
success: function( data ) { |
659 |
$.ajax({ |
| 657 |
active_datatable.DataTable().row( table_row ).remove().draw(); |
660 |
type: "DELETE", |
| 658 |
UpdateTabCounts(); |
661 |
url: "/api/v1/article_requests/" + id + query, |
| 659 |
activateBatchActions( active_tab ); |
662 |
success: function (data) { |
| 660 |
} |
663 |
active_datatable.DataTable().row(table_row).remove().draw(); |
| 661 |
}); |
664 |
UpdateTabCounts(); |
| 662 |
}, cancel_id, cancel_a) |
665 |
activateBatchActions(active_tab); |
|
|
666 |
}, |
| 667 |
}); |
| 668 |
}, |
| 669 |
cancel_id, |
| 670 |
cancel_a |
| 671 |
); |
| 663 |
}); |
672 |
}); |
| 664 |
|
673 |
|
| 665 |
function PrintMultipleSlip() { |
674 |
function PrintMultipleSlip() { |
| 666 |
var ids = []; |
675 |
var ids = []; |
| 667 |
$( active_tab + " input[type='checkbox']:checked").each(function() { |
676 |
$(active_tab + " input[type='checkbox']:checked").each(function () { |
| 668 |
ids.push($(this).attr('reqid')); |
677 |
ids.push($(this).attr("reqid")); |
| 669 |
}); |
678 |
}); |
| 670 |
var link = 'article-request-slip.pl?multi=1&id='+ids.join(','); |
679 |
var link = "article-request-slip.pl?multi=1&id=" + ids.join(","); |
| 671 |
window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top'); |
680 |
window.open(link, "popup", "width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top"); |
| 672 |
} |
681 |
} |
| 673 |
$(".ar-print-multiple-requests").on("click", function (e){ |
682 |
$(".ar-print-multiple-requests").on("click", function (e) { |
| 674 |
e.preventDefault(); |
683 |
e.preventDefault(); |
| 675 |
PrintMultipleSlip(); |
684 |
PrintMultipleSlip(); |
| 676 |
}); |
685 |
}); |
| 677 |
|
686 |
|
| 678 |
function Cancel( id, a ) { |
687 |
function Cancel(id, a) { |
| 679 |
cancel_id = id; |
688 |
cancel_id = id; |
| 680 |
cancel_a = a; |
689 |
cancel_a = a; |
| 681 |
|
690 |
|
| 682 |
$('#cancelModal').modal('show'); |
691 |
$("#cancelModal").modal("show"); |
| 683 |
} |
692 |
} |
| 684 |
$(".ar-cancel-request").on("click", function (e){ |
693 |
$(".ar-cancel-request").on("click", function (e) { |
| 685 |
e.preventDefault(); |
694 |
e.preventDefault(); |
| 686 |
HandleMulti(Cancel, $(this).data('ar-id'), $(this)); |
695 |
HandleMulti(Cancel, $(this).data("ar-id"), $(this)); |
| 687 |
}); |
696 |
}); |
| 688 |
|
697 |
|
| 689 |
async function Process( id, a ) { |
698 |
async function Process(id, a) { |
| 690 |
var table_row = a.closest('tr'); |
699 |
var table_row = a.closest("tr"); |
| 691 |
var table = a.closest('table'); |
700 |
var table = a.closest("table"); |
| 692 |
var orig_dt = table.attr('id')==='article-requests-pending-table'?pending_dt:requested_dt; |
701 |
var orig_dt = table.attr("id") === "article-requests-pending-table" ? pending_dt : requested_dt; |
| 693 |
|
702 |
|
| 694 |
a.closest('td').prepend('<img src="' + interface + '/' + theme + '/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide(); |
703 |
a.closest("td") |
|
|
704 |
.prepend('<img src="' + interface + "/" + theme + '/img/spinner-small.gif" class="spinner"/>') |
| 705 |
.find("div.dropdown") |
| 706 |
.hide(); |
| 695 |
|
707 |
|
| 696 |
const client = APIClient.article_request; |
708 |
const client = APIClient.article_request; |
| 697 |
await client.articleRequests.process(id).then( |
709 |
await client.articleRequests.process(id).then( |
| 698 |
success => { |
710 |
success => { |
| 699 |
$("img.spinner").remove(); |
711 |
$("img.spinner").remove(); |
| 700 |
table_row.find('.ar-process-request').remove(); |
712 |
table_row.find(".ar-process-request").remove(); |
| 701 |
table_row.find('input[type="checkbox"]').prop('checked', false); |
713 |
table_row.find('input[type="checkbox"]').prop("checked", false); |
| 702 |
orig_dt.row( table_row ).remove().draw(); |
714 |
orig_dt.row(table_row).remove().draw(); |
| 703 |
processing_dt.row.add( table_row ).draw(); |
715 |
processing_dt.row.add(table_row).draw(); |
| 704 |
UpdateTabCounts(); |
716 |
UpdateTabCounts(); |
| 705 |
activateBatchActions( active_tab ); |
717 |
activateBatchActions(active_tab); |
| 706 |
}, |
718 |
}, |
| 707 |
error => { |
719 |
error => { |
| 708 |
console.warn("Something wrong happened: %s".format(error)); |
720 |
console.warn("Something wrong happened: %s".format(error)); |
| 709 |
} |
721 |
} |
| 710 |
); |
722 |
); |
| 711 |
} |
723 |
} |
| 712 |
$(".ar-process-request").on("click", function (e){ |
724 |
$(".ar-process-request").on("click", function (e) { |
| 713 |
e.preventDefault(); |
725 |
e.preventDefault(); |
| 714 |
HandleMulti(Process, $(this).data('ar-id'), $(this)); |
726 |
HandleMulti(Process, $(this).data("ar-id"), $(this)); |
| 715 |
}); |
727 |
}); |
| 716 |
|
728 |
|
| 717 |
async function Complete( id, a ) { |
729 |
async function Complete(id, a) { |
| 718 |
// if it is a scan, check if urls field is filled |
730 |
// if it is a scan, check if urls field is filled |
| 719 |
var urlspan = $('span#url_'+id); |
731 |
var urlspan = $("span#url_" + id); |
| 720 |
if( urlspan.length>0 && urlspan.text() === '' ) { |
732 |
if (urlspan.length > 0 && urlspan.text() === "") { |
| 721 |
alert( _("Please fill URL before completing request.") ); |
733 |
alert(_("Please fill URL before completing request.")); |
| 722 |
return; |
734 |
return; |
| 723 |
} |
735 |
} |
| 724 |
a.closest('td').prepend('<img src="' + interface + '/' + theme + '/img/spinner-small.gif"/>').find('div.dropdown').hide(); |
736 |
a.closest("td") |
|
|
737 |
.prepend('<img src="' + interface + "/" + theme + '/img/spinner-small.gif"/>') |
| 738 |
.find("div.dropdown") |
| 739 |
.hide(); |
| 725 |
const client = APIClient.article_request; |
740 |
const client = APIClient.article_request; |
| 726 |
await client.articleRequests.complete(id).then( |
741 |
await client.articleRequests.complete(id).then( |
| 727 |
success => { |
742 |
success => { |
| 728 |
$("img.spinner").remove(); |
743 |
$("img.spinner").remove(); |
| 729 |
active_datatable.DataTable().row( a.closest('tr') ).remove().draw(); |
744 |
active_datatable.DataTable().row(a.closest("tr")).remove().draw(); |
| 730 |
UpdateTabCounts(); |
745 |
UpdateTabCounts(); |
| 731 |
activateBatchActions( active_tab ); |
746 |
activateBatchActions(active_tab); |
| 732 |
}, |
747 |
}, |
| 733 |
error => { |
748 |
error => { |
| 734 |
console.warn("Something wrong happened: %s".format(error)); |
749 |
console.warn("Something wrong happened: %s".format(error)); |
| 735 |
} |
750 |
} |
| 736 |
); |
751 |
); |
| 737 |
} |
752 |
} |
| 738 |
$(".ar-complete-request").on("click", function (e){ |
753 |
$(".ar-complete-request").on("click", function (e) { |
| 739 |
e.preventDefault(); |
754 |
e.preventDefault(); |
| 740 |
HandleMulti(Complete, $(this).data('ar-id'), $(this)); |
755 |
HandleMulti(Complete, $(this).data("ar-id"), $(this)); |
| 741 |
}); |
756 |
}); |
| 742 |
|
757 |
|
| 743 |
async function SetPending( id, a ) { |
758 |
async function SetPending(id, a) { |
| 744 |
var table_row = a.closest('tr'); |
759 |
var table_row = a.closest("tr"); |
| 745 |
table_row.find('.ar-set-pending-request').remove(); |
760 |
table_row.find(".ar-set-pending-request").remove(); |
| 746 |
table_row.find('input[type="checkbox"]').prop('checked', false); |
761 |
table_row.find('input[type="checkbox"]').prop("checked", false); |
| 747 |
a.closest('td').prepend('<img src="' + interface + '/' + theme + '/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide(); |
762 |
a.closest("td") |
|
|
763 |
.prepend('<img src="' + interface + "/" + theme + '/img/spinner-small.gif" class="spinner"/>') |
| 764 |
.find("div.dropdown") |
| 765 |
.hide(); |
| 748 |
const client = APIClient.article_request; |
766 |
const client = APIClient.article_request; |
| 749 |
await client.articleRequests.pending(id).then( |
767 |
await client.articleRequests.pending(id).then( |
| 750 |
success => { |
768 |
success => { |
| 751 |
$("img.spinner").remove(); |
769 |
$("img.spinner").remove(); |
| 752 |
requested_dt.row( table_row ).remove().draw(); |
770 |
requested_dt.row(table_row).remove().draw(); |
| 753 |
pending_dt.row.add( table_row ).draw(); |
771 |
pending_dt.row.add(table_row).draw(); |
| 754 |
UpdateTabCounts(); |
772 |
UpdateTabCounts(); |
| 755 |
activateBatchActions( active_tab ); |
773 |
activateBatchActions(active_tab); |
| 756 |
}, |
774 |
}, |
| 757 |
error => { |
775 |
error => { |
| 758 |
console.warn("Something wrong happened: %s".format(error)); |
776 |
console.warn("Something wrong happened: %s".format(error)); |
| 759 |
} |
777 |
} |
| 760 |
); |
778 |
); |
| 761 |
} |
779 |
} |
| 762 |
$(".ar-set-pending-request").on("click", function (e){ |
780 |
$(".ar-set-pending-request").on("click", function (e) { |
| 763 |
e.preventDefault(); |
781 |
e.preventDefault(); |
| 764 |
HandleMulti(SetPending, $(this).data('ar-id'), $(this)); |
782 |
HandleMulti(SetPending, $(this).data("ar-id"), $(this)); |
| 765 |
}); |
783 |
}); |
| 766 |
|
784 |
|
| 767 |
function UpdateTabCounts() { |
785 |
function UpdateTabCounts() { |
| 768 |
$("#ar_requested_count").html( requested_dt.rows().count() ); |
786 |
$("#ar_requested_count").html(requested_dt.rows().count()); |
| 769 |
$("#ar_pending_count").html( pending_dt.rows().count() ); |
787 |
$("#ar_pending_count").html(pending_dt.rows().count()); |
| 770 |
$("#ar_processing_count").html( processing_dt.rows().count() ); |
788 |
$("#ar_processing_count").html(processing_dt.rows().count()); |
| 771 |
} |
789 |
} |
| 772 |
|
790 |
|
| 773 |
function EditURLs(id) { |
791 |
function EditURLs(id) { |
| 774 |
var urls = $('span#url_'+ id).text(); |
792 |
var urls = $("span#url_" + id).text(); |
| 775 |
$('#myModal textarea').val(urls); |
793 |
$("#myModal textarea").val(urls); |
| 776 |
$('#myModal textarea').attr('ar_id', id); |
794 |
$("#myModal textarea").attr("ar_id", id); |
| 777 |
$('#myModal').modal('show'); |
795 |
$("#myModal").modal("show"); |
| 778 |
} |
796 |
} |
| 779 |
$(".ar-edit-urls").on("click", function (e){ |
797 |
$(".ar-edit-urls").on("click", function (e) { |
| 780 |
e.preventDefault(); |
798 |
e.preventDefault(); |
| 781 |
HandleMulti(EditURLs, $(this).data('ar-id')); |
799 |
HandleMulti(EditURLs, $(this).data("ar-id")); |
| 782 |
}); |
800 |
}); |
| 783 |
|
801 |
|
| 784 |
async function SaveURLs(newurl) { |
802 |
async function SaveURLs(newurl) { |
| 785 |
var id = $('#myModal textarea').attr('ar_id'); |
803 |
var id = $("#myModal textarea").attr("ar_id"); |
| 786 |
$('span#url_'+ id).text(newurl); |
804 |
$("span#url_" + id).text(newurl); |
| 787 |
if(newurl) |
805 |
if (newurl) $("span#url_yesno_" + id).text(_("Yes")); |
| 788 |
$('span#url_yesno_'+id).text(_("Yes")); |
806 |
else $("span#url_yesno_" + id).text(_("No")); |
| 789 |
else |
|
|
| 790 |
$('span#url_yesno_'+id).text(_("No")); |
| 791 |
|
807 |
|
| 792 |
const client = APIClient.article_request; |
808 |
const client = APIClient.article_request; |
| 793 |
await client.articleRequests.update_urls(id, newurl).then( |
809 |
await client.articleRequests.update_urls(id, newurl).then( |
| 794 |
success => { |
810 |
success => {}, |
| 795 |
}, |
|
|
| 796 |
error => { |
811 |
error => { |
| 797 |
console.warn("Something wrong happened: %s".format(error)); |
812 |
console.warn("Something wrong happened: %s".format(error)); |
| 798 |
} |
813 |
} |
| 799 |
); |
814 |
); |
| 800 |
} |
815 |
} |
| 801 |
$( '#myModal button' ).on("click", function () { |
816 |
$("#myModal button").on("click", function () { |
| 802 |
SaveURLs( $('#myModal textarea').val() ); |
817 |
SaveURLs($("#myModal textarea").val()); |
| 803 |
}); |
818 |
}); |
| 804 |
</script> |
819 |
</script> |
| 805 |
[% END %] |
820 |
[% END %] |