|
Lines 463-469
Link Here
|
| 463 |
<li> |
463 |
<li> |
| 464 |
<label for="pickup">Pickup at:</label> |
464 |
<label for="pickup">Pickup at:</label> |
| 465 |
[% UNLESS ( multi_hold ) %] |
465 |
[% UNLESS ( multi_hold ) %] |
| 466 |
<select name="pickup" id="pickup" data-biblio-id="[% biblio.biblionumber | html %]" data-patron-id="[% patron.borrowernumber | html %]"> |
466 |
<select name="pickup" id="pickup" |
|
|
467 |
data-biblio-id="[% biblio.biblionumber | html %]" |
| 468 |
data-patron-id="[% patron.borrowernumber | html %]" |
| 469 |
data-pickup-location-source="biblio"> |
| 467 |
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %] |
470 |
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %] |
| 468 |
[% ELSE %] |
471 |
[% ELSE %] |
| 469 |
<select name="pickup" id="pickup_multi" data-patron-id="[% patron.borrowernumber | html %]"> |
472 |
<select name="pickup" id="pickup_multi" data-patron-id="[% patron.borrowernumber | html %]"> |
|
Lines 740-746
Link Here
|
| 740 |
[% IF (itemloo.pickup_locations_count > 0) %] |
743 |
[% IF (itemloo.pickup_locations_count > 0) %] |
| 741 |
<select name="item_pickup_[% itemloo.itemnumber | html %]" class="pickup_locations" |
744 |
<select name="item_pickup_[% itemloo.itemnumber | html %]" class="pickup_locations" |
| 742 |
data-item-id="[% itemloo.itemnumber | html %]" |
745 |
data-item-id="[% itemloo.itemnumber | html %]" |
| 743 |
data-patron-id="[% patron.borrowernumber | html %]"> |
746 |
data-patron-id="[% patron.borrowernumber | html %]" |
|
|
747 |
data-pickup-location-source="item"> |
| 744 |
[% IF (itemloo.default_pickup_location) %] |
748 |
[% IF (itemloo.default_pickup_location) %] |
| 745 |
<option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option> |
749 |
<option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option> |
| 746 |
[% END %] |
750 |
[% END %] |
|
Lines 1233-1274
Link Here
|
| 1233 |
[% END %] |
1237 |
[% END %] |
| 1234 |
|
1238 |
|
| 1235 |
$(".pickup_location_dropdown").each( function () { |
1239 |
$(".pickup_location_dropdown").each( function () { |
| 1236 |
var this_dropdown = $(this); |
1240 |
$(this).pickup_locations_dropdown(); |
| 1237 |
var hold_id = $(this).data('hold_id'); |
|
|
| 1238 |
|
| 1239 |
this_dropdown.select2({ |
| 1240 |
allowClear: false, |
| 1241 |
ajax: { |
| 1242 |
url: '/api/v1/holds/' + encodeURIComponent(hold_id) + '/pickup_locations', |
| 1243 |
delay: 300, // wait 300 milliseconds before triggering the request |
| 1244 |
dataType: 'json', |
| 1245 |
data: function (params) { |
| 1246 |
var search_term = (params.term === undefined) ? '' : params.term; |
| 1247 |
var query = { |
| 1248 |
"q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), |
| 1249 |
"_order_by": "name", |
| 1250 |
"_page": params.page |
| 1251 |
}; |
| 1252 |
|
| 1253 |
return query; |
| 1254 |
}, |
| 1255 |
processResults: function (data, params) { |
| 1256 |
var results = []; |
| 1257 |
data.results.forEach( function ( pickup_location ) { |
| 1258 |
results.push( |
| 1259 |
{ |
| 1260 |
"id": pickup_location.library_id.escapeHtml(), |
| 1261 |
"text": pickup_location.name.escapeHtml(), |
| 1262 |
"needs_override": pickup_location.needs_override |
| 1263 |
} |
| 1264 |
); |
| 1265 |
}); |
| 1266 |
return { "results": results, "pagination": { "more": data.pagination.more } }; |
| 1267 |
}, |
| 1268 |
transport: kohaSelect2Transport |
| 1269 |
}, |
| 1270 |
templateResult: display_pickup_location |
| 1271 |
}); |
| 1272 |
}); |
1241 |
}); |
| 1273 |
|
1242 |
|
| 1274 |
$("#pickup_multi").select2({ |
1243 |
$("#pickup_multi").select2({ |
|
Lines 1295-1377
Link Here
|
| 1295 |
}); |
1264 |
}); |
| 1296 |
|
1265 |
|
| 1297 |
$("#pickup").each( function () { |
1266 |
$("#pickup").each( function () { |
| 1298 |
var this_dropdown = $(this); |
1267 |
$(this).pickup_locations_dropdown(); |
| 1299 |
var patron_id = $(this).data('patron-id'); |
|
|
| 1300 |
var biblio_id = $(this).data('biblio-id'); |
| 1301 |
|
| 1302 |
this_dropdown.select2({ |
| 1303 |
width: 'style', |
| 1304 |
allowClear: false, |
| 1305 |
ajax: { |
| 1306 |
url: '/api/v1/biblios/' + encodeURIComponent(biblio_id) + '/pickup_locations', |
| 1307 |
delay: 300, // wait 300 milliseconds before triggering the request |
| 1308 |
dataType: 'json', |
| 1309 |
data: function (params) { |
| 1310 |
var search_term = (params.term === undefined) ? '' : params.term; |
| 1311 |
var query = { |
| 1312 |
"q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), |
| 1313 |
"_order_by": "name", |
| 1314 |
"patron_id": patron_id, |
| 1315 |
"_page": params.page |
| 1316 |
}; |
| 1317 |
return query; |
| 1318 |
}, |
| 1319 |
processResults: function (data) { |
| 1320 |
var results = []; |
| 1321 |
data.results.forEach( function ( pickup_location ) { |
| 1322 |
results.push( |
| 1323 |
{ |
| 1324 |
"id": pickup_location.library_id.escapeHtml(), |
| 1325 |
"text": pickup_location.name.escapeHtml(), |
| 1326 |
"needs_override": pickup_location.needs_override |
| 1327 |
} |
| 1328 |
); |
| 1329 |
}); |
| 1330 |
return { "results": results, "pagination": { "more": data.pagination.more } }; |
| 1331 |
}, |
| 1332 |
transport: kohaSelect2Transport, |
| 1333 |
}, |
| 1334 |
templateResult: display_pickup_location |
| 1335 |
}); |
| 1336 |
}); |
1268 |
}); |
| 1337 |
$(".pickup_locations").each( function () { |
1269 |
|
| 1338 |
var this_dropdown = $(this); |
1270 |
$(".pickup_locations").each(function () { |
| 1339 |
var patron_id = $(this).data('patron-id'); |
1271 |
$(this).pickup_locations_dropdown(); |
| 1340 |
var item_id = $(this).data('item-id'); |
|
|
| 1341 |
|
| 1342 |
this_dropdown.select2({ |
| 1343 |
allowClear: true, |
| 1344 |
ajax: { |
| 1345 |
url: '/api/v1/items/' + encodeURIComponent(item_id) + '/pickup_locations', |
| 1346 |
delay: 300, // wait 300 milliseconds before triggering the request |
| 1347 |
dataType: 'json', |
| 1348 |
data: function (params) { |
| 1349 |
var search_term = (params.term === undefined) ? '' : params.term; |
| 1350 |
var query = { |
| 1351 |
"q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), |
| 1352 |
"_order_by": "name", |
| 1353 |
"patron_id": patron_id, |
| 1354 |
"_page": params.page |
| 1355 |
}; |
| 1356 |
return query; |
| 1357 |
}, |
| 1358 |
processResults: function (data) { |
| 1359 |
var results = []; |
| 1360 |
data.results.forEach( function ( pickup_location ) { |
| 1361 |
results.push( |
| 1362 |
{ |
| 1363 |
"id": pickup_location.library_id.escapeHtml(), |
| 1364 |
"text": pickup_location.name.escapeHtml(), |
| 1365 |
"needs_override": pickup_location.needs_override |
| 1366 |
} |
| 1367 |
); |
| 1368 |
}); |
| 1369 |
return { "results": results, "pagination": { "more": data.pagination.more } }; |
| 1370 |
}, |
| 1371 |
transport: kohaSelect2Transport |
| 1372 |
}, |
| 1373 |
templateResult: display_pickup_location |
| 1374 |
}); |
| 1375 |
}); |
1272 |
}); |
| 1376 |
}); |
1273 |
}); |
| 1377 |
|
1274 |
|