Lines 793-798
$(document).ready(function () {
Link Here
|
793 |
); |
793 |
); |
794 |
} |
794 |
} |
795 |
|
795 |
|
|
|
796 |
function updateMoveButtons(table) { |
797 |
var checked_holds = $(".select_hold:checked", table); |
798 |
var checked_count = checked_holds.length; |
799 |
|
800 |
var item_level_count = checked_holds.filter(function () { |
801 |
return $(this).attr("data-item_level_hold") !== ""; |
802 |
}).length; |
803 |
|
804 |
var record_level_count = checked_holds.filter(function () { |
805 |
return $(this).attr("data-item_level_hold") === ""; |
806 |
}).length; |
807 |
|
808 |
$(".move_hold_item").toggleClass("disabled", item_level_count <= 0); |
809 |
$(".move_hold_biblio").toggleClass("disabled", record_level_count <= 0); |
810 |
$(".move_selected_holds").prop("disabled", !checked_count); |
811 |
} |
812 |
|
796 |
updateSelectedHoldsButtonCounters(); |
813 |
updateSelectedHoldsButtonCounters(); |
797 |
|
814 |
|
798 |
$(".holds_table .select_hold_all").click(function () { |
815 |
$(".holds_table .select_hold_all").click(function () { |
Lines 802-810
$(document).ready(function () {
Link Here
|
802 |
} else { |
819 |
} else { |
803 |
table = $(".holds_table:not(.fixedHeader-floating)"); |
820 |
table = $(".holds_table:not(.fixedHeader-floating)"); |
804 |
} |
821 |
} |
805 |
var count = $(".select_hold:checked", table).length; |
822 |
|
806 |
$(".select_hold", table).prop("checked", !count); |
823 |
var checked_count = $(".select_hold:checked", table).length; |
807 |
$(this).prop("checked", !count); |
824 |
$(".select_hold", table).prop("checked", !checked_count); |
|
|
825 |
$(this).prop("checked", !checked_count); |
826 |
|
827 |
updateMoveButtons(table); |
828 |
|
808 |
updateSelectedHoldsButtonCounters(); |
829 |
updateSelectedHoldsButtonCounters(); |
809 |
$("#cancel_hold_alert").html( |
830 |
$("#cancel_hold_alert").html( |
810 |
MSG_CANCEL_ALERT.format( |
831 |
MSG_CANCEL_ALERT.format( |
Lines 825-838
$(document).ready(function () {
Link Here
|
825 |
) |
846 |
) |
826 |
.join(",") + |
847 |
.join(",") + |
827 |
"]"; |
848 |
"]"; |
828 |
$(".move_selected_holds").prop("disabled", count); |
|
|
829 |
}); |
849 |
}); |
830 |
|
850 |
|
831 |
$(".holds_table").on("click", ".select_hold", function () { |
851 |
$(".holds_table").on("click", ".select_hold", function () { |
832 |
var table = $(this).parents(".holds_table"); |
852 |
var table = $(this).parents(".holds_table"); |
833 |
var count = $(".select_hold:not(:checked)", table).length; |
853 |
var count = $(".select_hold:not(:checked)", table).length; |
834 |
var checked_count = $(".select_hold:checked", table).length; |
|
|
835 |
$(".select_hold_all", table).prop("checked", !count); |
854 |
$(".select_hold_all", table).prop("checked", !count); |
|
|
855 |
|
856 |
updateMoveButtons(table); |
857 |
|
836 |
updateSelectedHoldsButtonCounters(); |
858 |
updateSelectedHoldsButtonCounters(); |
837 |
$("#cancel_hold_alert").html( |
859 |
$("#cancel_hold_alert").html( |
838 |
MSG_CANCEL_ALERT.format( |
860 |
MSG_CANCEL_ALERT.format( |
Lines 853-859
$(document).ready(function () {
Link Here
|
853 |
) |
875 |
) |
854 |
.join(",") + |
876 |
.join(",") + |
855 |
"]"; |
877 |
"]"; |
856 |
$(".move_selected_holds").prop("disabled", !checked_count); |
|
|
857 |
}); |
878 |
}); |
858 |
|
879 |
|
859 |
$(".cancel_selected_holds").click(function (e) { |
880 |
$(".cancel_selected_holds").click(function (e) { |
Lines 1005-1010
$(document).ready(function () {
Link Here
|
1005 |
} |
1026 |
} |
1006 |
}); |
1027 |
}); |
1007 |
|
1028 |
|
|
|
1029 |
$(".move_hold_item").click(function (e) { |
1030 |
e.preventDefault(); |
1031 |
$("#move_hold_item_confirm").prop("disabled", true); |
1032 |
if ($(".holds_table .select_hold:checked").length) { |
1033 |
$("#itemResultMessage").empty(); |
1034 |
$("#move_hold_item_selection table tbody").empty(); |
1035 |
$("#moveHoldItemModal").modal("show"); |
1036 |
$(".select_hold:checked").each(function () { |
1037 |
let reserve_id = $(this).data("id"); |
1038 |
let reserve_biblionumber = $(this).data("biblionumber"); |
1039 |
let reserve_itemnumber = $(this).data("itemnumber"); |
1040 |
let item_level_hold = $(this).data("item_level_hold"); |
1041 |
let item_waiting = $(this).data("waiting"); |
1042 |
let item_intransit = $(this).data("intransit"); |
1043 |
let error_message = $(this).data("item_level_hold") |
1044 |
? "" |
1045 |
: __( |
1046 |
"Cannot move a waiting, in transit, or record level hold" |
1047 |
); |
1048 |
let found_status = $(this).data("found"); |
1049 |
if (item_level_hold && (!item_waiting || !item_intransit)) { |
1050 |
$("#move_hold_item_selection table").append( |
1051 |
`<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" checked /></td><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a> Itemnumber: <a target="_blank" href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=${reserve_biblionumber}#item${reserve_itemnumber}">${reserve_itemnumber}</a></td><td>${error_message}</td></tr>` |
1052 |
); |
1053 |
} else { |
1054 |
$("#move_hold_item_selection table").append( |
1055 |
`<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" disabled /></td><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a> Itemnumber: <a target="_blank" href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=${reserve_biblionumber}#item${reserve_itemnumber}">${reserve_itemnumber}</a></td><td>${error_message}</td></tr>` |
1056 |
); |
1057 |
} |
1058 |
}); |
1059 |
} |
1060 |
}); |
1061 |
|
1062 |
$(".move_hold_biblio").click(function (e) { |
1063 |
e.preventDefault(); |
1064 |
$("#move_hold_biblio_confirm").prop("disabled", true); |
1065 |
if ($(".holds_table .select_hold:checked").length) { |
1066 |
$("#biblioResultMessage").empty(); |
1067 |
$("#move_hold_biblio_selection table tbody").empty(); |
1068 |
$("#moveHoldBiblioModal").modal("show"); |
1069 |
$(".select_hold:checked").each(function () { |
1070 |
let reserve_id = $(this).data("id"); |
1071 |
let reserve_biblionumber = $(this).data("biblionumber"); |
1072 |
let reserve_itemnumber = $(this).data("itemnumber"); |
1073 |
let item_level_hold = $(this).data("item_level_hold"); |
1074 |
let item_status = $(this).data("status"); |
1075 |
let item_waiting = $(this).data("waiting"); |
1076 |
let item_intransit = $(this).data("intransit"); |
1077 |
let error_message = $(this).data("item_level_hold") |
1078 |
? __( |
1079 |
"Cannot move a waiting, in transit, or item level hold" |
1080 |
) |
1081 |
: ""; |
1082 |
let found_status = $(this).data("found"); |
1083 |
if (!item_level_hold && (!item_waiting || !item_intransit)) { |
1084 |
$("#move_hold_biblio_selection table").append( |
1085 |
`<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" checked /><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a></td><td>${error_message}</td></tr>` |
1086 |
); |
1087 |
} else { |
1088 |
$("#move_hold_biblio_selection table").append( |
1089 |
`<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" disabled /><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a></td><td>${error_message}</td></tr>` |
1090 |
); |
1091 |
} |
1092 |
}); |
1093 |
} |
1094 |
}); |
1095 |
|
1008 |
function _append_patron_page_cancel_hold_modal_data(hold) { |
1096 |
function _append_patron_page_cancel_hold_modal_data(hold) { |
1009 |
$("#cancel_modal_form #inputs").append( |
1097 |
$("#cancel_modal_form #inputs").append( |
1010 |
'<input type="hidden" name="rank-request" value="del">' |
1098 |
'<input type="hidden" name="rank-request" value="del">' |
1011 |
- |
|
|