|
Lines 375-380
Link Here
|
| 375 |
</div> |
375 |
</div> |
| 376 |
[% END %] |
376 |
[% END %] |
| 377 |
|
377 |
|
|
|
378 |
<div class="dialog alert hide holdalert"> |
| 379 |
</div> |
| 380 |
|
| 378 |
<fieldset class="rows"> |
381 |
<fieldset class="rows"> |
| 379 |
<legend>Hold details</legend> |
382 |
<legend>Hold details</legend> |
| 380 |
<form action="/api/v1/holds" method="post" name="form" id="hold-request-form"> |
383 |
<form action="/api/v1/holds" method="post" name="form" id="hold-request-form"> |
|
Lines 443-448
Link Here
|
| 443 |
<li> |
446 |
<li> |
| 444 |
<label for="from">Hold starts on date:</label> |
447 |
<label for="from">Hold starts on date:</label> |
| 445 |
<input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" > |
448 |
<input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" > |
|
|
449 |
<input type="hidden" class="datepickerfrom_hidden" /> |
| 446 |
<a href="#" id="clear-date-from" class="clear-date">Clear date</a> |
450 |
<a href="#" id="clear-date-from" class="clear-date">Clear date</a> |
| 447 |
</li> |
451 |
</li> |
| 448 |
[% END %] |
452 |
[% END %] |
|
Lines 450-455
Link Here
|
| 450 |
<li> |
454 |
<li> |
| 451 |
<label for="to">Hold expires on date:</label> |
455 |
<label for="to">Hold expires on date:</label> |
| 452 |
<input name="expiration_date" id="to" size="10" class="datepickerto" type="text" /> |
456 |
<input name="expiration_date" id="to" size="10" class="datepickerto" type="text" /> |
|
|
457 |
<input type="hidden" class="datepickerto_hidden" /> |
| 453 |
<a href="#" id="clear-date-to" class="clear-date">Clear date</a> |
458 |
<a href="#" id="clear-date-to" class="clear-date">Clear date</a> |
| 454 |
</li> |
459 |
</li> |
| 455 |
|
460 |
|
|
Lines 977-982
Link Here
|
| 977 |
$(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1); |
982 |
$(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1); |
| 978 |
[% END %] |
983 |
[% END %] |
| 979 |
|
984 |
|
|
|
985 |
$(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden"); |
| 986 |
$(".datepickerto").datepicker("option", "altFormat", "yy-mm-dd"); |
| 987 |
|
| 988 |
$(".datepickerfrom").datepicker("option", "altField", ".datepickerfrom_hidden"); |
| 989 |
$(".datepickerfrom").datepicker("option", "altFormat", "yy-mm-dd"); |
| 990 |
|
| 980 |
var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, { |
991 |
var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 981 |
'bPaginate': false, |
992 |
'bPaginate': false, |
| 982 |
"sDom": '<"top pager"ilf>t', |
993 |
"sDom": '<"top pager"ilf>t', |
|
Lines 992-1019
Link Here
|
| 992 |
"margin-right":"0em" |
1003 |
"margin-right":"0em" |
| 993 |
}); |
1004 |
}); |
| 994 |
|
1005 |
|
| 995 |
$("#club-request-form").on("submit", function() { |
1006 |
$("#club-request-form, #hold-request-form").on("submit", function() { |
| 996 |
let $t = $(this); |
1007 |
let $t = $(this); |
| 997 |
$('.clubalert').addClass('hide'); |
1008 |
$('.clubalert').addClass('hide'); |
| 998 |
let options = { |
1009 |
let biblionumbers = [biblionumber]; |
| 999 |
url: $t.attr('action'), |
1010 |
let biblionumbers_text; |
| 1000 |
method: $t.attr('method').toUpperCase(), |
1011 |
const data = { |
| 1001 |
contentType: 'application/json', |
1012 |
pickup_library_id: $('select[name="pickup"]').val() |
| 1002 |
data: JSON.stringify({ |
|
|
| 1003 |
biblio_id: biblionumber, |
| 1004 |
pickup_library_id: $('select[name="pickup"]').val() |
| 1005 |
}) |
| 1006 |
}; |
1013 |
}; |
| 1007 |
if($('input[name="checkitem"]:checked').length) |
1014 |
if($('input[name="checkitem"]:checked').length) |
| 1008 |
options.data.item_id = $('input[name="checkitem"]:checked').val(); |
1015 |
data.item_id = $('input[name="checkitem"]:checked').val(); |
| 1009 |
$.ajax(options) |
1016 |
if($('input[name="borrowernumber"]').length) |
| 1010 |
.then(function(result) { |
1017 |
data.patron_id = $('input[name="borrowernumber"]').val(); |
| 1011 |
let url = 'request.pl?biblionumber='+biblionumber+($('input[name="multi_hold"]').length && $('input[name="multi_hold"]').val()?'&multi_hold=1':''); |
1018 |
if($('textarea[name="notes"]').length) |
| 1012 |
document.location = url; |
1019 |
data.notes = $('textarea[name="notes"]').val()||null; |
| 1013 |
}) |
1020 |
if($('.datepickerto_hidden').length) |
| 1014 |
.fail(function(err) { |
1021 |
data.expiration_date = $('.datepickerto_hidden').val()||null; |
| 1015 |
$('.clubalert').removeClass('hide').html(err.responseJSON.error); |
1022 |
if($('.datepickerfrom_hidden').length) |
| 1016 |
}); |
1023 |
data.hold_date = $('.datepickerfrom_hidden').val()||null; |
|
|
1024 |
if($('input[name="itemtype"]').length) { |
| 1025 |
data.item_type = $('input[name="itemtype"]').val()||null; |
| 1026 |
} |
| 1027 |
if($('input[name="biblionumbers"]').length) { |
| 1028 |
biblionumbers_text = $('input[name="biblionumbers"]').val(); |
| 1029 |
biblionumbers = biblionumbers_text.replace(/\/$/, '').split('/') |
| 1030 |
} |
| 1031 |
|
| 1032 |
const count = $('input[name="holds_to_place_count"]').length?$('input[name="holds_to_place_count"]').val():1; |
| 1033 |
biblionumbers.forEach(function(biblionumber) { |
| 1034 |
data.biblio_id = biblionumber; |
| 1035 |
let options = { |
| 1036 |
url: $t.attr('action'), |
| 1037 |
method: $t.attr('method').toUpperCase(), |
| 1038 |
contentType: 'application/json', |
| 1039 |
data: JSON.stringify(data) |
| 1040 |
}; |
| 1041 |
for(let i = 0; i < count; i++) { |
| 1042 |
$.ajax(options) |
| 1043 |
.then(function(result) { |
| 1044 |
let url = 'request.pl?biblionumber='+biblionumber; |
| 1045 |
if(biblionumbers_text) { |
| 1046 |
url = 'request.pl?biblionumbers='+biblionumbers_text+'&multi_hold=1'; |
| 1047 |
} |
| 1048 |
document.location = url; |
| 1049 |
}) |
| 1050 |
.fail(function(err) { |
| 1051 |
$('.clubalert, .holdalert').removeClass('hide').html(err.responseJSON.error); |
| 1052 |
}); |
| 1053 |
} |
| 1054 |
}); |
| 1055 |
|
| 1017 |
return false; |
1056 |
return false; |
| 1018 |
}); |
1057 |
}); |
| 1019 |
|
1058 |
|
| 1020 |
- |
|
|