|
Lines 3-8
$(document).ready(function () {
Link Here
|
| 3 |
var href = $(this).attr("href"); |
3 |
var href = $(this).attr("href"); |
| 4 |
$("#hold-group-modal .modal-body").load(href + " #main"); |
4 |
$("#hold-group-modal .modal-body").load(href + " #main"); |
| 5 |
$("#hold-group-modal").modal("show"); |
5 |
$("#hold-group-modal").modal("show"); |
|
|
6 |
if (holds_table_patron_page()) { |
| 7 |
append_select_group_holds_button(); |
| 8 |
} |
| 6 |
return false; |
9 |
return false; |
| 7 |
}); |
10 |
}); |
|
|
11 |
$("body").on("click", "button#select-group-holds", function () { |
| 12 |
let group_hold_ids = $(".hold-group-entry") |
| 13 |
.map(function () { |
| 14 |
return $(this).data("hold-id"); |
| 15 |
}) |
| 16 |
.get(); |
| 17 |
|
| 18 |
$(".select_hold").each(function () { |
| 19 |
var $this = $(this); |
| 20 |
if ( |
| 21 |
group_hold_ids.includes($this.data("id")) !== |
| 22 |
$this.prop("checked") |
| 23 |
) { |
| 24 |
$this.click(); |
| 25 |
} |
| 26 |
}); |
| 27 |
}); |
| 28 |
|
| 29 |
function append_select_group_holds_button() { |
| 30 |
var button = document.createElement("button"); |
| 31 |
button.type = "button"; |
| 32 |
button.className = "btn btn-primary"; |
| 33 |
button.id = "select-group-holds"; |
| 34 |
button.dataset.bsDismiss = "modal"; |
| 35 |
button.innerHTML = _("Select group holds"); |
| 36 |
if (!$("#select-group-holds").length) { |
| 37 |
$("#hold-group-modal .modal-footer").prepend(button); |
| 38 |
} |
| 39 |
} |
| 8 |
}); |
40 |
}); |
| 9 |
- |
|
|