Lines 368-379
Link Here
|
368 |
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %] |
368 |
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %] |
369 |
[% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %] |
369 |
[% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %] |
370 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %] |
370 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %] |
371 |
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort"> </th>[% END %] |
371 |
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort noExport"> </th>[% END %] |
372 |
</tr> |
372 |
</tr> |
373 |
</thead> |
373 |
</thead> |
374 |
<tbody> |
374 |
<tbody> |
375 |
[% FOREACH item IN items %] |
375 |
[% FOREACH item IN items %] |
376 |
<tr> |
376 |
<tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]"> |
377 |
[% IF (StaffDetailItemSelection) %] |
377 |
[% IF (StaffDetailItemSelection) %] |
378 |
<td style="text-align:center;vertical-align:middle"> |
378 |
<td style="text-align:center;vertical-align:middle"> |
379 |
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" /> |
379 |
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" /> |
Lines 545-550
Note that permanent location is a code, and location may be an authval.
Link Here
|
545 |
[% IF ( item.restricted ) %] |
545 |
[% IF ( item.restricted ) %] |
546 |
<span class="restricted">([% item.restrictedvalue | html %])</span> |
546 |
<span class="restricted">([% item.restrictedvalue | html %])</span> |
547 |
[% END %] |
547 |
[% END %] |
|
|
548 |
|
549 |
[% IF ( item.bundle_host ) %] |
550 |
<span class="bundled">In bundle: [% INCLUDE 'biblio-title.inc' biblio = item.bundle_host.biblio link = 1 %]</span> |
551 |
[% END %] |
552 |
|
548 |
</td> |
553 |
</td> |
549 |
<td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> |
554 |
<td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> |
550 |
<td class="issues" data-order="[% item.issues || 0 | html %]">[% item.issues || 0 | html %]</td> |
555 |
<td class="issues" data-order="[% item.issues || 0 | html %]">[% item.issues || 0 | html %]</td> |
Lines 631-636
Note that permanent location is a code, and location may be an authval.
Link Here
|
631 |
<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> |
636 |
<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> |
632 |
[% END %] |
637 |
[% END %] |
633 |
[% END %] |
638 |
[% END %] |
|
|
639 |
[% IF bundlesEnabled %] |
640 |
<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> Manage bundle</button> |
641 |
[% END %] |
634 |
</td> |
642 |
</td> |
635 |
[% END %] |
643 |
[% END %] |
636 |
</tr> |
644 |
</tr> |
Lines 1222-1227
Note that permanent location is a code, and location may be an authval.
Link Here
|
1222 |
</div> |
1230 |
</div> |
1223 |
</div> |
1231 |
</div> |
1224 |
|
1232 |
|
|
|
1233 |
[% IF bundlesEnabled %] |
1234 |
<div class="modal" id="bundleItemsModal" tabindex="-1" role="dialog" aria-labelledby="bundleItemsLabel"> |
1235 |
<form id="bundleItemsForm" action=""> |
1236 |
<div class="modal-dialog" role="document"> |
1237 |
<div class="modal-content"> |
1238 |
<div class="modal-header"> |
1239 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1240 |
<h3 id="bundleItemsLabel">Add to bundle</h3> |
1241 |
</div> |
1242 |
<div class="modal-body"> |
1243 |
<div id="result"></div> |
1244 |
<fieldset class="rows"> |
1245 |
<ol> |
1246 |
<li> |
1247 |
<label class="required" for="external_id">Item barcode: </label> |
1248 |
<input type="text" id="external_id" name="external_id" required="required"> |
1249 |
<span class="required">Required</span> |
1250 |
</li> |
1251 |
</ol> |
1252 |
</fieldset> |
1253 |
</div> |
1254 |
<div class="modal-footer"> |
1255 |
<button type="submit" class="btn btn-default">Submit</button> |
1256 |
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> |
1257 |
</div> |
1258 |
</div> |
1259 |
</div> |
1260 |
</form> |
1261 |
</div> |
1262 |
[% END %] |
1263 |
|
1225 |
[% MACRO jsinclude BLOCK %] |
1264 |
[% MACRO jsinclude BLOCK %] |
1226 |
[% INCLUDE 'catalog-strings.inc' %] |
1265 |
[% INCLUDE 'catalog-strings.inc' %] |
1227 |
[% Asset.js("js/catalog.js") | $raw %] |
1266 |
[% Asset.js("js/catalog.js") | $raw %] |
Lines 1528-1533
Note that permanent location is a code, and location may be an authval.
Link Here
|
1528 |
[% INCLUDE 'datatables.inc' %] |
1567 |
[% INCLUDE 'datatables.inc' %] |
1529 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
1568 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
1530 |
[% INCLUDE 'columns_settings.inc' %] |
1569 |
[% INCLUDE 'columns_settings.inc' %] |
|
|
1570 |
[% INCLUDE 'js-date-format.inc' %] |
1531 |
[% Asset.js("js/browser.js") | $raw %] |
1571 |
[% Asset.js("js/browser.js") | $raw %] |
1532 |
[% Asset.js("js/table_filters.js") | $raw %] |
1572 |
[% Asset.js("js/table_filters.js") | $raw %] |
1533 |
<script> |
1573 |
<script> |
Lines 1535-1541
Note that permanent location is a code, and location may be an authval.
Link Here
|
1535 |
browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10)); |
1575 |
browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10)); |
1536 |
browser.show(); |
1576 |
browser.show(); |
1537 |
|
1577 |
|
|
|
1578 |
[% IF bundlesEnabled %] |
1579 |
var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %]; |
1580 |
[% END %] |
1538 |
$(document).ready(function() { |
1581 |
$(document).ready(function() { |
|
|
1582 |
|
1583 |
[% IF bundlesEnabled %] // Bundle handling |
1584 |
function createChild ( row, itemnumber ) { |
1585 |
|
1586 |
// Toolbar |
1587 |
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>'); |
1588 |
|
1589 |
// This is the table we'll convert into a DataTable |
1590 |
var bundles_table = $('<table class="display tbundle" data-itemnumber="'+itemnumber+'" id="bundle_table_'+itemnumber+'" width="100%"/>'); |
1591 |
|
1592 |
// Display it the child row |
1593 |
row.child( bundle_toolbar.add(bundles_table) ).show(); |
1594 |
|
1595 |
// Initialise as a DataTable |
1596 |
var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?"; |
1597 |
var bundle_table = bundles_table.kohaTable({ |
1598 |
"ajax": { |
1599 |
"url": bundle_table_url |
1600 |
}, |
1601 |
"header_filter": false, |
1602 |
"embed": [ |
1603 |
"biblio" |
1604 |
], |
1605 |
"order": [[ 1, "asc" ]], |
1606 |
"columnDefs": [ { |
1607 |
"targets": [0,1,2,3,4,5], |
1608 |
"render": function (data, type, row, meta) { |
1609 |
if ( data && type == 'display' ) { |
1610 |
return data.escapeHtml(); |
1611 |
} |
1612 |
return data; |
1613 |
} |
1614 |
} ], |
1615 |
"columns": [ |
1616 |
{ |
1617 |
"data": "biblio.title:biblio.medium", |
1618 |
"title": "Title", |
1619 |
"searchable": true, |
1620 |
"orderable": true, |
1621 |
"render": function(data, type, row, meta) { |
1622 |
var title = ""; |
1623 |
if ( row.biblio.title ) { |
1624 |
title = title.concat('<span class="biblio-title">',row.biblio.title,'</span>'); |
1625 |
} |
1626 |
if ( row.biblio.subtitle ) { |
1627 |
title = title.concat('<span class="biblio-subtitle">',row.biblio.subtitle,'</span>'); |
1628 |
} |
1629 |
if ( row.biblio.medium ) { |
1630 |
title = title.concat('<span class="biblio-medium">',row.biblio.medium,'</span>'); |
1631 |
} |
1632 |
return title; |
1633 |
} |
1634 |
}, |
1635 |
{ |
1636 |
"data": "biblio.author", |
1637 |
"title": "Author", |
1638 |
"searchable": true, |
1639 |
"orderable": true, |
1640 |
}, |
1641 |
{ |
1642 |
"data": "collection_code", |
1643 |
"title": "Collection code", |
1644 |
"searchable": true, |
1645 |
"orderable": true, |
1646 |
}, |
1647 |
{ |
1648 |
"data": "item_type", |
1649 |
"title": "Item Type", |
1650 |
"searchable": false, |
1651 |
"orderable": true, |
1652 |
}, |
1653 |
{ |
1654 |
"data": "callnumber", |
1655 |
"title": "Callnumber", |
1656 |
"searchable": true, |
1657 |
"orderable": true, |
1658 |
}, |
1659 |
{ |
1660 |
"data": "external_id", |
1661 |
"title": "Barcode", |
1662 |
"searchable": true, |
1663 |
"orderable": true, |
1664 |
}, |
1665 |
{ |
1666 |
"data": "lost_status:last_seen_date", |
1667 |
"title": "Status", |
1668 |
"searchable": false, |
1669 |
"orderable": true, |
1670 |
"render": function(data, type, row, meta) { |
1671 |
if ( row.lost_status ) { |
1672 |
return "Lost: " + row.lost_status; |
1673 |
} |
1674 |
return ""; |
1675 |
} |
1676 |
}, |
1677 |
{ |
1678 |
"data": function( row, type, val, meta ) { |
1679 |
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'; |
1680 |
return result; |
1681 |
}, |
1682 |
"title": "Actions", |
1683 |
"searchable": false, |
1684 |
"orderable": false, |
1685 |
"class": "noExport" |
1686 |
} |
1687 |
] |
1688 |
}, bundle_settings, 1); |
1689 |
|
1690 |
$(".tbundle").on("click", ".remove", function(){ |
1691 |
var bundle_table = $(this).closest('table'); |
1692 |
var host_itemnumber = bundle_table.data('itemnumber'); |
1693 |
var component_itemnumber = $(this).data('itemnumber'); |
1694 |
var unlink_item_url = "/api/v1/items/" + host_itemnumber + "/bundled_items/" + component_itemnumber; |
1695 |
$.ajax({ |
1696 |
type: "DELETE", |
1697 |
url: unlink_item_url, |
1698 |
success: function(){ |
1699 |
bundle_table.DataTable({ 'retrieve': true }).draw(false); |
1700 |
} |
1701 |
}); |
1702 |
}); |
1703 |
|
1704 |
return; |
1705 |
} |
1706 |
|
1707 |
var bundle_changed; |
1708 |
var bundle_form_active; |
1709 |
$("#bundleItemsModal").on("shown.bs.modal", function(e){ |
1710 |
var button = $(e.relatedTarget); |
1711 |
var item_id = button.data('item'); |
1712 |
$("#result").replaceWith('<div id="result"></div>'); |
1713 |
$("#bundleItemsForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items'); |
1714 |
$("#external_id").focus(); |
1715 |
bundle_changed = 0; |
1716 |
bundle_form_active = item_id; |
1717 |
}); |
1718 |
|
1719 |
$("#bundleItemsForm").submit(function(event) { |
1720 |
|
1721 |
/* stop form from submitting normally */ |
1722 |
event.preventDefault(); |
1723 |
|
1724 |
/* get the action attribute from the <form action=""> element */ |
1725 |
var $form = $(this), |
1726 |
url = $form.attr('action'); |
1727 |
|
1728 |
/* Send the data using post with external_id */ |
1729 |
var posting = $.post({ |
1730 |
url: url, |
1731 |
data: JSON.stringify({ external_id: $('#external_id').val()}), |
1732 |
contentType: "application/json; charset=utf-8", |
1733 |
dataType: "json" |
1734 |
}); |
1735 |
|
1736 |
/* Report the results */ |
1737 |
posting.done(function(data) { |
1738 |
var barcode = $('#external_id').val(); |
1739 |
$('#result').replaceWith('<div id="result" class="alert alert-success">Success: Added '+barcode+'</div>'); |
1740 |
$('#external_id').val('').focus(); |
1741 |
bundle_changed = 1; |
1742 |
}); |
1743 |
posting.fail(function(data) { |
1744 |
var barcode = $('#external_id').val(); |
1745 |
if ( data.status === 409 ) { |
1746 |
var response = data.responseJSON; |
1747 |
if ( response.key === "PRIMARY" ) { |
1748 |
$('#result').replaceWith('<div id="result" class="alert alert-warning">Warning: Item '+barcode+' already attached</div>'); |
1749 |
} else { |
1750 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure: Item '+barcode+' belongs to another bundle</div>'); |
1751 |
} |
1752 |
} else { |
1753 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure: Check the logs for details</div>'); |
1754 |
} |
1755 |
$('#external_id').val('').focus(); |
1756 |
}); |
1757 |
}); |
1758 |
|
1759 |
$("#bundleItemsModal").on("hidden.bs.modal", function(e){ |
1760 |
if ( bundle_changed ) { |
1761 |
$('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload(); |
1762 |
} |
1763 |
bundle_form_active = 0; |
1764 |
bundle_changed = 0; |
1765 |
}); |
1766 |
|
1767 |
// End bundle handling |
1768 |
[% END %] |
1769 |
|
1539 |
var table_names = [ 'holdings_table', 'otherholdings_table' ]; |
1770 |
var table_names = [ 'holdings_table', 'otherholdings_table' ]; |
1540 |
var table_settings = [ [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; |
1771 |
var table_settings = [ [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; |
1541 |
var has_images = [ "[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]" ]; |
1772 |
var has_images = [ "[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]" ]; |
Lines 1551-1556
Note that permanent location is a code, and location may be an authval.
Link Here
|
1551 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
1782 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
1552 |
}; |
1783 |
}; |
1553 |
var table = KohaTable( table_name, dt_parameters, table_settings[index], 'with_filters' ); |
1784 |
var table = KohaTable( table_name, dt_parameters, table_settings[index], 'with_filters' ); |
|
|
1785 |
|
1786 |
[% IF bundlesEnabled %] |
1787 |
// Add event listener for opening and closing bundle details |
1788 |
$('#' + table_name + ' tbody').on('click', 'button.details-control', function () { |
1789 |
var tr = $(this).closest('tr'); |
1790 |
var dTable = $(this).closest('table').DataTable({ 'retrieve': true }); |
1791 |
|
1792 |
var itemnumber = tr.data('itemnumber'); |
1793 |
var row = dTable.row( tr ); |
1794 |
|
1795 |
if ( row.child.isShown() ) { |
1796 |
// This row is already open - close it |
1797 |
row.child.hide(); |
1798 |
tr.removeClass('shown'); |
1799 |
} |
1800 |
else { |
1801 |
// Open this row |
1802 |
createChild(row, itemnumber); |
1803 |
tr.addClass('shown'); |
1804 |
} |
1805 |
} ); |
1806 |
[% END %] |
1554 |
}); |
1807 |
}); |
1555 |
|
1808 |
|
1556 |
[% IF Koha.Preference('AcquisitionDetails') %] |
1809 |
[% IF Koha.Preference('AcquisitionDetails') %] |
Lines 1572-1577
Note that permanent location is a code, and location may be an authval.
Link Here
|
1572 |
"sPaginationType": "full" |
1825 |
"sPaginationType": "full" |
1573 |
})); |
1826 |
})); |
1574 |
[% END %] |
1827 |
[% END %] |
|
|
1828 |
|
1575 |
}); |
1829 |
}); |
1576 |
|
1830 |
|
1577 |
[% IF (found1) %] |
1831 |
[% IF (found1) %] |
1578 |
- |
|
|