Lines 918-924
Link Here
|
918 |
<form id="set-global-checkouts-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> |
918 |
<form id="set-global-checkouts-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> |
919 |
[% INCLUDE 'csrf-token.inc' %] |
919 |
[% INCLUDE 'csrf-token.inc' %] |
920 |
<input type="hidden" name="op" value="cud-set-global-checkout-limits" /> |
920 |
<input type="hidden" name="op" value="cud-set-global-checkout-limits" /> |
921 |
<table> |
921 |
<table id="global-checkout-limits-rules"> |
922 |
<thead> |
922 |
<thead> |
923 |
<tr> |
923 |
<tr> |
924 |
<th class="fixed_sort">Patron category</th> |
924 |
<th class="fixed_sort">Patron category</th> |
Lines 953-959
Link Here
|
953 |
[% END %] |
953 |
[% END %] |
954 |
</td> |
954 |
</td> |
955 |
<td class="actions restricted-access"> |
955 |
<td class="actions restricted-access"> |
956 |
<a href="#" class="editrule btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> |
956 |
<a href="#" class="editrule-global-checkout-limits btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> |
957 |
<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> |
957 |
<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> |
958 |
</td> |
958 |
</td> |
959 |
<td> |
959 |
<td> |
Lines 974-982
Link Here
|
974 |
[% END %] |
974 |
[% END %] |
975 |
[% END %] |
975 |
[% END %] |
976 |
[% END %] |
976 |
[% END %] |
977 |
<tr class="noExport restricted-access" id="edit_row"> |
977 |
<tr class="noExport restricted-access" id="global_checkout_limits_edit_row"> |
978 |
<td> |
978 |
<td> |
979 |
<select name="categorycode" id="categorycode"> |
979 |
<select name="categorycode" id="global_checkout_limits_categorycode"> |
980 |
<option value="*">All</option> |
980 |
<option value="*">All</option> |
981 |
[% FOREACH patron_category IN patron_categories%] |
981 |
[% FOREACH patron_category IN patron_categories%] |
982 |
<option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option> |
982 |
<option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option> |
Lines 984-990
Link Here
|
984 |
</select> |
984 |
</select> |
985 |
</td> |
985 |
</td> |
986 |
<td> |
986 |
<td> |
987 |
<select name="itemtype" id="matrixitemtype" style="width:13em;"> |
987 |
<select name="itemtype" id="global_checkout_limits_itemtype" style="width:13em;"> |
988 |
<option value="*">All</option> |
988 |
<option value="*">All</option> |
989 |
[% FOREACH itemtypeloo IN itemtypeloop %] |
989 |
[% FOREACH itemtypeloo IN itemtypeloop %] |
990 |
[% NEXT IF itemtypeloo.parent_type %] |
990 |
[% NEXT IF itemtypeloo.parent_type %] |
Lines 1004-1013
Link Here
|
1004 |
</td> |
1004 |
</td> |
1005 |
<td class="actions"> |
1005 |
<td class="actions"> |
1006 |
<button type="submit" class="btn btn-primary btn-xs"><i class="fa fa-save"></i> Save</button> |
1006 |
<button type="submit" class="btn btn-primary btn-xs"><i class="fa fa-save"></i> Save</button> |
1007 |
<button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button> |
1007 |
<button name="cancel" class="clear_edit_global_checkouts_limit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button> |
1008 |
</td> |
1008 |
</td> |
1009 |
<td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td> |
1009 |
<td><input type="text" name="maxissueqty" id="global_checkout_limits_maxissueqty" size="3" /></td> |
1010 |
<td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td> |
1010 |
<td><input type="text" name="maxonsiteissueqty" id="global_checkout_limits_maxonsiteissueqty" size="3" /></td> |
1011 |
</tr> |
1011 |
</tr> |
1012 |
</tbody> |
1012 |
</tbody> |
1013 |
</table> |
1013 |
</table> |
Lines 1595-1619
Link Here
|
1595 |
}); |
1595 |
}); |
1596 |
}); |
1596 |
}); |
1597 |
|
1597 |
|
1598 |
function clear_edit(){ |
1598 |
function clear_edit_form(editRowSelector, tableSelector) { |
1599 |
var cancel = confirm(_("Are you sure you want to cancel your changes?")); |
1599 |
var cancel = confirm(_("Are you sure you want to cancel your changes?")); |
1600 |
if ( !cancel ) return; |
1600 |
if (!cancel) return; |
1601 |
$('#default-circulation-rules td').removeClass('highlighted-row'); |
1601 |
$(tableSelector + ' td').removeClass('highlighted-row'); |
1602 |
var edit_row = $("#edit_row"); |
1602 |
var edit_row = $(editRowSelector); |
1603 |
$(edit_row).find("input").each(function(){ |
1603 |
$(edit_row).find("input").each(function() { |
1604 |
var type = $(this).attr("type"); |
1604 |
var type = $(this).attr("type"); |
1605 |
if (type != "button" && type != "submit" ) { |
1605 |
if (type !== "button" && type !== "submit") { |
1606 |
$(this).val(""); |
1606 |
$(this).val(""); |
1607 |
$(this).prop('disabled', false); |
1607 |
$(this).prop('disabled', false); |
1608 |
} |
1608 |
} |
1609 |
if ( type == "checkbox" ) { |
1609 |
if (type === "checkbox") { |
1610 |
$(this).prop('checked', false); |
1610 |
$(this).prop('checked', false); |
1611 |
} |
1611 |
} |
1612 |
}); |
1612 |
}); |
1613 |
$(edit_row).find("select").prop('disabled', false); |
1613 |
edit_row.find("select").prop('disabled', false); |
1614 |
$(edit_row).find("select option:selected").removeAttr('selected'); |
1614 |
edit_row.find("select option:selected").prop('selected', false); |
1615 |
$(edit_row).find("select option:first-child").attr("selected", "selected"); |
1615 |
edit_row.find("select option:first-child").prop("selected", true); |
1616 |
$(edit_row).find("td:last input[name='clear']").remove(); |
1616 |
edit_row.find("td:last input[name='clear']").remove(); |
1617 |
} |
1617 |
} |
1618 |
|
1618 |
|
1619 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone."); |
1619 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone."); |
Lines 1732-1740
Link Here
|
1732 |
$("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true); |
1732 |
$("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true); |
1733 |
return false; |
1733 |
return false; |
1734 |
}); |
1734 |
}); |
|
|
1735 |
$(".editrule-global-checkout-limits").click(function(){ |
1736 |
if ( $("#global_checkout_limits_edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) { |
1737 |
var edit = confirm(_("Are you sure you want to edit another rule?")); |
1738 |
if (!edit) return false; |
1739 |
} |
1740 |
$('#global-checkout-limits-rules td').removeClass('highlighted-row'); |
1741 |
$(this).parent().parent().find("td").each(function (i) { |
1742 |
|
1743 |
$(this).addClass('highlighted-row'); |
1744 |
itm_code = $(this).data('code'); |
1745 |
itm_text = $(this).text(); |
1746 |
itm_text = itm_text.replace(/^\s*|\s*$/g,''); |
1747 |
var current_column = $("#global_checkout_limits_edit_row td:eq("+i+")"); |
1748 |
var current_input_id = $(current_column).children('input').first().attr('id'); |
1749 |
$(current_column).find("input[type='text']").val(itm_text); |
1750 |
// select the corresponding option |
1751 |
$(current_column).find("select option").each(function(){ |
1752 |
// Reset selection status for all options |
1753 |
$(this).prop('selected', false); |
1754 |
// Declare opt here to ensure it is scoped correctly within the loop |
1755 |
let opt = $(this).val(); |
1756 |
// Select the matching option |
1757 |
if (opt == itm_code) { |
1758 |
$(this).prop('selected', true); |
1759 |
} |
1760 |
}); |
1761 |
// After setting the correct option, update the select to reflect the change |
1762 |
$(current_column).find('select').trigger('change'); |
1763 |
if ( i == 0 || i == 1 ) { |
1764 |
// Disable the 2 first columns, we cannot update them. |
1765 |
var val = $(current_column).find("select option:selected").val(); |
1766 |
var name = "categorycode"; |
1767 |
if ( i == 1 ) { |
1768 |
name="itemtype"; |
1769 |
} |
1770 |
// Remove potential previous input added |
1771 |
$(current_column).find("input").remove(); |
1772 |
$(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />"); |
1773 |
} else if ( current_input_id === "global_checkout_limits_maxissueqty" || current_input_id === "global_checkout_limits_maxonsiteissueqty" ) { |
1774 |
// If the value is not an integer for |
1775 |
// - "Global current checkouts allowed" |
1776 |
// - "Global current on-site checkouts allowed" |
1777 |
// The value will be "Not defined" |
1778 |
if( !((parseFloat(itm_text) == parseInt(itm_text)) && !isNaN(itm_text)) ) { |
1779 |
$(current_column).find("input[type='text']").val(""); |
1780 |
} |
1781 |
} |
1782 |
}); |
1783 |
return false; |
1784 |
}); |
1735 |
$(".clear_edit").on("click",function(e){ |
1785 |
$(".clear_edit").on("click",function(e){ |
1736 |
e.preventDefault(); |
1786 |
e.preventDefault(); |
1737 |
clear_edit(); |
1787 |
clear_edit_form("#edit_row", "#default-circulation-rules"); |
|
|
1788 |
}); |
1789 |
$(".clear_edit_global_checkouts_limit").on("click",function(e){ |
1790 |
e.preventDefault(); |
1791 |
clear_edit_form("#global_checkout_limits_edit_row", "#global-checkout-limits-rules"); |
1738 |
}); |
1792 |
}); |
1739 |
|
1793 |
|
1740 |
$("#set-article-requests-daily-limit").on("submit", function(){ |
1794 |
$("#set-article-requests-daily-limit").on("submit", function(){ |
1741 |
- |
|
|