Bug 41573: patron_lists - auto tidy

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2026-01-09 13:15:00 +01:00 committed by Lucas Gass
parent 2aadd46d8d
commit ea59367794
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
3 changed files with 56 additions and 57 deletions

View File

@ -237,92 +237,94 @@
<script>
var table_settings = [% TablesSettings.GetTableSettings('members', 'patron-lists', 'patron-list-table', 'json') | $raw %]
</script>
<script>
$(document).ready(function() {
$('#patrons_to_add_fieldset').hide();
$(document).ready(function () {
$("#patrons_to_add_fieldset").hide();
$("#patron-list-table").kohaTable(
{
pagingType: "full",
},
table_settings
);
$("#patron-list-table").kohaTable(
{
pagingType: "full",
},
table_settings
);
function RemovePatron( cardnumber, container ) {
$( '#borrower_' + cardnumber ).remove();
function RemovePatron(cardnumber, container) {
$("#borrower_" + cardnumber).remove();
if ( ! $(container).html() ) {
$(container).parent("fieldset").hide( 800 );
if (!$(container).html()) {
$(container).parent("fieldset").hide(800);
}
}
patron_autocomplete($("#find_patron"), {
"on-select-add-to": {
container: $("#patrons_to_add"),
input_name: 'patrons_to_add',
input_name: "patrons_to_add",
},
"on-select-callback": function( event, ui ) {
$("#find_patron").val('').focus();
"on-select-callback": function (event, ui) {
$("#find_patron").val("").focus();
return false;
}
},
});
$("body").on("click", "#CheckAll", function(e){
$("body").on("click", "#CheckAll", function (e) {
e.preventDefault();
$("input[type='checkbox']","#patron-list-table").each(function(){
$(this).prop("checked",1);
$("input[type='checkbox']", "#patron-list-table").each(function () {
$(this).prop("checked", 1);
});
});
$("body").on("click", "#CheckNone", function(e){
$("body").on("click", "#CheckNone", function (e) {
e.preventDefault();
$("input[type='checkbox']","#patron-list-table").each(function(){
$(this).prop("checked",0);
$("input[type='checkbox']", "#patron-list-table").each(function () {
$(this).prop("checked", 0);
});
});
$("#remove_patrons").submit(function(){
$("#remove_patrons").submit(function () {
var checkedItems = $("input:checked");
if ($(checkedItems).size() == 0) {
alert(_("You must select one or more patrons to remove"));
return false;
}
$(checkedItems).parents('tr').addClass("warn");
if( confirm(_("Are you sure you want to remove the selected patrons?")) ) {
$(checkedItems).parents("tr").addClass("warn");
if (confirm(_("Are you sure you want to remove the selected patrons?"))) {
return true;
} else {
$(checkedItems).parents('tr').removeClass("warn");
$(checkedItems).parents("tr").removeClass("warn");
return false;
}
});
$("#add_patrons_by_id a").on("click", function(){
$("#add_patrons_by_id a").on("click", function () {
$("#add_patrons_by_id, #patron_search_line").hide();
$("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").show();
});
$("#add_patrons_by_search a").on("click", function(){
$("#add_patrons_by_search a").on("click", function () {
$("#add_patrons_by_id, #patron_search_line").show();
$("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").hide();
});
$('.merge-patrons').on('click', function() {
$(".merge-patrons").on("click", function () {
var checkedItems = $("input:checked");
if ($(checkedItems).length < 2) {
alert(_("You must select two or more patrons to merge"));
return false;
}
$(checkedItems).parents('tr').addClass("warn");
$(checkedItems).parents("tr").addClass("warn");
if (confirm(_("Are you sure you want to merge the selected patrons?"))) {
var merge_patrons_url = '/cgi-bin/koha/members/merge-patrons.pl?' +
$('.selection:checked')
.map(function() {
return "id=" + $( '#borrowernumber_' + $(this).val() ).val()
}).get().join('&');
var merge_patrons_url =
"/cgi-bin/koha/members/merge-patrons.pl?" +
$(".selection:checked")
.map(function () {
return "id=" + $("#borrowernumber_" + $(this).val()).val();
})
.get()
.join("&");
window.location.href = merge_patrons_url;
return false;
} else {
$(checkedItems).parents('tr').removeClass("warn");
$(checkedItems).parents("tr").removeClass("warn");
return false;
}
});

View File

@ -166,9 +166,8 @@
const interface = "[% interface | html %]";
const theme = "[% theme | html %]";
</script>
<script>
$(document).ready(function() {
$(document).ready(function () {
var patronExportModal = $("#patronExportModal");
var patronExportModalBody = $("#patronExportModal .modal-body");
@ -177,62 +176,61 @@
$("#patron-lists-table").kohaTable({
autoWidth: false,
pagingType: "full",
order: [[ 1, "asc" ]]
order: [[1, "asc"]],
});
$(".delete_patron").on("click", function(){
$(".delete_patron").on("click", function () {
$(".dropdown").removeClass("open");
var list = $(this).data("list-name");
return confirmDelete( _("Are you sure you want to delete the list %s?").format(list));
return confirmDelete(_("Are you sure you want to delete the list %s?").format(list));
});
$("#patrons_lists_form").submit(function(){
$("#patrons_lists_form").submit(function () {
var checkedItems = $("input[name=patron_lists_ids]:checked");
if ( checkedItems.size() == 0) {
if (checkedItems.size() == 0) {
alert(_("You must select one or more lists to delete"));
return false;
}
if( confirm(_("Are you sure you want to delete the selected lists?")) ) {
if (confirm(_("Are you sure you want to delete the selected lists?"))) {
return true;
} else {
return false;
}
});
$(document).on("click", ".select_list", function() {
$(document).on("click", ".select_list", function () {
var checkedItems = $("input[name=patron_lists_ids]:checked");
if ( checkedItems.size() == 0 ) {
if (checkedItems.size() == 0) {
$("#delete_selected_lists").addClass("disabled").prop("disabled", true);
} else {
$("#delete_selected_lists").removeClass("disabled").prop("disabled", false);
}
});
$(".print_cards").on("click", function(e){
$(".print_cards").on("click", function (e) {
e.preventDefault();
var page = $(this).attr("href");
patronExportModalBody.load(page + " #exportingf");
patronExportModal.modal("show");
});
patronExportModal.on("hidden.bs.modal", function(){
patronExportModalBody.html("<div id=\"loading\"><img src=\"" + interface + "/" + theme + "/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
patronExportModal.on("hidden.bs.modal", function () {
patronExportModalBody.html('<div id="loading"><img src="' + interface + "/" + theme + '/img/spinner-small.gif" alt="" /> ' + _("Loading") + "</div>");
});
patronExportModal.on("submit", "#exportingf", function(e){
patronExportModal.on("submit", "#exportingf", function (e) {
e.preventDefault();
modal_body = patronExportModalBody;
modal_body.html("<div id=\"loading\"><img src=\"" + interface + "/" + theme + "/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
modal_body.html('<div id="loading"><img src="' + interface + "/" + theme + '/img/spinner-small.gif" alt="" /> ' + _("Loading") + "</div>");
target_url = $(this).attr("action");
params = $( this ).serialize();
$("#patronExportModal .modal-body").load( target_url + "?" + params + " #export_patron_list");
params = $(this).serialize();
$("#patronExportModal .modal-body").load(target_url + "?" + params + " #export_patron_list");
});
patronExportModal.on("click",".btn-close",function(e){
patronExportModal.on("click", ".btn-close", function (e) {
e.preventDefault();
patronExportModal.modal("hide");
});
});
</script>
[% END %]

View File

@ -129,7 +129,6 @@
CAN_user_tools_manage_patron_lists: [% CAN_user_tools_manage_patron_lists ? 1 : 0 | html %],
});
</script>
<script>
var patron_lists_dt_params = {
sPaginationType: "full",