From c7457ac4ac375b0ec2bd4d289ccbe69c220c4ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=A4is=C3=A4?= Date: Tue, 10 Feb 2026 08:55:45 +0200 Subject: [PATCH 3/3] Bug 23269: (follow-up) Add spinner and fix details column This patch adds a spinner to moving priorities and fixes the details column to show the correct information. --- koha-tmpl/intranet-tmpl/prog/js/holds.js | 116 ++++++++--------------- 1 file changed, 41 insertions(+), 75 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js index 78ca816119..ad17dd3a2e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/holds.js +++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js @@ -791,14 +791,6 @@ $(document).ready(function () { } }); - // if (!patron_page) { - // $(".holds_table .select_hold_all").each(function () { - // var table = $(this).parents(".holds_table"); - // var count = $(".select_hold:not(:checked)", table).length; - // $(".select_hold_all", table).prop("checked", !count); - // }); - // } - function updateSelectedHoldsButtonCounters() { $(".move_selected_holds").html( MSG_MOVE_SELECTED.format( @@ -1639,79 +1631,47 @@ async function load_patron_holds_table(biblio_id, split_data) { orderable: false, searchable: false, render: function (data, type, row, meta) { + const group_hold_message = row.hold_group_id + ? `
(${__("part of")} ${__("hold group")})
` + : ""; + + // Handle status cases if (row.status) { - return ( - '' + - row.item.external_id + - "" - ); - } else if (row.item_id && row.item_level) { - let barcode = row.item.external_id - ? row.item.external_id - : __("No barcode"); + return `${row.item.external_id}${group_hold_message}`; + } + + // Handle item level holds + if (row.item_level_holds) { + const barcode = + row.item.external_id || __("No barcode"); + const itemLink = `${barcode.escapeHtml ? barcode.escapeHtml() : barcode}`; + if (row.item_level_holds >= 2) { - let link = - '' + - (row.item.external_id - ? row.item.external_id.escapeHtml() - : __("No barcode")) + - ""; - return __("Only item") + " " + link; - } else { - let select = - '"; - return select; + return `${__("Only item")} ${itemLink}${group_hold_message}`; } - } else if (row.item_group_id) { - return __( - "Next available item from group %s" - ).format(row.item_group.description); - } else if (row.hold_group_id) { + + return `${group_hold_message}`; + } + + // Handle item group + if (row.item_group_id) { return ( - "
(" + - __("part of") + - ' ' + - __("hold group") + - ")
" + __( + "Next available item from group %s" + ).format(row.item_group.description) + + group_hold_message ); - } else { - if (row.non_priority) { - return ( - "" + - __("Next available") + - "
" + - __("Non priority hold") + - "" - ); - } else { - return "" + __("Next available") + ""; - } } + + // Default: Next available + let message = __("Next available"); + if (row.non_priority) { + message += `
${__("Non priority hold")}`; + } + return message + group_hold_message; }, }, { @@ -2297,6 +2257,9 @@ async function load_patron_holds_table(biblio_id, split_data) { let priority = $(this).attr("data-priority"); var res_id = $(this).attr("reserve_id"); var moveTo; + const $spinner = $( + 'Loading...' + ); if (toPosition == "up") { moveTo = parseInt(priority) - 1; } @@ -2309,15 +2272,18 @@ async function load_patron_holds_table(biblio_id, split_data) { if (toPosition == "bottom") { moveTo = totalHolds; } + $(this).parent().html($spinner); $.ajax({ method: "PUT", url: "/api/v1/holds/" + encodeURIComponent(res_id) + "/priority", data: JSON.stringify(moveTo), success: function (data) { + $spinner.remove(); holdsQueueTable.api().ajax.reload(null, false); }, error: function (jqXHR, textStatus, errorThrown) { + $spinner.remove(); alert( "There was an error:" + textStatus + " " + errorThrown ); -- 2.34.1