|
Lines 807-812
$(document).ready(function () {
Link Here
|
| 807 |
); |
807 |
); |
| 808 |
} |
808 |
} |
| 809 |
|
809 |
|
|
|
810 |
function updateMoveButtons(table) { |
| 811 |
var checked_holds = $(".select_hold:checked", table); |
| 812 |
var checked_count = checked_holds.length; |
| 813 |
|
| 814 |
var item_level_count = checked_holds.filter(function () { |
| 815 |
return $(this).attr("data-item_level_hold") !== ""; |
| 816 |
}).length; |
| 817 |
|
| 818 |
var record_level_count = checked_holds.filter(function () { |
| 819 |
return $(this).attr("data-item_level_hold") === ""; |
| 820 |
}).length; |
| 821 |
|
| 822 |
$(".move_hold_item").toggleClass("disabled", item_level_count <= 0); |
| 823 |
$(".move_hold_biblio").toggleClass("disabled", record_level_count <= 0); |
| 824 |
$(".move_selected_holds").prop("disabled", !checked_count); |
| 825 |
} |
| 826 |
|
| 810 |
updateSelectedHoldsButtonCounters(); |
827 |
updateSelectedHoldsButtonCounters(); |
| 811 |
|
828 |
|
| 812 |
$(".holds_table .select_hold_all").click(function () { |
829 |
$(".holds_table .select_hold_all").click(function () { |
|
Lines 816-824
$(document).ready(function () {
Link Here
|
| 816 |
} else { |
833 |
} else { |
| 817 |
table = $(".holds_table:not(.fixedHeader-floating)"); |
834 |
table = $(".holds_table:not(.fixedHeader-floating)"); |
| 818 |
} |
835 |
} |
| 819 |
var count = $(".select_hold:checked", table).length; |
836 |
|
| 820 |
$(".select_hold", table).prop("checked", !count); |
837 |
var checked_count = $(".select_hold:checked", table).length; |
| 821 |
$(this).prop("checked", !count); |
838 |
$(".select_hold", table).prop("checked", !checked_count); |
|
|
839 |
$(this).prop("checked", !checked_count); |
| 840 |
|
| 841 |
updateMoveButtons(table); |
| 842 |
|
| 822 |
updateSelectedHoldsButtonCounters(); |
843 |
updateSelectedHoldsButtonCounters(); |
| 823 |
$("#cancel_hold_alert").html( |
844 |
$("#cancel_hold_alert").html( |
| 824 |
MSG_CANCEL_ALERT.format( |
845 |
MSG_CANCEL_ALERT.format( |
|
Lines 839-852
$(document).ready(function () {
Link Here
|
| 839 |
) |
860 |
) |
| 840 |
.join(",") + |
861 |
.join(",") + |
| 841 |
"]"; |
862 |
"]"; |
| 842 |
$(".move_selected_holds").prop("disabled", count); |
|
|
| 843 |
}); |
863 |
}); |
| 844 |
|
864 |
|
| 845 |
$(".holds_table").on("click", ".select_hold", function () { |
865 |
$(".holds_table").on("click", ".select_hold", function () { |
| 846 |
var table = $(this).parents(".holds_table"); |
866 |
var table = $(this).parents(".holds_table"); |
| 847 |
var count = $(".select_hold:not(:checked)", table).length; |
867 |
var count = $(".select_hold:not(:checked)", table).length; |
| 848 |
var checked_count = $(".select_hold:checked", table).length; |
|
|
| 849 |
$(".select_hold_all", table).prop("checked", !count); |
868 |
$(".select_hold_all", table).prop("checked", !count); |
|
|
869 |
|
| 870 |
updateMoveButtons(table); |
| 871 |
|
| 850 |
updateSelectedHoldsButtonCounters(); |
872 |
updateSelectedHoldsButtonCounters(); |
| 851 |
$("#cancel_hold_alert").html( |
873 |
$("#cancel_hold_alert").html( |
| 852 |
MSG_CANCEL_ALERT.format( |
874 |
MSG_CANCEL_ALERT.format( |
|
Lines 867-873
$(document).ready(function () {
Link Here
|
| 867 |
) |
889 |
) |
| 868 |
.join(",") + |
890 |
.join(",") + |
| 869 |
"]"; |
891 |
"]"; |
| 870 |
$(".move_selected_holds").prop("disabled", !checked_count); |
|
|
| 871 |
}); |
892 |
}); |
| 872 |
|
893 |
|
| 873 |
$(".cancel_selected_holds").click(function (e) { |
894 |
$(".cancel_selected_holds").click(function (e) { |
|
Lines 1019-1024
$(document).ready(function () {
Link Here
|
| 1019 |
} |
1040 |
} |
| 1020 |
}); |
1041 |
}); |
| 1021 |
|
1042 |
|
|
|
1043 |
$(".move_hold_item").click(function (e) { |
| 1044 |
e.preventDefault(); |
| 1045 |
$("#move_hold_item_confirm").prop("disabled", true); |
| 1046 |
if ($(".holds_table .select_hold:checked").length) { |
| 1047 |
$("#itemResultMessage").empty(); |
| 1048 |
$("#move_hold_item_selection table tbody").empty(); |
| 1049 |
$("#moveHoldItemModal").modal("show"); |
| 1050 |
$(".select_hold:checked").each(function () { |
| 1051 |
let reserve_id = $(this).data("id"); |
| 1052 |
let reserve_biblionumber = $(this).data("biblionumber"); |
| 1053 |
let reserve_itemnumber = $(this).data("itemnumber"); |
| 1054 |
let item_level_hold = $(this).data("item_level_hold"); |
| 1055 |
let item_waiting = $(this).data("waiting"); |
| 1056 |
let item_intransit = $(this).data("intransit"); |
| 1057 |
let error_message = $(this).data("item_level_hold") |
| 1058 |
? "" |
| 1059 |
: __( |
| 1060 |
"Cannot move a waiting, in transit, or record level hold" |
| 1061 |
); |
| 1062 |
let found_status = $(this).data("found"); |
| 1063 |
if (item_level_hold && (!item_waiting || !item_intransit)) { |
| 1064 |
$("#move_hold_item_selection table").append( |
| 1065 |
`<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>` |
| 1066 |
); |
| 1067 |
} else { |
| 1068 |
$("#move_hold_item_selection table").append( |
| 1069 |
`<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>` |
| 1070 |
); |
| 1071 |
} |
| 1072 |
}); |
| 1073 |
} |
| 1074 |
}); |
| 1075 |
|
| 1076 |
$(".move_hold_biblio").click(function (e) { |
| 1077 |
e.preventDefault(); |
| 1078 |
$("#move_hold_biblio_confirm").prop("disabled", true); |
| 1079 |
if ($(".holds_table .select_hold:checked").length) { |
| 1080 |
$("#biblioResultMessage").empty(); |
| 1081 |
$("#move_hold_biblio_selection table tbody").empty(); |
| 1082 |
$("#moveHoldBiblioModal").modal("show"); |
| 1083 |
$(".select_hold:checked").each(function () { |
| 1084 |
let reserve_id = $(this).data("id"); |
| 1085 |
let reserve_biblionumber = $(this).data("biblionumber"); |
| 1086 |
let reserve_itemnumber = $(this).data("itemnumber"); |
| 1087 |
let item_level_hold = $(this).data("item_level_hold"); |
| 1088 |
let item_status = $(this).data("status"); |
| 1089 |
let item_waiting = $(this).data("waiting"); |
| 1090 |
let item_intransit = $(this).data("intransit"); |
| 1091 |
let error_message = $(this).data("item_level_hold") |
| 1092 |
? __( |
| 1093 |
"Cannot move a waiting, in transit, or item level hold" |
| 1094 |
) |
| 1095 |
: ""; |
| 1096 |
let found_status = $(this).data("found"); |
| 1097 |
if (!item_level_hold && (!item_waiting || !item_intransit)) { |
| 1098 |
$("#move_hold_biblio_selection table").append( |
| 1099 |
`<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>` |
| 1100 |
); |
| 1101 |
} else { |
| 1102 |
$("#move_hold_biblio_selection table").append( |
| 1103 |
`<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>` |
| 1104 |
); |
| 1105 |
} |
| 1106 |
}); |
| 1107 |
} |
| 1108 |
}); |
| 1109 |
|
| 1022 |
function _append_patron_page_cancel_hold_modal_data(hold) { |
1110 |
function _append_patron_page_cancel_hold_modal_data(hold) { |
| 1023 |
$("#cancel_modal_form #inputs").append( |
1111 |
$("#cancel_modal_form #inputs").append( |
| 1024 |
'<input type="hidden" name="rank-request" value="del">' |
1112 |
'<input type="hidden" name="rank-request" value="del">' |
| 1025 |
- |
|
|