Lines 340-351
Link Here
|
340 |
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %] |
340 |
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %] |
341 |
[% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %] |
341 |
[% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %] |
342 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %] |
342 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %] |
343 |
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort"> </th>[% END %] |
343 |
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort noExport"> </th>[% END %] |
344 |
</tr> |
344 |
</tr> |
345 |
</thead> |
345 |
</thead> |
346 |
<tbody> |
346 |
<tbody> |
347 |
[% FOREACH item IN items %] |
347 |
[% FOREACH item IN items %] |
348 |
<tr> |
348 |
<tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]"> |
349 |
[% IF (StaffDetailItemSelection) %] |
349 |
[% IF (StaffDetailItemSelection) %] |
350 |
<td style="text-align:center;vertical-align:middle"> |
350 |
<td style="text-align:center;vertical-align:middle"> |
351 |
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" /> |
351 |
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" /> |
Lines 515-520
Note that permanent location is a code, and location may be an authval.
Link Here
|
515 |
[% IF ( item.restricted ) %] |
515 |
[% IF ( item.restricted ) %] |
516 |
<span class="restricted">([% item.restrictedvalue | html %])</span> |
516 |
<span class="restricted">([% item.restrictedvalue | html %])</span> |
517 |
[% END %] |
517 |
[% END %] |
|
|
518 |
|
519 |
[% IF ( item.bundle_host ) %] |
520 |
<span class="bundled">In bundle: [% INCLUDE 'biblio-title.inc' biblio = item.bundle_host.biblio link = 1 %]</span> |
521 |
[% END %] |
522 |
|
518 |
</td> |
523 |
</td> |
519 |
<td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> |
524 |
<td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> |
520 |
<td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td> |
525 |
<td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td> |
Lines 599-604
Note that permanent location is a code, and location may be an authval.
Link Here
|
599 |
<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> |
604 |
<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> |
600 |
[% END %] |
605 |
[% END %] |
601 |
[% END %] |
606 |
[% END %] |
|
|
607 |
[% IF bundlesEnabled %] |
608 |
<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> Manage bundle</button> |
609 |
[% END %] |
602 |
</td> |
610 |
</td> |
603 |
[% END %] |
611 |
[% END %] |
604 |
</tr> |
612 |
</tr> |
Lines 1039-1044
Note that permanent location is a code, and location may be an authval.
Link Here
|
1039 |
|
1047 |
|
1040 |
[% END %] |
1048 |
[% END %] |
1041 |
|
1049 |
|
|
|
1050 |
[% IF bundlesEnabled %] |
1051 |
<div class="modal" id="bundleItemsModal" tabindex="-1" role="dialog" aria-labelledby="bundleItemsLabel"> |
1052 |
<form id="bundleItemsForm" action=""> |
1053 |
<div class="modal-dialog" role="document"> |
1054 |
<div class="modal-content"> |
1055 |
<div class="modal-header"> |
1056 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1057 |
<h3 id="bundleItemsLabel">Add to bundle</h3> |
1058 |
</div> |
1059 |
<div class="modal-body"> |
1060 |
<div id="result"></div> |
1061 |
<fieldset class="rows"> |
1062 |
<ol> |
1063 |
<li> |
1064 |
<label class="required" for="external_id">Item barcode: </label> |
1065 |
<input type="text" id="external_id" name="external_id" required="required"> |
1066 |
<span class="required">Required</span> |
1067 |
</li> |
1068 |
</ol> |
1069 |
</fieldset> |
1070 |
</div> |
1071 |
<div class="modal-footer"> |
1072 |
<button type="submit" class="btn btn-default">Submit</button> |
1073 |
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> |
1074 |
</div> |
1075 |
</div> |
1076 |
</div> |
1077 |
</form> |
1078 |
</div> |
1079 |
[% END %] |
1080 |
|
1042 |
[% MACRO jsinclude BLOCK %] |
1081 |
[% MACRO jsinclude BLOCK %] |
1043 |
[% INCLUDE 'catalog-strings.inc' %] |
1082 |
[% INCLUDE 'catalog-strings.inc' %] |
1044 |
[% Asset.js("js/catalog.js") | $raw %] |
1083 |
[% Asset.js("js/catalog.js") | $raw %] |
Lines 1341-1346
Note that permanent location is a code, and location may be an authval.
Link Here
|
1341 |
[% INCLUDE 'datatables.inc' %] |
1380 |
[% INCLUDE 'datatables.inc' %] |
1342 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
1381 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
1343 |
[% INCLUDE 'columns_settings.inc' %] |
1382 |
[% INCLUDE 'columns_settings.inc' %] |
|
|
1383 |
[% INCLUDE 'js-date-format.inc' %] |
1344 |
[% Asset.js("js/browser.js") | $raw %] |
1384 |
[% Asset.js("js/browser.js") | $raw %] |
1345 |
[% Asset.js("js/table_filters.js") | $raw %] |
1385 |
[% Asset.js("js/table_filters.js") | $raw %] |
1346 |
<script> |
1386 |
<script> |
Lines 1348-1354
Note that permanent location is a code, and location may be an authval.
Link Here
|
1348 |
browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10)); |
1388 |
browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10)); |
1349 |
browser.show(); |
1389 |
browser.show(); |
1350 |
|
1390 |
|
|
|
1391 |
[% IF bundlesEnabled %] |
1392 |
var bundle_columns = [% TablesSettings.GetColumns('catalogue', 'detail','bundle_tables','json') | $raw %]; |
1393 |
[% END %] |
1351 |
$(document).ready(function() { |
1394 |
$(document).ready(function() { |
|
|
1395 |
|
1396 |
[% IF bundlesEnabled %] // Bundle handling |
1397 |
function createChild ( row, itemnumber ) { |
1398 |
|
1399 |
// Toolbar |
1400 |
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>'); |
1401 |
|
1402 |
// This is the table we'll convert into a DataTable |
1403 |
var bundles_table = $('<table class="display tbundle" data-itemnumber="'+itemnumber+'" id="bundle_table_'+itemnumber+'" width="100%"/>'); |
1404 |
|
1405 |
// Display it the child row |
1406 |
row.child( bundle_toolbar.add(bundles_table) ).show(); |
1407 |
|
1408 |
// Initialise as a DataTable |
1409 |
var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?"; |
1410 |
var bundle_table = bundles_table.kohaTable({ |
1411 |
"ajax": { |
1412 |
"url": bundle_table_url |
1413 |
}, |
1414 |
"header_filter": false, |
1415 |
"embed": [ |
1416 |
"biblio" |
1417 |
], |
1418 |
"order": [[ 1, "asc" ]], |
1419 |
"columnDefs": [ { |
1420 |
"targets": [0,1,2,3,4,5], |
1421 |
"render": function (data, type, row, meta) { |
1422 |
if ( data && type == 'display' ) { |
1423 |
return data.escapeHtml(); |
1424 |
} |
1425 |
return data; |
1426 |
} |
1427 |
} ], |
1428 |
"columns": [ |
1429 |
{ |
1430 |
"data": "biblio.title:biblio.medium", |
1431 |
"title": "Title", |
1432 |
"searchable": true, |
1433 |
"orderable": true, |
1434 |
"render": function(data, type, row, meta) { |
1435 |
var title = ""; |
1436 |
if ( row.biblio.title ) { |
1437 |
title = title.concat('<span class="biblio-title">',row.biblio.title,'</span>'); |
1438 |
} |
1439 |
if ( row.biblio.medium ) { |
1440 |
title = title.concat('<span class="biblio-medium">',row.biblio.medium,'</span>'); |
1441 |
} |
1442 |
return title; |
1443 |
} |
1444 |
}, |
1445 |
{ |
1446 |
"data": "biblio.author", |
1447 |
"title": "Author", |
1448 |
"searchable": true, |
1449 |
"orderable": true, |
1450 |
}, |
1451 |
{ |
1452 |
"data": "collection_code", |
1453 |
"title": "Collection code", |
1454 |
"searchable": true, |
1455 |
"orderable": true, |
1456 |
}, |
1457 |
{ |
1458 |
"data": "item_type", |
1459 |
"title": "Item Type", |
1460 |
"searchable": false, |
1461 |
"orderable": true, |
1462 |
}, |
1463 |
{ |
1464 |
"data": "callnumber", |
1465 |
"title": "Callnumber", |
1466 |
"searchable": true, |
1467 |
"orderable": true, |
1468 |
}, |
1469 |
{ |
1470 |
"data": "external_id", |
1471 |
"title": "Barcode", |
1472 |
"searchable": true, |
1473 |
"orderable": true, |
1474 |
}, |
1475 |
{ |
1476 |
"data": "lost_status:last_seen_date", |
1477 |
"title": "Status", |
1478 |
"searchable": false, |
1479 |
"orderable": true, |
1480 |
"render": function(data, type, row, meta) { |
1481 |
if ( row.lost_status ) { |
1482 |
return "Lost: " + row.lost_status; |
1483 |
} |
1484 |
return ""; |
1485 |
} |
1486 |
}, |
1487 |
{ |
1488 |
"data": function( row, type, val, meta ) { |
1489 |
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'; |
1490 |
return result; |
1491 |
}, |
1492 |
"title": "Actions", |
1493 |
"searchable": false, |
1494 |
"orderable": false, |
1495 |
"class": "noExport" |
1496 |
} |
1497 |
] |
1498 |
}, bundle_columns, 1); |
1499 |
|
1500 |
$(".tbundle").on("click", ".remove", function(){ |
1501 |
var bundle_table = $(this).closest('table'); |
1502 |
var host_itemnumber = bundle_table.data('itemnumber'); |
1503 |
var component_itemnumber = $(this).data('itemnumber'); |
1504 |
var unlink_item_url = "/api/v1/items/" + host_itemnumber + "/bundled_items/" + component_itemnumber; |
1505 |
$.ajax({ |
1506 |
type: "DELETE", |
1507 |
url: unlink_item_url, |
1508 |
success: function(){ |
1509 |
bundle_table.DataTable({ 'retrieve': true }).draw(false); |
1510 |
} |
1511 |
}); |
1512 |
}); |
1513 |
|
1514 |
return; |
1515 |
} |
1516 |
|
1517 |
var bundle_changed; |
1518 |
var bundle_form_active; |
1519 |
$("#bundleItemsModal").on("shown.bs.modal", function(e){ |
1520 |
var button = $(e.relatedTarget); |
1521 |
var item_id = button.data('item'); |
1522 |
$("#result").replaceWith('<div id="result"></div>'); |
1523 |
$("#bundleItemsForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items'); |
1524 |
$("#external_id").focus(); |
1525 |
bundle_changed = 0; |
1526 |
bundle_form_active = item_id; |
1527 |
}); |
1528 |
|
1529 |
$("#bundleItemsForm").submit(function(event) { |
1530 |
|
1531 |
/* stop form from submitting normally */ |
1532 |
event.preventDefault(); |
1533 |
|
1534 |
/* get the action attribute from the <form action=""> element */ |
1535 |
var $form = $(this), |
1536 |
url = $form.attr('action'); |
1537 |
|
1538 |
/* Send the data using post with external_id */ |
1539 |
var posting = $.post(url, JSON.stringify({ |
1540 |
external_id: $('#external_id').val() |
1541 |
}), null, "json"); |
1542 |
|
1543 |
/* Report the results */ |
1544 |
posting.done(function(data) { |
1545 |
var barcode = $('#external_id').val(); |
1546 |
$('#result').replaceWith('<div id="result" class="alert alert-success">Success: Added '+barcode+'</div>'); |
1547 |
$('#external_id').val('').focus(); |
1548 |
bundle_changed = 1; |
1549 |
}); |
1550 |
posting.fail(function(data) { |
1551 |
var barcode = $('#external_id').val(); |
1552 |
if ( data.status === 409 ) { |
1553 |
var response = data.responseJSON; |
1554 |
if ( response.key === "PRIMARY" ) { |
1555 |
$('#result').replaceWith('<div id="result" class="alert alert-warning">Warning: Item '+barcode+' already attached</div>'); |
1556 |
} else { |
1557 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure: Item '+barcode+' belongs to another bundle</div>'); |
1558 |
} |
1559 |
} else { |
1560 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure: Check the logs for details</div>'); |
1561 |
} |
1562 |
$('#external_id').val('').focus(); |
1563 |
}); |
1564 |
}); |
1565 |
|
1566 |
$("#bundleItemsModal").on("hidden.bs.modal", function(e){ |
1567 |
if ( bundle_changed ) { |
1568 |
$('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload(); |
1569 |
} |
1570 |
bundle_form_active = 0; |
1571 |
bundle_changed = 0; |
1572 |
}); |
1573 |
|
1574 |
// End bundle handling |
1575 |
[% END %] |
1576 |
|
1352 |
var ids = ['holdings_table', 'otherholdings_table']; |
1577 |
var ids = ['holdings_table', 'otherholdings_table']; |
1353 |
var columns_settings = [ [% TablesSettings.GetColumns('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetColumns('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; |
1578 |
var columns_settings = [ [% TablesSettings.GetColumns('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetColumns('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; |
1354 |
var has_images = ["[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]"]; |
1579 |
var has_images = ["[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]"]; |
Lines 1365-1370
Note that permanent location is a code, and location may be an authval.
Link Here
|
1365 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
1590 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
1366 |
}; |
1591 |
}; |
1367 |
var table = KohaTable(id, dt_parameters, columns_settings[i], 'with_filters'); |
1592 |
var table = KohaTable(id, dt_parameters, columns_settings[i], 'with_filters'); |
|
|
1593 |
|
1594 |
[% IF bundlesEnabled %] |
1595 |
// Add event listener for opening and closing bundle details |
1596 |
$('#' + id + ' tbody').on('click', 'button.details-control', function () { |
1597 |
var tr = $(this).closest('tr'); |
1598 |
var dTable = $(this).closest('table').DataTable({ 'retrieve': true }); |
1599 |
|
1600 |
var itemnumber = tr.data('itemnumber'); |
1601 |
var row = dTable.row( tr ); |
1602 |
|
1603 |
if ( row.child.isShown() ) { |
1604 |
// This row is already open - close it |
1605 |
row.child.hide(); |
1606 |
tr.removeClass('shown'); |
1607 |
} |
1608 |
else { |
1609 |
// Open this row |
1610 |
createChild(row, itemnumber); |
1611 |
tr.addClass('shown'); |
1612 |
} |
1613 |
} ); |
1614 |
[% END %] |
1368 |
} |
1615 |
} |
1369 |
|
1616 |
|
1370 |
[% IF Koha.Preference('AcquisitionDetails') %] |
1617 |
[% IF Koha.Preference('AcquisitionDetails') %] |
Lines 1386-1391
Note that permanent location is a code, and location may be an authval.
Link Here
|
1386 |
"sPaginationType": "full" |
1633 |
"sPaginationType": "full" |
1387 |
})); |
1634 |
})); |
1388 |
[% END %] |
1635 |
[% END %] |
|
|
1636 |
|
1389 |
}); |
1637 |
}); |
1390 |
|
1638 |
|
1391 |
$(document).ready(function() { |
1639 |
$(document).ready(function() { |
1392 |
- |
|
|