|
Lines 486-492
Link Here
|
| 486 |
<li> |
486 |
<li> |
| 487 |
<label for="pickup">Pickup at:</label> |
487 |
<label for="pickup">Pickup at:</label> |
| 488 |
[% UNLESS ( multi_hold ) %] |
488 |
[% UNLESS ( multi_hold ) %] |
| 489 |
<select name="pickup" id="pickup" data-biblio-id="[% biblio.biblionumber | html %]" data-patron-id="[% patron.borrowernumber | html %]"> |
489 |
<select name="pickup" id="pickup" |
|
|
490 |
data-biblio-id="[% biblio.biblionumber | html %]" |
| 491 |
data-patron-id="[% patron.borrowernumber | html %]" |
| 492 |
data-pickup-location-source="biblio"> |
| 490 |
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %] |
493 |
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %] |
| 491 |
[% ELSE %] |
494 |
[% ELSE %] |
| 492 |
<select name="pickup" id="pickup_multi" data-patron-id="[% patron.borrowernumber | html %]"> |
495 |
<select name="pickup" id="pickup_multi" data-patron-id="[% patron.borrowernumber | html %]"> |
|
Lines 763-769
Link Here
|
| 763 |
[% IF (itemloo.pickup_locations_count > 0) %] |
766 |
[% IF (itemloo.pickup_locations_count > 0) %] |
| 764 |
<select name="item_pickup_[% itemloo.itemnumber | html %]" class="pickup_locations" |
767 |
<select name="item_pickup_[% itemloo.itemnumber | html %]" class="pickup_locations" |
| 765 |
data-item-id="[% itemloo.itemnumber | html %]" |
768 |
data-item-id="[% itemloo.itemnumber | html %]" |
| 766 |
data-patron-id="[% patron.borrowernumber | html %]"> |
769 |
data-patron-id="[% patron.borrowernumber | html %]" |
|
|
770 |
data-pickup-location-source="item"> |
| 767 |
[% IF (itemloo.default_pickup_location) %] |
771 |
[% IF (itemloo.default_pickup_location) %] |
| 768 |
<option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option> |
772 |
<option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option> |
| 769 |
[% END %] |
773 |
[% END %] |
|
Lines 1292-1333
Link Here
|
| 1292 |
[% END %] |
1296 |
[% END %] |
| 1293 |
|
1297 |
|
| 1294 |
$(".pickup_location_dropdown").each( function () { |
1298 |
$(".pickup_location_dropdown").each( function () { |
| 1295 |
var this_dropdown = $(this); |
1299 |
$(this).pickup_locations_dropdown(); |
| 1296 |
var hold_id = $(this).data('hold_id'); |
|
|
| 1297 |
|
| 1298 |
this_dropdown.select2({ |
| 1299 |
allowClear: false, |
| 1300 |
ajax: { |
| 1301 |
url: '/api/v1/holds/' + encodeURIComponent(hold_id) + '/pickup_locations', |
| 1302 |
delay: 300, // wait 300 milliseconds before triggering the request |
| 1303 |
dataType: 'json', |
| 1304 |
data: function (params) { |
| 1305 |
var search_term = (params.term === undefined) ? '' : params.term; |
| 1306 |
var query = { |
| 1307 |
"q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), |
| 1308 |
"_order_by": "name", |
| 1309 |
"_page": params.page |
| 1310 |
}; |
| 1311 |
|
| 1312 |
return query; |
| 1313 |
}, |
| 1314 |
processResults: function (data, params) { |
| 1315 |
var results = []; |
| 1316 |
data.results.forEach( function ( pickup_location ) { |
| 1317 |
results.push( |
| 1318 |
{ |
| 1319 |
"id": pickup_location.library_id.escapeHtml(), |
| 1320 |
"text": pickup_location.name.escapeHtml(), |
| 1321 |
"needs_override": pickup_location.needs_override |
| 1322 |
} |
| 1323 |
); |
| 1324 |
}); |
| 1325 |
return { "results": results, "pagination": { "more": data.pagination.more } }; |
| 1326 |
}, |
| 1327 |
transport: kohaSelect2Transport |
| 1328 |
}, |
| 1329 |
templateResult: display_pickup_location |
| 1330 |
}); |
| 1331 |
}); |
1300 |
}); |
| 1332 |
|
1301 |
|
| 1333 |
$("#pickup_multi").select2({ |
1302 |
$("#pickup_multi").select2({ |
|
Lines 1354-1436
Link Here
|
| 1354 |
}); |
1323 |
}); |
| 1355 |
|
1324 |
|
| 1356 |
$("#pickup").each( function () { |
1325 |
$("#pickup").each( function () { |
| 1357 |
var this_dropdown = $(this); |
1326 |
$(this).pickup_locations_dropdown(); |
| 1358 |
var patron_id = $(this).data('patron-id'); |
|
|
| 1359 |
var biblio_id = $(this).data('biblio-id'); |
| 1360 |
|
| 1361 |
this_dropdown.select2({ |
| 1362 |
width: 'style', |
| 1363 |
allowClear: false, |
| 1364 |
ajax: { |
| 1365 |
url: '/api/v1/biblios/' + encodeURIComponent(biblio_id) + '/pickup_locations', |
| 1366 |
delay: 300, // wait 300 milliseconds before triggering the request |
| 1367 |
dataType: 'json', |
| 1368 |
data: function (params) { |
| 1369 |
var search_term = (params.term === undefined) ? '' : params.term; |
| 1370 |
var query = { |
| 1371 |
"q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), |
| 1372 |
"_order_by": "name", |
| 1373 |
"patron_id": patron_id, |
| 1374 |
"_page": params.page |
| 1375 |
}; |
| 1376 |
return query; |
| 1377 |
}, |
| 1378 |
processResults: function (data) { |
| 1379 |
var results = []; |
| 1380 |
data.results.forEach( function ( pickup_location ) { |
| 1381 |
results.push( |
| 1382 |
{ |
| 1383 |
"id": pickup_location.library_id.escapeHtml(), |
| 1384 |
"text": pickup_location.name.escapeHtml(), |
| 1385 |
"needs_override": pickup_location.needs_override |
| 1386 |
} |
| 1387 |
); |
| 1388 |
}); |
| 1389 |
return { "results": results, "pagination": { "more": data.pagination.more } }; |
| 1390 |
}, |
| 1391 |
transport: kohaSelect2Transport, |
| 1392 |
}, |
| 1393 |
templateResult: display_pickup_location |
| 1394 |
}); |
| 1395 |
}); |
1327 |
}); |
| 1396 |
$(".pickup_locations").each( function () { |
1328 |
|
| 1397 |
var this_dropdown = $(this); |
1329 |
$(".pickup_locations").each(function () { |
| 1398 |
var patron_id = $(this).data('patron-id'); |
1330 |
$(this).pickup_locations_dropdown(); |
| 1399 |
var item_id = $(this).data('item-id'); |
|
|
| 1400 |
|
| 1401 |
this_dropdown.select2({ |
| 1402 |
allowClear: true, |
| 1403 |
ajax: { |
| 1404 |
url: '/api/v1/items/' + encodeURIComponent(item_id) + '/pickup_locations', |
| 1405 |
delay: 300, // wait 300 milliseconds before triggering the request |
| 1406 |
dataType: 'json', |
| 1407 |
data: function (params) { |
| 1408 |
var search_term = (params.term === undefined) ? '' : params.term; |
| 1409 |
var query = { |
| 1410 |
"q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), |
| 1411 |
"_order_by": "name", |
| 1412 |
"patron_id": patron_id, |
| 1413 |
"_page": params.page |
| 1414 |
}; |
| 1415 |
return query; |
| 1416 |
}, |
| 1417 |
processResults: function (data) { |
| 1418 |
var results = []; |
| 1419 |
data.results.forEach( function ( pickup_location ) { |
| 1420 |
results.push( |
| 1421 |
{ |
| 1422 |
"id": pickup_location.library_id.escapeHtml(), |
| 1423 |
"text": pickup_location.name.escapeHtml(), |
| 1424 |
"needs_override": pickup_location.needs_override |
| 1425 |
} |
| 1426 |
); |
| 1427 |
}); |
| 1428 |
return { "results": results, "pagination": { "more": data.pagination.more } }; |
| 1429 |
}, |
| 1430 |
transport: kohaSelect2Transport |
| 1431 |
}, |
| 1432 |
templateResult: display_pickup_location |
| 1433 |
}); |
| 1434 |
}); |
1331 |
}); |
| 1435 |
}); |
1332 |
}); |
| 1436 |
|
1333 |
|