Lines 729-734
$(document).ready(function () {
Link Here
|
729 |
}); |
729 |
}); |
730 |
|
730 |
|
731 |
var MSG_CANCEL_SELECTED = __("Cancel selected (%s)"); |
731 |
var MSG_CANCEL_SELECTED = __("Cancel selected (%s)"); |
|
|
732 |
var MSG_MOVE_SELECTED = __("Move selected (%s)"); |
732 |
var MSG_CANCEL_ALERT = __( |
733 |
var MSG_CANCEL_ALERT = __( |
733 |
"This action will cancel <span class='badge bg-danger'>%s</span> hold(s)." |
734 |
"This action will cancel <span class='badge bg-danger'>%s</span> hold(s)." |
734 |
); |
735 |
); |
Lines 794-799
$(document).ready(function () {
Link Here
|
794 |
$(".holds_table .select_hold:checked").length |
795 |
$(".holds_table .select_hold:checked").length |
795 |
) |
796 |
) |
796 |
); |
797 |
); |
|
|
798 |
$(".move_selected_holds").html( |
799 |
MSG_MOVE_SELECTED.format( |
800 |
$(".holds_table .select_hold:checked").length |
801 |
) |
802 |
); |
797 |
$(".suspend_selected_holds").html( |
803 |
$(".suspend_selected_holds").html( |
798 |
MSG_SUSPEND_SELECTED.format( |
804 |
MSG_SUSPEND_SELECTED.format( |
799 |
$(".holds_table .select_hold:checked").length |
805 |
$(".holds_table .select_hold:checked").length |
Lines 833-843
$(document).ready(function () {
Link Here
|
833 |
) |
839 |
) |
834 |
.join(",") + |
840 |
.join(",") + |
835 |
"]"; |
841 |
"]"; |
|
|
842 |
$(".move_selected_holds").prop("disabled", count); |
836 |
}); |
843 |
}); |
837 |
|
844 |
|
838 |
$(".holds_table").on("click", ".select_hold", function () { |
845 |
$(".holds_table").on("click", ".select_hold", function () { |
839 |
var table = $(this).parents(".holds_table"); |
846 |
var table = $(this).parents(".holds_table"); |
840 |
var count = $(".select_hold:not(:checked)", table).length; |
847 |
var count = $(".select_hold:not(:checked)", table).length; |
|
|
848 |
var checked_count = $(".select_hold:checked", table).length; |
841 |
$(".select_hold_all", table).prop("checked", !count); |
849 |
$(".select_hold_all", table).prop("checked", !count); |
842 |
updateSelectedHoldsButtonCounters(); |
850 |
updateSelectedHoldsButtonCounters(); |
843 |
$("#cancel_hold_alert").html( |
851 |
$("#cancel_hold_alert").html( |
Lines 859-864
$(document).ready(function () {
Link Here
|
859 |
) |
867 |
) |
860 |
.join(",") + |
868 |
.join(",") + |
861 |
"]"; |
869 |
"]"; |
|
|
870 |
$(".move_selected_holds").prop("disabled", !checked_count); |
862 |
}); |
871 |
}); |
863 |
|
872 |
|
864 |
$(".cancel_selected_holds").click(function (e) { |
873 |
$(".cancel_selected_holds").click(function (e) { |
Lines 911-916
$(document).ready(function () {
Link Here
|
911 |
return false; |
920 |
return false; |
912 |
}); |
921 |
}); |
913 |
|
922 |
|
|
|
923 |
$("#itemSearchForm").on("submit", function (event) { |
924 |
event.preventDefault(); |
925 |
$("#move_hold_item_confirm").prop("disabled", true); |
926 |
|
927 |
let externalID = $("#external_id").val(); |
928 |
let apiUrl = `/api/v1/items?external_id=${encodeURIComponent(externalID)}`; |
929 |
|
930 |
$.ajax({ |
931 |
url: apiUrl, |
932 |
method: "GET", |
933 |
dataType: "json", |
934 |
success: function (data) { |
935 |
// Filter for exact matches only |
936 |
let exactMatches = data.filter( |
937 |
item => item.external_id === externalID |
938 |
); |
939 |
if (exactMatches.length > 0) { |
940 |
let resultHtml = ""; |
941 |
$.each(exactMatches, function (index, item) { |
942 |
resultHtml += ` |
943 |
<div class="alert alert-success"> |
944 |
<strong>Biblionumber:</strong> ${item.biblio_id} <br> |
945 |
<strong>Item:</strong> ${item.external_id} <br> |
946 |
<input id="new_itemnumber_${item.item_id}" name="new_itemnumber" type="checkbox" value="${item.item_id}"> |
947 |
<label for="new_itemnumber_${item.item_id}">Move all selected item level holds to this item</label> |
948 |
<input id="new_biblionumber_${item.item_id}" name="new_biblionumber" type="hidden" value="${item.biblio_id}"> |
949 |
</div> |
950 |
<hr /> |
951 |
`; |
952 |
}); |
953 |
$("#itemResultMessage").html(resultHtml); |
954 |
} else { |
955 |
$("#itemResultMessage").html(` |
956 |
<div class="alert alert-warning">No item found with barcode: ${externalID}.</div> |
957 |
`); |
958 |
} |
959 |
}, |
960 |
}); |
961 |
}); |
962 |
|
963 |
$("#biblioSearchForm").on("submit", function (event) { |
964 |
event.preventDefault(); |
965 |
$("#move_hold_biblio_confirm").prop("disabled", true); |
966 |
|
967 |
let biblioID = parseInt($("#biblio_id").val()); |
968 |
let apiUrl = `/api/v1/biblios?q={"biblio_id":"${encodeURIComponent(biblioID)}"}`; |
969 |
$.ajax({ |
970 |
url: apiUrl, |
971 |
method: "GET", |
972 |
dataType: "json", |
973 |
headers: { |
974 |
Accept: "application/json", |
975 |
}, |
976 |
success: function (data) { |
977 |
// Filter for exact matches only |
978 |
let exactMatches = data.filter( |
979 |
item => item.biblio_id === biblioID |
980 |
); |
981 |
|
982 |
if (exactMatches.length > 0) { |
983 |
let resultHtml = ""; |
984 |
$.each(exactMatches, function (index, item) { |
985 |
resultHtml += ` |
986 |
<div class="alert alert-success"> |
987 |
<strong>Biblionumber:</strong> ${item.biblio_id} <br> |
988 |
<input id="new_biblionumber_${item.biblio_id}" name="new_biblionumber" type="checkbox" value="${item.biblio_id}"> |
989 |
<label for="new_biblionumber_${item.biblio_id}">Move all selected record level holds to this record</label> |
990 |
</div> |
991 |
<hr /> |
992 |
`; |
993 |
}); |
994 |
$("#biblioResultMessage").html(resultHtml); |
995 |
} else { |
996 |
$("#biblioResultMessage").html(` |
997 |
<div class="alert alert-warning">No record found with biblionumber: ${biblioID}.</div> |
998 |
`); |
999 |
} |
1000 |
}, |
1001 |
}); |
1002 |
}); |
1003 |
|
1004 |
$(document).on("change", 'input[name="new_itemnumber"]', function () { |
1005 |
$('input[name="new_itemnumber"]').not(this).prop("checked", false); |
1006 |
if ($('input[name="new_itemnumber"]:checked').length) { |
1007 |
$("#move_hold_item_confirm").prop("disabled", false); |
1008 |
} else { |
1009 |
$("#move_hold_item_confirm").prop("disabled", true); |
1010 |
} |
1011 |
}); |
1012 |
|
1013 |
$(document).on("change", 'input[name="new_biblionumber"]', function () { |
1014 |
$('input[name="new_biblionumber"]').not(this).prop("checked", false); |
1015 |
if ($('input[name="new_biblionumber"]:checked').length) { |
1016 |
$("#move_hold_biblio_confirm").prop("disabled", false); |
1017 |
} else { |
1018 |
$("#move_hold_biblio_confirm").prop("disabled", true); |
1019 |
} |
1020 |
}); |
1021 |
|
914 |
function _append_patron_page_cancel_hold_modal_data(hold) { |
1022 |
function _append_patron_page_cancel_hold_modal_data(hold) { |
915 |
$("#cancel_modal_form #inputs").append( |
1023 |
$("#cancel_modal_form #inputs").append( |
916 |
'<input type="hidden" name="rank-request" value="del">' |
1024 |
'<input type="hidden" name="rank-request" value="del">' |
917 |
- |
|
|