Lines 897-903
Link Here
|
897 |
<form id="set-global-checkouts-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> |
897 |
<form id="set-global-checkouts-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> |
898 |
[% INCLUDE 'csrf-token.inc' %] |
898 |
[% INCLUDE 'csrf-token.inc' %] |
899 |
<input type="hidden" name="op" value="cud-set-global-checkout-limits" /> |
899 |
<input type="hidden" name="op" value="cud-set-global-checkout-limits" /> |
900 |
<table> |
900 |
<table id="global-checkout-limits-rules"> |
901 |
<thead> |
901 |
<thead> |
902 |
<tr> |
902 |
<tr> |
903 |
<th class="fixed_sort">Patron category</th> |
903 |
<th class="fixed_sort">Patron category</th> |
Lines 932-938
Link Here
|
932 |
[% END %] |
932 |
[% END %] |
933 |
</td> |
933 |
</td> |
934 |
<td class="actions restricted-access"> |
934 |
<td class="actions restricted-access"> |
935 |
<a href="#" class="editrule btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> |
935 |
<a href="#" class="editrule-global-checkout-limits btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> |
936 |
<a href="#" class="delete-global-checkout-limits btn btn-default btn-xs" data-itemtype="[% i || '*' | html %]" data-categorycode="[% c || '*' | html %]" data-branch="*"><i class="fa fa-trash-can"></i> Delete</a> |
936 |
<a href="#" class="delete-global-checkout-limits btn btn-default btn-xs" data-itemtype="[% i || '*' | html %]" data-categorycode="[% c || '*' | html %]" data-branch="*"><i class="fa fa-trash-can"></i> Delete</a> |
937 |
</td> |
937 |
</td> |
938 |
<td> |
938 |
<td> |
Lines 953-961
Link Here
|
953 |
[% END %] |
953 |
[% END %] |
954 |
[% END %] |
954 |
[% END %] |
955 |
[% END %] |
955 |
[% END %] |
956 |
<tr class="noExport restricted-access" id="edit_row"> |
956 |
<tr class="noExport restricted-access" id="global_checkout_limits_edit_row"> |
957 |
<td> |
957 |
<td> |
958 |
<select name="categorycode" id="categorycode"> |
958 |
<select name="categorycode" id="global_checkout_limits_categorycode"> |
959 |
<option value="*">All</option> |
959 |
<option value="*">All</option> |
960 |
[% FOREACH patron_category IN patron_categories%] |
960 |
[% FOREACH patron_category IN patron_categories%] |
961 |
<option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option> |
961 |
<option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option> |
Lines 963-969
Link Here
|
963 |
</select> |
963 |
</select> |
964 |
</td> |
964 |
</td> |
965 |
<td> |
965 |
<td> |
966 |
<select name="itemtype" id="matrixitemtype" style="width:13em;"> |
966 |
<select name="itemtype" id="global_checkout_limits_itemtype" style="width:13em;"> |
967 |
<option value="*">All</option> |
967 |
<option value="*">All</option> |
968 |
[% FOREACH itemtypeloo IN itemtypeloop %] |
968 |
[% FOREACH itemtypeloo IN itemtypeloop %] |
969 |
[% NEXT IF itemtypeloo.parent_type %] |
969 |
[% NEXT IF itemtypeloo.parent_type %] |
Lines 983-992
Link Here
|
983 |
</td> |
983 |
</td> |
984 |
<td class="actions"> |
984 |
<td class="actions"> |
985 |
<button type="submit" class="btn btn-primary btn-xs"><i class="fa fa-save"></i> Save</button> |
985 |
<button type="submit" class="btn btn-primary btn-xs"><i class="fa fa-save"></i> Save</button> |
986 |
<button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button> |
986 |
<button name="cancel" class="clear_edit_global_checkouts_limit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button> |
987 |
</td> |
987 |
</td> |
988 |
<td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td> |
988 |
<td><input type="text" name="maxissueqty" id="global_checkout_limits_maxissueqty" size="3" /></td> |
989 |
<td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td> |
989 |
<td><input type="text" name="maxonsiteissueqty" id="global_checkout_limits_maxonsiteissueqty" size="3" /></td> |
990 |
</tr> |
990 |
</tr> |
991 |
</tbody> |
991 |
</tbody> |
992 |
</table> |
992 |
</table> |
Lines 1562-1572
Link Here
|
1562 |
}); |
1562 |
}); |
1563 |
}); |
1563 |
}); |
1564 |
|
1564 |
|
1565 |
function clear_edit() { |
1565 |
function clear_edit_form(editRowSelector, tableSelector) { |
1566 |
var cancel = confirm(_("Are you sure you want to cancel your changes?")); |
1566 |
var cancel = confirm(_("Are you sure you want to cancel your changes?")); |
1567 |
if (!cancel) return; |
1567 |
if (!cancel) return; |
1568 |
$("#default-circulation-rules td").removeClass("highlighted-row"); |
1568 |
$("#default-circulation-rules td").removeClass("highlighted-row"); |
1569 |
var edit_row = $("#edit_row"); |
1569 |
var edit_row = $(editRowSelector); |
1570 |
$(edit_row) |
1570 |
$(edit_row) |
1571 |
.find("input") |
1571 |
.find("input") |
1572 |
.each(function () { |
1572 |
.each(function () { |
Lines 1575-1592
Link Here
|
1575 |
$(this).val(""); |
1575 |
$(this).val(""); |
1576 |
$(this).prop("disabled", false); |
1576 |
$(this).prop("disabled", false); |
1577 |
} |
1577 |
} |
1578 |
if (type == "checkbox") { |
1578 |
if (type === "checkbox") { |
1579 |
$(this).prop("checked", false); |
1579 |
$(this).prop("checked", false); |
1580 |
} |
1580 |
} |
1581 |
}); |
1581 |
}); |
1582 |
$(edit_row).find("select").prop("disabled", false); |
1582 |
edit_row.find("select").prop('disabled', false); |
1583 |
$(edit_row).find("select option:selected").removeAttr("selected"); |
1583 |
edit_row.find("select option:selected").prop('selected', false); |
1584 |
$(edit_row).find("select option:first-child").attr("selected", "selected"); |
1584 |
edit_row.find("select option:first-child").prop("selected", true); |
1585 |
$(edit_row).find("td:last input[name='clear']").remove(); |
1585 |
edit_row.find("td:last input[name='clear']").remove(); |
1586 |
} |
1586 |
} |
1587 |
|
1587 |
|
1588 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone."); |
1588 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone."); |
1589 |
|
1589 |
$(".editrule-global-checkout-limits").click(function(){ |
|
|
1590 |
if ( $("#global_checkout_limits_edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) { |
1591 |
var edit = confirm(_("Are you sure you want to edit another rule?")); |
1592 |
if (!edit) return false; |
1593 |
} |
1594 |
$('#global-checkout-limits-rules td').removeClass('highlighted-row'); |
1595 |
$(this).parent().parent().find("td").each(function (i) { |
1596 |
$(this).addClass('highlighted-row'); |
1597 |
itm_code = $(this).data('code'); |
1598 |
itm_text = $(this).text(); |
1599 |
itm_text = itm_text.replace(/^\s*|\s*$/g,''); |
1600 |
var current_column = $("#global_checkout_limits_edit_row td:eq("+i+")"); |
1601 |
var current_input_id = $(current_column).children('input').first().attr('id'); |
1602 |
$(current_column).find("input[type='text']").val(itm_text); |
1603 |
// select the corresponding option |
1604 |
$(current_column).find("select option").each(function(){ |
1605 |
// Reset selection status for all options |
1606 |
$(this).prop('selected', false); |
1607 |
// Declare opt here to ensure it is scoped correctly within the loop |
1608 |
let opt = $(this).val(); |
1609 |
// Select the matching option |
1610 |
if (opt == itm_code) { |
1611 |
$(this).prop('selected', true); |
1612 |
} |
1613 |
}); |
1614 |
// After setting the correct option, update the select to reflect the change |
1615 |
$(current_column).find('select').trigger('change'); |
1616 |
if ( i == 0 || i == 1 ) { |
1617 |
// Disable the 2 first columns, we cannot update them. |
1618 |
var val = $(current_column).find("select option:selected").val(); |
1619 |
var name = "categorycode"; |
1620 |
if ( i == 1 ) { |
1621 |
name="itemtype"; |
1622 |
} |
1623 |
// Remove potential previous input added |
1624 |
$(current_column).find("input").remove(); |
1625 |
$(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />"); |
1626 |
} else if ( current_input_id === "global_checkout_limits_maxissueqty" || current_input_id === "global_checkout_limits_maxonsiteissueqty" ) { |
1627 |
// If the value is not an integer for |
1628 |
// - "Global current checkouts allowed" |
1629 |
// - "Global current on-site checkouts allowed" |
1630 |
// The value will be "Not defined" |
1631 |
if( !((parseFloat(itm_text) == parseInt(itm_text)) && !isNaN(itm_text)) ) { |
1632 |
$(current_column).find("input[type='text']").val(""); |
1633 |
} |
1634 |
} |
1635 |
}); |
1636 |
return false; |
1637 |
}); |
1590 |
$(document).ready(function () { |
1638 |
$(document).ready(function () { |
1591 |
$('[data-bs-toggle="popover"]').popover(); |
1639 |
$('[data-bs-toggle="popover"]').popover(); |
1592 |
|
1640 |
|
Lines 1724-1731
Link Here
|
1724 |
}); |
1772 |
}); |
1725 |
$(".clear_edit").on("click", function (e) { |
1773 |
$(".clear_edit").on("click", function (e) { |
1726 |
e.preventDefault(); |
1774 |
e.preventDefault(); |
1727 |
clear_edit(); |
1775 |
clear_edit_form("#edit_row", "#default-circulation-rules"); |
1728 |
}); |
1776 |
}); |
|
|
1777 |
$(".clear_edit_global_checkouts_limit").on("click",function(e){ |
1778 |
e.preventDefault(); |
1779 |
clear_edit_form("#global_checkout_limits_edit_row", "#global-checkout-limits-rules"); |
1780 |
}); |
1729 |
|
1781 |
|
1730 |
$("#set-article-requests-daily-limit").on("submit", function () { |
1782 |
$("#set-article-requests-daily-limit").on("submit", function () { |
1731 |
if (!$("input[name='open_article_requests_limit'").val().length) { |
1783 |
if (!$("input[name='open_article_requests_limit'").val().length) { |
1732 |
- |
|
|