Lines 463-469
Link Here
|
463 |
<script> |
463 |
<script> |
464 |
// <![CDATA[ |
464 |
// <![CDATA[ |
465 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
465 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
466 |
var MSG_MAX_HOLDS_EXCEEDED = _("Maximum number of reserve exceded."); |
466 |
var MSG_MAX_HOLDS_EXCEEDED = _("Maximum number of reserves for this record reached."); |
|
|
467 |
var MSG_EXCEEDED_HOLDS_PER_DAY = _("Maximum number of reserves allowed today reached."); |
468 |
var MSG_EXCEEDED_MAXRESERVES_SYSPREF = _("Maximum number of holds allowed at once reached"); |
467 |
|
469 |
|
468 |
// Clear the contents of an input field |
470 |
// Clear the contents of an input field |
469 |
$(".clearfield").on("click",function(e){ |
471 |
$(".clearfield").on("click",function(e){ |
Lines 475-494
Link Here
|
475 |
function select_first_available(id){ |
477 |
function select_first_available(id){ |
476 |
var checkboxes = $("input:checkbox[name='checkitem_" + id + "']"); |
478 |
var checkboxes = $("input:checkbox[name='checkitem_" + id + "']"); |
477 |
$(checkboxes).first().attr("checked", "checked"); |
479 |
$(checkboxes).first().attr("checked", "checked"); |
478 |
|
|
|
479 |
var nbCheked = 1; |
480 |
var remaining = $("input[id='remaining_holds_"+id+"']").val(); |
481 |
var remaining_holds_today = $("input[id='remaining_holds_allowed_today"+id+"']").val(); |
482 |
var maxreserves = "[% maxreserves | html %]"; |
483 |
if (nbCheked == remaining) { |
484 |
$("input[name='checkitem_"+id+"']:not(:checked)").attr('disabled', 'disabled'); |
485 |
} |
486 |
else if (nbCheked == remaining_holds_today) { |
487 |
$("input[name='checkitem_"+id+"']:not(:checked)").attr('disabled', 'disabled'); |
488 |
} |
489 |
else if (nbCheked == maxreserves) { |
490 |
$("input[name='checkitem_"+id+"']:not(:checked)").attr('disabled', 'disabled'); |
491 |
} |
492 |
} |
480 |
} |
493 |
|
481 |
|
494 |
$(document).ready(function() { |
482 |
$(document).ready(function() { |
Lines 516-527
Link Here
|
516 |
var remaining_holds_today = $("input[id='remaining_holds_allowed_today"+bibNum+"']").val(); |
504 |
var remaining_holds_today = $("input[id='remaining_holds_allowed_today"+bibNum+"']").val(); |
517 |
var maxreserves = "[% maxreserves | html %]"; |
505 |
var maxreserves = "[% maxreserves | html %]"; |
518 |
if (nbCheked >= remaining) { |
506 |
if (nbCheked >= remaining) { |
|
|
507 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
519 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
508 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
520 |
} |
509 |
} |
521 |
else if (nbCheked >= remaining_holds_today) { |
510 |
else if (nbCheked >= remaining_holds_today) { |
|
|
511 |
alert(MSG_EXCEEDED_HOLDS_PER_DAY); |
522 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
512 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
523 |
} |
513 |
} |
524 |
else if (nbCheked >= maxreserves) { |
514 |
else if (nbCheked >= maxreserves) { |
|
|
515 |
alert(MSG_EXCEEDED_MAXRESERVES_SYSPREF); |
525 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
516 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
526 |
} |
517 |
} |
527 |
else { |
518 |
else { |
Lines 584-589
Link Here
|
584 |
if ( $(checkbox).is(":checked") && select_specific ) { |
575 |
if ( $(checkbox).is(":checked") && select_specific ) { |
585 |
$(newCopiesRowId).show(); |
576 |
$(newCopiesRowId).show(); |
586 |
$(holdsToPlaceCountId).hide(); |
577 |
$(holdsToPlaceCountId).hide(); |
|
|
578 |
|
579 |
//Check if maximum holds is reached and if it has then disable un-checked item checkboxes and display message |
580 |
var nbCheked = 1; |
581 |
var remaining = $("input[id='remaining_holds_"+biblioNum+"']").val(); |
582 |
var remaining_holds_today = $("input[id='remaining_holds_allowed_today"+biblioNum+"']").val(); |
583 |
var maxreserves = "[% maxreserves | html %]"; |
584 |
if (nbCheked == remaining) { |
585 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
586 |
$("input[name='checkitem_"+biblioNum+"']:not(:checked)").attr('disabled', 'disabled'); |
587 |
} |
588 |
else if (nbCheked == remaining_holds_today) { |
589 |
alert(MSG_EXCEEDED_HOLDS_PER_DAY); |
590 |
$("input[name='checkitem_"+biblioNum+"']:not(:checked)").attr('disabled', 'disabled'); |
591 |
} |
592 |
else if (nbCheked == maxreserves) { |
593 |
alert(MSG_EXCEEDED_MAXRESERVES_SYSPREF); |
594 |
$("input[name='checkitem_"+biblioNum+"']:not(:checked)").attr('disabled', 'disabled'); |
595 |
} |
596 |
|
587 |
} else { |
597 |
} else { |
588 |
$(newCopiesRowId).hide(); |
598 |
$(newCopiesRowId).hide(); |
589 |
$(holdsToPlaceCountId).show(); |
599 |
$(holdsToPlaceCountId).show(); |