diff --git a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js index 798e656b4d..413b9f9458 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js +++ b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js @@ -17,26 +17,64 @@ $(document).ready(function () { $("#addcomment").toggleClass("content_hidden"); }); + // Handle filter by status for defined ILLRequestsTabs $("div#ill-list-tabs a[id^='ill-list-tab'").on("click", function (e) { e.preventDefault(); var select_status_el = $("form#illfilter_form select#illfilter_status"); - var tab_statuses = $(this).children('span').attr("data-statuses"); - if (tab_statuses) { - tab_statuses.split('|').forEach((select_status_option) => { - if ($("#illfilter_status option[value='"+select_status_option+"']").length === 0) { - select_status_el.append($('" ); }); - $("select#illfilter_status").multipleSelect( { - placeholder: _("Please select ..."), - selectAllText: _("Select all"), - allSelected: _("All selected"), - countSelected: _("# of % selected"), - noMatchesFound: _("No matches found"), - } ); + $("select#illfilter_status").multipleSelect({ + placeholder: __("Please select ..."), + selectAllText: __("Select all"), + allSelected: __("All selected"), + countSelected: __("# of % selected"), + noMatchesFound: __("No matches found"), + styler: function (value) { + // Apply styling to disabled options + var option = $(`#illfilter_status option[value='${value}']`); + if (option.prop("disabled")) { + return { opacity: "0.6", cursor: "not-allowed" }; + } + }, + }); } function addStatusAliasOptions(status_aliases) { @@ -735,7 +813,6 @@ $(document).ready(function () { populateBackendFilter(); } }); - populateBackendFilter(); // Clear all filters