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