Lines 354-365
Link Here
|
354 |
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %] |
354 |
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %] |
355 |
[% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %] |
355 |
[% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %] |
356 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %] |
356 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %] |
357 |
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort"> </th>[% END %] |
357 |
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort noExport"> </th>[% END %] |
358 |
</tr> |
358 |
</tr> |
359 |
</thead> |
359 |
</thead> |
360 |
<tbody> |
360 |
<tbody> |
361 |
[% FOREACH item IN items %] |
361 |
[% FOREACH item IN items %] |
362 |
<tr> |
362 |
<tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]"> |
363 |
[% IF (StaffDetailItemSelection) %] |
363 |
[% IF (StaffDetailItemSelection) %] |
364 |
<td style="text-align:center;vertical-align:middle"> |
364 |
<td style="text-align:center;vertical-align:middle"> |
365 |
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" /> |
365 |
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" /> |
Lines 530-535
Note that permanent location is a code, and location may be an authval.
Link Here
|
530 |
[% IF ( item.restricted ) %] |
530 |
[% IF ( item.restricted ) %] |
531 |
<span class="restricted">([% item.restrictedvalue | html %])</span> |
531 |
<span class="restricted">([% item.restrictedvalue | html %])</span> |
532 |
[% END %] |
532 |
[% END %] |
|
|
533 |
|
534 |
[% IF ( item.bundle_host ) %] |
535 |
<span class="bundled">In bundle: [% INCLUDE 'biblio-title.inc' biblio = item.bundle_host.biblio link = 1 %]</span> |
536 |
[% END %] |
537 |
|
533 |
</td> |
538 |
</td> |
534 |
<td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> |
539 |
<td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> |
535 |
<td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td> |
540 |
<td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td> |
Lines 614-619
Note that permanent location is a code, and location may be an authval.
Link Here
|
614 |
<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> |
619 |
<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> |
615 |
[% END %] |
620 |
[% END %] |
616 |
[% END %] |
621 |
[% END %] |
|
|
622 |
[% IF bundlesEnabled %] |
623 |
<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> Manage bundle</button> |
624 |
[% END %] |
617 |
</td> |
625 |
</td> |
618 |
[% END %] |
626 |
[% END %] |
619 |
</tr> |
627 |
</tr> |
Lines 1055-1060
Note that permanent location is a code, and location may be an authval.
Link Here
|
1055 |
|
1063 |
|
1056 |
[% END %] |
1064 |
[% END %] |
1057 |
|
1065 |
|
|
|
1066 |
[% IF bundlesEnabled %] |
1067 |
<div class="modal" id="bundleItemsModal" tabindex="-1" role="dialog" aria-labelledby="bundleItemsLabel"> |
1068 |
<form id="bundleItemsForm" action=""> |
1069 |
<div class="modal-dialog" role="document"> |
1070 |
<div class="modal-content"> |
1071 |
<div class="modal-header"> |
1072 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1073 |
<h3 id="bundleItemsLabel">Add to bundle</h3> |
1074 |
</div> |
1075 |
<div class="modal-body"> |
1076 |
<div id="result"></div> |
1077 |
<fieldset class="rows"> |
1078 |
<ol> |
1079 |
<li> |
1080 |
<label class="required" for="external_id">Item barcode: </label> |
1081 |
<input type="text" id="external_id" name="external_id" required="required"> |
1082 |
<span class="required">Required</span> |
1083 |
</li> |
1084 |
</ol> |
1085 |
</fieldset> |
1086 |
</div> |
1087 |
<div class="modal-footer"> |
1088 |
<button type="submit" class="btn btn-default">Submit</button> |
1089 |
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> |
1090 |
</div> |
1091 |
</div> |
1092 |
</div> |
1093 |
</form> |
1094 |
</div> |
1095 |
[% END %] |
1096 |
|
1058 |
[% MACRO jsinclude BLOCK %] |
1097 |
[% MACRO jsinclude BLOCK %] |
1059 |
[% INCLUDE 'catalog-strings.inc' %] |
1098 |
[% INCLUDE 'catalog-strings.inc' %] |
1060 |
[% Asset.js("js/catalog.js") | $raw %] |
1099 |
[% Asset.js("js/catalog.js") | $raw %] |
Lines 1360-1365
Note that permanent location is a code, and location may be an authval.
Link Here
|
1360 |
[% INCLUDE 'datatables.inc' %] |
1399 |
[% INCLUDE 'datatables.inc' %] |
1361 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
1400 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
1362 |
[% INCLUDE 'columns_settings.inc' %] |
1401 |
[% INCLUDE 'columns_settings.inc' %] |
|
|
1402 |
[% INCLUDE 'js-date-format.inc' %] |
1363 |
[% Asset.js("js/browser.js") | $raw %] |
1403 |
[% Asset.js("js/browser.js") | $raw %] |
1364 |
[% Asset.js("js/table_filters.js") | $raw %] |
1404 |
[% Asset.js("js/table_filters.js") | $raw %] |
1365 |
<script> |
1405 |
<script> |
Lines 1367-1373
Note that permanent location is a code, and location may be an authval.
Link Here
|
1367 |
browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10)); |
1407 |
browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10)); |
1368 |
browser.show(); |
1408 |
browser.show(); |
1369 |
|
1409 |
|
|
|
1410 |
[% IF bundlesEnabled %] |
1411 |
var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %]; |
1412 |
[% END %] |
1370 |
$(document).ready(function() { |
1413 |
$(document).ready(function() { |
|
|
1414 |
|
1415 |
[% IF bundlesEnabled %] // Bundle handling |
1416 |
function createChild ( row, itemnumber ) { |
1417 |
|
1418 |
// Toolbar |
1419 |
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>'); |
1420 |
|
1421 |
// This is the table we'll convert into a DataTable |
1422 |
var bundles_table = $('<table class="display tbundle" data-itemnumber="'+itemnumber+'" id="bundle_table_'+itemnumber+'" width="100%"/>'); |
1423 |
|
1424 |
// Display it the child row |
1425 |
row.child( bundle_toolbar.add(bundles_table) ).show(); |
1426 |
|
1427 |
// Initialise as a DataTable |
1428 |
var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?"; |
1429 |
var bundle_table = bundles_table.kohaTable({ |
1430 |
"ajax": { |
1431 |
"url": bundle_table_url |
1432 |
}, |
1433 |
"header_filter": false, |
1434 |
"embed": [ |
1435 |
"biblio" |
1436 |
], |
1437 |
"order": [[ 1, "asc" ]], |
1438 |
"columnDefs": [ { |
1439 |
"targets": [0,1,2,3,4,5], |
1440 |
"render": function (data, type, row, meta) { |
1441 |
if ( data && type == 'display' ) { |
1442 |
return data.escapeHtml(); |
1443 |
} |
1444 |
return data; |
1445 |
} |
1446 |
} ], |
1447 |
"columns": [ |
1448 |
{ |
1449 |
"data": "biblio.title:biblio.medium", |
1450 |
"title": "Title", |
1451 |
"searchable": true, |
1452 |
"orderable": true, |
1453 |
"render": function(data, type, row, meta) { |
1454 |
var title = ""; |
1455 |
if ( row.biblio.title ) { |
1456 |
title = title.concat('<span class="biblio-title">',row.biblio.title,'</span>'); |
1457 |
} |
1458 |
if ( row.biblio.subtitle ) { |
1459 |
title = title.concat('<span class="biblio-subtitle">',row.biblio.subtitle,'</span>'); |
1460 |
} |
1461 |
if ( row.biblio.medium ) { |
1462 |
title = title.concat('<span class="biblio-medium">',row.biblio.medium,'</span>'); |
1463 |
} |
1464 |
return title; |
1465 |
} |
1466 |
}, |
1467 |
{ |
1468 |
"data": "biblio.author", |
1469 |
"title": "Author", |
1470 |
"searchable": true, |
1471 |
"orderable": true, |
1472 |
}, |
1473 |
{ |
1474 |
"data": "collection_code", |
1475 |
"title": "Collection code", |
1476 |
"searchable": true, |
1477 |
"orderable": true, |
1478 |
}, |
1479 |
{ |
1480 |
"data": "item_type", |
1481 |
"title": "Item Type", |
1482 |
"searchable": false, |
1483 |
"orderable": true, |
1484 |
}, |
1485 |
{ |
1486 |
"data": "callnumber", |
1487 |
"title": "Callnumber", |
1488 |
"searchable": true, |
1489 |
"orderable": true, |
1490 |
}, |
1491 |
{ |
1492 |
"data": "external_id", |
1493 |
"title": "Barcode", |
1494 |
"searchable": true, |
1495 |
"orderable": true, |
1496 |
}, |
1497 |
{ |
1498 |
"data": "lost_status:last_seen_date", |
1499 |
"title": "Status", |
1500 |
"searchable": false, |
1501 |
"orderable": true, |
1502 |
"render": function(data, type, row, meta) { |
1503 |
if ( row.lost_status ) { |
1504 |
return "Lost: " + row.lost_status; |
1505 |
} |
1506 |
return ""; |
1507 |
} |
1508 |
}, |
1509 |
{ |
1510 |
"data": function( row, type, val, meta ) { |
1511 |
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'; |
1512 |
return result; |
1513 |
}, |
1514 |
"title": "Actions", |
1515 |
"searchable": false, |
1516 |
"orderable": false, |
1517 |
"class": "noExport" |
1518 |
} |
1519 |
] |
1520 |
}, bundle_settings, 1); |
1521 |
|
1522 |
$(".tbundle").on("click", ".remove", function(){ |
1523 |
var bundle_table = $(this).closest('table'); |
1524 |
var host_itemnumber = bundle_table.data('itemnumber'); |
1525 |
var component_itemnumber = $(this).data('itemnumber'); |
1526 |
var unlink_item_url = "/api/v1/items/" + host_itemnumber + "/bundled_items/" + component_itemnumber; |
1527 |
$.ajax({ |
1528 |
type: "DELETE", |
1529 |
url: unlink_item_url, |
1530 |
success: function(){ |
1531 |
bundle_table.DataTable({ 'retrieve': true }).draw(false); |
1532 |
} |
1533 |
}); |
1534 |
}); |
1535 |
|
1536 |
return; |
1537 |
} |
1538 |
|
1539 |
var bundle_changed; |
1540 |
var bundle_form_active; |
1541 |
$("#bundleItemsModal").on("shown.bs.modal", function(e){ |
1542 |
var button = $(e.relatedTarget); |
1543 |
var item_id = button.data('item'); |
1544 |
$("#result").replaceWith('<div id="result"></div>'); |
1545 |
$("#bundleItemsForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items'); |
1546 |
$("#external_id").focus(); |
1547 |
bundle_changed = 0; |
1548 |
bundle_form_active = item_id; |
1549 |
}); |
1550 |
|
1551 |
$("#bundleItemsForm").submit(function(event) { |
1552 |
|
1553 |
/* stop form from submitting normally */ |
1554 |
event.preventDefault(); |
1555 |
|
1556 |
/* get the action attribute from the <form action=""> element */ |
1557 |
var $form = $(this), |
1558 |
url = $form.attr('action'); |
1559 |
|
1560 |
/* Send the data using post with external_id */ |
1561 |
var posting = $.post({ |
1562 |
url: url, |
1563 |
data: JSON.stringify({ external_id: $('#external_id').val()}), |
1564 |
contentType: "application/json; charset=utf-8", |
1565 |
dataType: "json" |
1566 |
}); |
1567 |
|
1568 |
/* Report the results */ |
1569 |
posting.done(function(data) { |
1570 |
var barcode = $('#external_id').val(); |
1571 |
$('#result').replaceWith('<div id="result" class="alert alert-success">Success: Added '+barcode+'</div>'); |
1572 |
$('#external_id').val('').focus(); |
1573 |
bundle_changed = 1; |
1574 |
}); |
1575 |
posting.fail(function(data) { |
1576 |
var barcode = $('#external_id').val(); |
1577 |
if ( data.status === 409 ) { |
1578 |
var response = data.responseJSON; |
1579 |
if ( response.key === "PRIMARY" ) { |
1580 |
$('#result').replaceWith('<div id="result" class="alert alert-warning">Warning: Item '+barcode+' already attached</div>'); |
1581 |
} else { |
1582 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure: Item '+barcode+' belongs to another bundle</div>'); |
1583 |
} |
1584 |
} else { |
1585 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure: Check the logs for details</div>'); |
1586 |
} |
1587 |
$('#external_id').val('').focus(); |
1588 |
}); |
1589 |
}); |
1590 |
|
1591 |
$("#bundleItemsModal").on("hidden.bs.modal", function(e){ |
1592 |
if ( bundle_changed ) { |
1593 |
$('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload(); |
1594 |
} |
1595 |
bundle_form_active = 0; |
1596 |
bundle_changed = 0; |
1597 |
}); |
1598 |
|
1599 |
// End bundle handling |
1600 |
[% END %] |
1601 |
|
1371 |
var table_names = [ 'holdings_table', 'otherholdings_table' ]; |
1602 |
var table_names = [ 'holdings_table', 'otherholdings_table' ]; |
1372 |
var table_settings = [ [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; |
1603 |
var table_settings = [ [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; |
1373 |
var has_images = [ "[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]" ]; |
1604 |
var has_images = [ "[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]" ]; |
Lines 1383-1388
Note that permanent location is a code, and location may be an authval.
Link Here
|
1383 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
1614 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
1384 |
}; |
1615 |
}; |
1385 |
var table = KohaTable( table_name, dt_parameters, table_settings[index], 'with_filters' ); |
1616 |
var table = KohaTable( table_name, dt_parameters, table_settings[index], 'with_filters' ); |
|
|
1617 |
|
1618 |
[% IF bundlesEnabled %] |
1619 |
// Add event listener for opening and closing bundle details |
1620 |
$('#' + table_name + ' tbody').on('click', 'button.details-control', function () { |
1621 |
var tr = $(this).closest('tr'); |
1622 |
var dTable = $(this).closest('table').DataTable({ 'retrieve': true }); |
1623 |
|
1624 |
var itemnumber = tr.data('itemnumber'); |
1625 |
var row = dTable.row( tr ); |
1626 |
|
1627 |
if ( row.child.isShown() ) { |
1628 |
// This row is already open - close it |
1629 |
row.child.hide(); |
1630 |
tr.removeClass('shown'); |
1631 |
} |
1632 |
else { |
1633 |
// Open this row |
1634 |
createChild(row, itemnumber); |
1635 |
tr.addClass('shown'); |
1636 |
} |
1637 |
} ); |
1638 |
[% END %] |
1386 |
}); |
1639 |
}); |
1387 |
|
1640 |
|
1388 |
[% IF Koha.Preference('AcquisitionDetails') %] |
1641 |
[% IF Koha.Preference('AcquisitionDetails') %] |
Lines 1404-1409
Note that permanent location is a code, and location may be an authval.
Link Here
|
1404 |
"sPaginationType": "full" |
1657 |
"sPaginationType": "full" |
1405 |
})); |
1658 |
})); |
1406 |
[% END %] |
1659 |
[% END %] |
|
|
1660 |
|
1407 |
}); |
1661 |
}); |
1408 |
|
1662 |
|
1409 |
[% IF (found1) %] |
1663 |
[% IF (found1) %] |
1410 |
- |
|
|