Lines 342-353
Link Here
|
342 |
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %] |
342 |
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %] |
343 |
[% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %] |
343 |
[% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %] |
344 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %] |
344 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %] |
345 |
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort"> </th>[% END %] |
345 |
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort noExport"> </th>[% END %] |
346 |
</tr> |
346 |
</tr> |
347 |
</thead> |
347 |
</thead> |
348 |
<tbody> |
348 |
<tbody> |
349 |
[% FOREACH item IN items %] |
349 |
[% FOREACH item IN items %] |
350 |
<tr> |
350 |
<tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]"> |
351 |
[% IF (StaffDetailItemSelection) %] |
351 |
[% IF (StaffDetailItemSelection) %] |
352 |
<td style="text-align:center;vertical-align:middle"> |
352 |
<td style="text-align:center;vertical-align:middle"> |
353 |
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" /> |
353 |
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" /> |
Lines 509-514
Note that permanent location is a code, and location may be an authval.
Link Here
|
509 |
<span class="restricted">([% item.restrictedvalue | html %])</span> |
509 |
<span class="restricted">([% item.restrictedvalue | html %])</span> |
510 |
[% END %] |
510 |
[% END %] |
511 |
|
511 |
|
|
|
512 |
[% IF ( item.bundle_host ) %] |
513 |
<span class="bundled">In bundle: [% INCLUDE 'biblio-title.inc' biblio = item.bundle_host.biblio link = 1 %]</span> |
514 |
[% END %] |
515 |
|
512 |
</td> |
516 |
</td> |
513 |
<td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> |
517 |
<td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> |
514 |
<td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td> |
518 |
<td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td> |
Lines 593-598
Note that permanent location is a code, and location may be an authval.
Link Here
|
593 |
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]#edititem"><i class="fa fa-pencil"></i> Edit</a> |
597 |
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]#edititem"><i class="fa fa-pencil"></i> Edit</a> |
594 |
[% END %] |
598 |
[% END %] |
595 |
[% END %] |
599 |
[% END %] |
|
|
600 |
[% IF collection %] |
601 |
<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> Manage bundle</button> |
602 |
[% END %] |
596 |
</td> |
603 |
</td> |
597 |
[% END %] |
604 |
[% END %] |
598 |
</tr> |
605 |
</tr> |
Lines 1020-1025
Note that permanent location is a code, and location may be an authval.
Link Here
|
1020 |
|
1027 |
|
1021 |
[% END %] |
1028 |
[% END %] |
1022 |
|
1029 |
|
|
|
1030 |
<div class="modal" id="bundleItemsModal" tabindex="-1" role="dialog" aria-labelledby="bundleItemsLabel"> |
1031 |
<form id="bundleItemsForm" action=""> |
1032 |
<div class="modal-dialog" role="document"> |
1033 |
<div class="modal-content"> |
1034 |
<div class="modal-header"> |
1035 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1036 |
<h3 id="bundleItemsLabel">Add to bundle</h3> |
1037 |
</div> |
1038 |
<div class="modal-body"> |
1039 |
<div id="result"></div> |
1040 |
<fieldset class="rows"> |
1041 |
<ol> |
1042 |
<li> |
1043 |
<label class="required" for="external_id">Item barcode: </label> |
1044 |
<input type="text" id="external_id" name="external_id" required="required"> |
1045 |
<span class="required">Required</span> |
1046 |
</li> |
1047 |
</ol> |
1048 |
</fieldset> |
1049 |
</div> |
1050 |
<div class="modal-footer"> |
1051 |
<button type="submit" class="btn btn-default">Submit</button> |
1052 |
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> |
1053 |
</div> |
1054 |
</div> |
1055 |
</div> |
1056 |
</form> |
1057 |
</div> |
1058 |
|
1023 |
[% MACRO jsinclude BLOCK %] |
1059 |
[% MACRO jsinclude BLOCK %] |
1024 |
[% INCLUDE 'catalog-strings.inc' %] |
1060 |
[% INCLUDE 'catalog-strings.inc' %] |
1025 |
[% Asset.js("js/catalog.js") | $raw %] |
1061 |
[% Asset.js("js/catalog.js") | $raw %] |
Lines 1315-1320
Note that permanent location is a code, and location may be an authval.
Link Here
|
1315 |
[% INCLUDE 'datatables.inc' %] |
1351 |
[% INCLUDE 'datatables.inc' %] |
1316 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
1352 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
1317 |
[% INCLUDE 'columns_settings.inc' %] |
1353 |
[% INCLUDE 'columns_settings.inc' %] |
|
|
1354 |
[% INCLUDE 'js-date-format.inc' %] |
1318 |
[% Asset.js("js/browser.js") | $raw %] |
1355 |
[% Asset.js("js/browser.js") | $raw %] |
1319 |
[% Asset.js("js/table_filters.js") | $raw %] |
1356 |
[% Asset.js("js/table_filters.js") | $raw %] |
1320 |
<script> |
1357 |
<script> |
Lines 1323-1328
Note that permanent location is a code, and location may be an authval.
Link Here
|
1323 |
browser.show(); |
1360 |
browser.show(); |
1324 |
|
1361 |
|
1325 |
$(document).ready(function() { |
1362 |
$(document).ready(function() { |
|
|
1363 |
|
1364 |
function createChild ( row, itemnumber ) { |
1365 |
|
1366 |
// Toolbar |
1367 |
var bundle_toolbar = $('<div id="toolbar" class="btn-toolbar"><a class="btn btn-default" data-toggle="modal" data-target="#bundleItemsModal" data-item="' + itemnumber + '"><i class="fa fa-plus"></i> Add to bundle</a></div>'); |
1368 |
|
1369 |
// This is the table we'll convert into a DataTable |
1370 |
var bundles_table = $('<table class="display tbundle" data-itemnumber="'+itemnumber+'" id="bundle_table_'+itemnumber+'" width="100%"/>'); |
1371 |
|
1372 |
// Display it the child row |
1373 |
row.child( bundle_toolbar.add(bundles_table) ).show(); |
1374 |
|
1375 |
// Initialise as a DataTable |
1376 |
var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?"; |
1377 |
var bundle_table = bundles_table.api({ |
1378 |
"ajax": { |
1379 |
"url": bundle_table_url |
1380 |
}, |
1381 |
"header_filter": false, |
1382 |
"embed": [ |
1383 |
"biblio" |
1384 |
], |
1385 |
"order": [[ 1, "asc" ]], |
1386 |
"columns": [ |
1387 |
{ |
1388 |
"data": "biblio.title:biblio.medium", |
1389 |
"title": "Title", |
1390 |
"searchable": true, |
1391 |
"orderable": true, |
1392 |
"render": function(data, type, row, meta) { |
1393 |
var title = ""; |
1394 |
if ( row.biblio.title ) { |
1395 |
title = title.concat('<span class="biblio-title">',row.biblio.title,'</span>'); |
1396 |
} |
1397 |
if ( row.biblio.medium ) { |
1398 |
title = title.concat('<span class="biblio-medium">',row.biblio.medium,'</span>'); |
1399 |
} |
1400 |
return title; |
1401 |
} |
1402 |
}, |
1403 |
{ |
1404 |
"data": "biblio.author", |
1405 |
"title": "Author", |
1406 |
"searchable": true, |
1407 |
"orderable": true, |
1408 |
}, |
1409 |
{ |
1410 |
"data": "collection_code", |
1411 |
"title": "Collection code", |
1412 |
"searchable": true, |
1413 |
"orderable": true, |
1414 |
}, |
1415 |
{ |
1416 |
"data": "item_type", |
1417 |
"title": "Item Type", |
1418 |
"searchable": false, |
1419 |
"orderable": true, |
1420 |
}, |
1421 |
{ |
1422 |
"data": "callnumber", |
1423 |
"title": "Callnumber", |
1424 |
"searchable": true, |
1425 |
"orderable": true, |
1426 |
}, |
1427 |
{ |
1428 |
"data": "external_id", |
1429 |
"title": "Barcode", |
1430 |
"searchable": true, |
1431 |
"orderable": true, |
1432 |
}, |
1433 |
{ |
1434 |
"data": "lost_status:last_seen_date", |
1435 |
"title": "Status", |
1436 |
"searchable": false, |
1437 |
"orderable": true, |
1438 |
"render": function(data, type, row, meta) { |
1439 |
if ( row.lost_status ) { |
1440 |
return "Lost: " + row.lost_status; |
1441 |
} |
1442 |
return ""; |
1443 |
} |
1444 |
}, |
1445 |
{ |
1446 |
"data": function( row, type, val, meta ) { |
1447 |
var result = '<button class="btn btn-default btn-xs remove" role="button" data-itemnumber="'+row.item_id+'"><i class="fa fa-minus" aria-hidden="true"></i> '+_("Remove")+'</button>\n'; |
1448 |
return result; |
1449 |
}, |
1450 |
"title": "Actions", |
1451 |
"searchable": false, |
1452 |
"orderable": false, |
1453 |
"class": "noExport" |
1454 |
} |
1455 |
] |
1456 |
}, [], 1); |
1457 |
|
1458 |
$(".tbundle").on("click", ".remove", function(){ |
1459 |
var bundle_table = $(this).closest('table'); |
1460 |
var host_itemnumber = bundle_table.data('itemnumber'); |
1461 |
var component_itemnumber = $(this).data('itemnumber'); |
1462 |
var unlink_item_url = "/api/v1/items/" + host_itemnumber + "/bundled_items/item/" + component_itemnumber; |
1463 |
$.ajax({ |
1464 |
type: "DELETE", |
1465 |
url: unlink_item_url, |
1466 |
success: function(){ |
1467 |
bundle_table.DataTable({ 'retrieve': true }).draw(false); |
1468 |
} |
1469 |
}); |
1470 |
}); |
1471 |
|
1472 |
return; |
1473 |
} |
1474 |
|
1475 |
|
1326 |
var ids = ['holdings_table', 'otherholdings_table']; |
1476 |
var ids = ['holdings_table', 'otherholdings_table']; |
1327 |
var columns_settings = [ [% TablesSettings.GetColumns('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetColumns('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; |
1477 |
var columns_settings = [ [% TablesSettings.GetColumns('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetColumns('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; |
1328 |
var has_images = ["[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]"]; |
1478 |
var has_images = ["[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]"]; |
Lines 1339-1344
Note that permanent location is a code, and location may be an authval.
Link Here
|
1339 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
1489 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
1340 |
}; |
1490 |
}; |
1341 |
var table = KohaTable(id, dt_parameters, columns_settings[i], 'with_filters'); |
1491 |
var table = KohaTable(id, dt_parameters, columns_settings[i], 'with_filters'); |
|
|
1492 |
|
1493 |
// Add event listener for opening and closing details |
1494 |
$('#' + id + ' tbody').on('click', 'button.details-control', function () { |
1495 |
var tr = $(this).closest('tr'); |
1496 |
var dTable = $(this).closest('table').DataTable({ 'retrieve': true }); |
1497 |
|
1498 |
var itemnumber = tr.data('itemnumber'); |
1499 |
var row = dTable.row( tr ); |
1500 |
|
1501 |
if ( row.child.isShown() ) { |
1502 |
// This row is already open - close it |
1503 |
row.child.hide(); |
1504 |
tr.removeClass('shown'); |
1505 |
} |
1506 |
else { |
1507 |
// Open this row |
1508 |
createChild(row, itemnumber); |
1509 |
tr.addClass('shown'); |
1510 |
} |
1511 |
} ); |
1342 |
} |
1512 |
} |
1343 |
|
1513 |
|
1344 |
[% IF Koha.Preference('AcquisitionDetails') %] |
1514 |
[% IF Koha.Preference('AcquisitionDetails') %] |
Lines 1360-1365
Note that permanent location is a code, and location may be an authval.
Link Here
|
1360 |
"sPaginationType": "full" |
1530 |
"sPaginationType": "full" |
1361 |
})); |
1531 |
})); |
1362 |
[% END %] |
1532 |
[% END %] |
|
|
1533 |
|
1534 |
var bundle_changed; |
1535 |
var bundle_form_active; |
1536 |
$("#bundleItemsModal").on("shown.bs.modal", function(e){ |
1537 |
var button = $(e.relatedTarget); |
1538 |
var item_id = button.data('item'); |
1539 |
$("#result").replaceWith('<div id="result"></div>'); |
1540 |
$("#bundleItemsForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items/item'); |
1541 |
$("#external_id").focus(); |
1542 |
bundle_changed = 0; |
1543 |
bundle_form_active = item_id; |
1544 |
}); |
1545 |
|
1546 |
$("#bundleItemsForm").submit(function(event) { |
1547 |
|
1548 |
/* stop form from submitting normally */ |
1549 |
event.preventDefault(); |
1550 |
|
1551 |
/* get the action attribute from the <form action=""> element */ |
1552 |
var $form = $(this), |
1553 |
url = $form.attr('action'); |
1554 |
|
1555 |
/* Send the data using post with external_id */ |
1556 |
var posting = $.post(url, JSON.stringify({ |
1557 |
external_id: $('#external_id').val() |
1558 |
}), null, "json"); |
1559 |
|
1560 |
/* Report the results */ |
1561 |
posting.done(function(data) { |
1562 |
var barcode = $('#external_id').val(); |
1563 |
$('#result').replaceWith('<div id="result" class="alert alert-success">Success: Added '+barcode+'</div>'); |
1564 |
$('#external_id').val('').focus(); |
1565 |
bundle_changed = 1; |
1566 |
}); |
1567 |
posting.fail(function(data) { |
1568 |
var barcode = $('#external_id').val(); |
1569 |
if ( data.status === 409 ) { |
1570 |
var response = data.responseJSON; |
1571 |
if ( response.key === "PRIMARY" ) { |
1572 |
$('#result').replaceWith('<div id="result" class="alert alert-warning">Warning: Item '+barcode+' already attached</div>'); |
1573 |
} else { |
1574 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure: Item '+barcode+' belongs to another bundle</div>'); |
1575 |
} |
1576 |
} else { |
1577 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure</div>'); |
1578 |
} |
1579 |
$('#external_id').val('').focus(); |
1580 |
}); |
1581 |
}); |
1582 |
|
1583 |
$("#bundleItemsModal").on("hidden.bs.modal", function(e){ |
1584 |
if ( bundle_changed ) { |
1585 |
$('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload(); |
1586 |
} |
1587 |
bundle_form_active = 0; |
1588 |
bundle_changed = 0; |
1589 |
}); |
1363 |
}); |
1590 |
}); |
1364 |
|
1591 |
|
1365 |
$(document).ready(function() { |
1592 |
$(document).ready(function() { |
1366 |
- |
|
|