Lines 315-320
Link Here
|
315 |
<table class="items_table" id="[% tab | html %]_table"> |
315 |
<table class="items_table" id="[% tab | html %]_table"> |
316 |
<thead> |
316 |
<thead> |
317 |
<tr> |
317 |
<tr> |
|
|
318 |
[% IF ( itemdata_bundles ) %]<th id="[% tab | html %]_bundles" data-colname="[% tab | html %]_bundles" class="NoSort"></th>[% END %] |
318 |
[% IF (StaffDetailItemSelection) %]<th id="[% tab | html %]_checkbox" data-colname="[% tab | html %]_checkbox" class="NoSort"></th>[% END %] |
319 |
[% IF (StaffDetailItemSelection) %]<th id="[% tab | html %]_checkbox" data-colname="[% tab | html %]_checkbox" class="NoSort"></th>[% END %] |
319 |
[% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %] |
320 |
[% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %] |
320 |
<th id="[% tab | html %]_cover_image" data-colname="[% tab | html %]_cover_image">Cover image</th> |
321 |
<th id="[% tab | html %]_cover_image" data-colname="[% tab | html %]_cover_image">Cover image</th> |
Lines 347-353
Link Here
|
347 |
</thead> |
348 |
</thead> |
348 |
<tbody> |
349 |
<tbody> |
349 |
[% FOREACH item IN items %] |
350 |
[% FOREACH item IN items %] |
350 |
<tr> |
351 |
<tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]"> |
|
|
352 |
[% IF ( itemdata_bundles ) %] |
353 |
[% IF ( item.is_bundle ) %] |
354 |
<td class="details-control"> |
355 |
<button><i class="fa fa-folder-open"></i></button> |
356 |
</td> |
357 |
[% ELSE %] |
358 |
<td></td> |
359 |
[% END %] |
360 |
[% END %] |
351 |
[% IF (StaffDetailItemSelection) %] |
361 |
[% IF (StaffDetailItemSelection) %] |
352 |
<td style="text-align:center;vertical-align:middle"> |
362 |
<td style="text-align:center;vertical-align:middle"> |
353 |
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" /> |
363 |
<input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" /> |
Lines 455-460
Note that permanent location is a code, and location may be an authval.
Link Here
|
455 |
[% ELSE %] |
465 |
[% ELSE %] |
456 |
<span class="lost">Unavailable (lost or missing)</span> |
466 |
<span class="lost">Unavailable (lost or missing)</span> |
457 |
[% END %] |
467 |
[% END %] |
|
|
468 |
[% IF ( item.itemlost == Koha.Preference('BundleLostValue') AND item.loss_checkout ) %] |
469 |
<span>[% item.loss_checkout.borrowernumber | html %]</span> |
470 |
[% END %] |
458 |
[% END %] |
471 |
[% END %] |
459 |
|
472 |
|
460 |
[% IF ( item.withdrawn ) %] |
473 |
[% IF ( item.withdrawn ) %] |
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> |
522 |
<span class="restricted">([% item.restrictedvalue | html %])</span> |
510 |
[% END %] |
523 |
[% END %] |
511 |
|
524 |
|
|
|
525 |
[% IF ( item.bundle_host ) %] |
526 |
<span class="bundled">In bundle: [% INCLUDE 'biblio-title.inc' biblio = item.bundle_host.biblio link = 1 %]</span> |
527 |
[% END %] |
528 |
|
512 |
</td> |
529 |
</td> |
513 |
<td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td> |
530 |
<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> |
531 |
<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> |
610 |
<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 %] |
611 |
[% END %] |
595 |
[% END %] |
612 |
[% END %] |
|
|
613 |
[% IF collection %] |
614 |
<button type="button" data-toggle="modal" data-target="#bundleItemsModal" data-item="[% item.itemnumber | html %]" class="btn btn-default btn-xs"><i class="fa fa-folder"></i> Bundle</button> |
615 |
[% END %] |
596 |
</td> |
616 |
</td> |
597 |
[% END %] |
617 |
[% END %] |
598 |
</tr> |
618 |
</tr> |
Lines 1020-1025
Note that permanent location is a code, and location may be an authval.
Link Here
|
1020 |
|
1040 |
|
1021 |
[% END %] |
1041 |
[% END %] |
1022 |
|
1042 |
|
|
|
1043 |
<div class="modal" id="bundleItemsModal" tabindex="-1" role="dialog" aria-labelledby="bundleItemsLabel"> |
1044 |
<form id="bundleItemsForm" action=""> |
1045 |
<div class="modal-dialog" role="document"> |
1046 |
<div class="modal-content"> |
1047 |
<div class="modal-header"> |
1048 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1049 |
<h3 id="bundleItemsLabel">Add to bundle</h3> |
1050 |
</div> |
1051 |
<div class="modal-body"> |
1052 |
<div id="result"></div> |
1053 |
<fieldset class="rows"> |
1054 |
<ol> |
1055 |
<li> |
1056 |
<label class="required" for="external_id">Item barcode: </label> |
1057 |
<input type="text" id="external_id" name="external_id" required="required"> |
1058 |
<span class="required">Required</span> |
1059 |
</li> |
1060 |
</ol> |
1061 |
</fieldset> |
1062 |
</div> |
1063 |
<div class="modal-footer"> |
1064 |
<button type="submit" class="btn btn-default">Submit</button> |
1065 |
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> |
1066 |
</div> |
1067 |
</div> |
1068 |
</div> |
1069 |
</form> |
1070 |
</div> |
1071 |
|
1023 |
[% MACRO jsinclude BLOCK %] |
1072 |
[% MACRO jsinclude BLOCK %] |
1024 |
[% INCLUDE 'catalog-strings.inc' %] |
1073 |
[% INCLUDE 'catalog-strings.inc' %] |
1025 |
[% Asset.js("js/catalog.js") | $raw %] |
1074 |
[% 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' %] |
1364 |
[% INCLUDE 'datatables.inc' %] |
1316 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
1365 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
1317 |
[% INCLUDE 'columns_settings.inc' %] |
1366 |
[% INCLUDE 'columns_settings.inc' %] |
|
|
1367 |
[% INCLUDE 'js-date-format.inc' %] |
1318 |
[% Asset.js("js/browser.js") | $raw %] |
1368 |
[% Asset.js("js/browser.js") | $raw %] |
1319 |
[% Asset.js("js/table_filters.js") | $raw %] |
1369 |
[% Asset.js("js/table_filters.js") | $raw %] |
1320 |
<script> |
1370 |
<script> |
Lines 1323-1328
Note that permanent location is a code, and location may be an authval.
Link Here
|
1323 |
browser.show(); |
1373 |
browser.show(); |
1324 |
|
1374 |
|
1325 |
$(document).ready(function() { |
1375 |
$(document).ready(function() { |
|
|
1376 |
|
1377 |
function createChild ( row, itemnumber ) { |
1378 |
// This is the table we'll convert into a DataTable |
1379 |
var bundles_table = $('<table class="display tbundle" data-itemnumber="'+itemnumber+'" width="100%"/>'); |
1380 |
|
1381 |
// Display it the child row |
1382 |
row.child( bundles_table ).show(); |
1383 |
|
1384 |
// Initialise as a DataTable |
1385 |
var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?"; |
1386 |
var bundle_table = bundles_table.api({ |
1387 |
"ajax": { |
1388 |
"url": bundle_table_url |
1389 |
}, |
1390 |
"header_filter": false, |
1391 |
"embed": [ |
1392 |
"biblio", |
1393 |
"checkout" |
1394 |
], |
1395 |
"order": [[ 1, "asc" ]], |
1396 |
"columns": [ |
1397 |
{ |
1398 |
"data": "biblio.title:biblio.medium", |
1399 |
"title": "Title", |
1400 |
"searchable": true, |
1401 |
"orderable": true, |
1402 |
"render": function(data, type, row, meta) { |
1403 |
var title = ""; |
1404 |
if ( row.biblio.title ) { |
1405 |
title = title.concat('<span class="biblio-title">',row.biblio.title,'</span>'); |
1406 |
} |
1407 |
if ( row.biblio.medium ) { |
1408 |
title = title.concat('<span class="biblio-medium">',row.biblio.medium,'</span>'); |
1409 |
} |
1410 |
return title; |
1411 |
} |
1412 |
}, |
1413 |
{ |
1414 |
"data": "biblio.author", |
1415 |
"title": "Author", |
1416 |
"searchable": true, |
1417 |
"orderable": true, |
1418 |
}, |
1419 |
{ |
1420 |
"data": "collection_code", |
1421 |
"title": "Collection code", |
1422 |
"searchable": true, |
1423 |
"orderable": true, |
1424 |
}, |
1425 |
{ |
1426 |
"data": "item_type", |
1427 |
"title": "Item Type", |
1428 |
"searchable": false, |
1429 |
"orderable": true, |
1430 |
}, |
1431 |
{ |
1432 |
"data": "callnumber", |
1433 |
"title": "Callnumber", |
1434 |
"searchable": true, |
1435 |
"orderable": true, |
1436 |
}, |
1437 |
{ |
1438 |
"data": "external_id", |
1439 |
"title": "Barcode", |
1440 |
"searchable": true, |
1441 |
"orderable": true, |
1442 |
}, |
1443 |
{ |
1444 |
"data": "lost_status:last_seen_date", |
1445 |
"title": "Status", |
1446 |
"searchable": false, |
1447 |
"orderable": true, |
1448 |
"render": function(data, type, row, meta) { |
1449 |
if ( row.lost_status ) { |
1450 |
return "Lost: " + row.lost_status; |
1451 |
} |
1452 |
return "Available"; |
1453 |
} |
1454 |
}, |
1455 |
{ |
1456 |
"data": function( row, type, val, meta ) { |
1457 |
var result = '<button class="btn btn-default btn-xs remove" role="button" data-itemnumber="'+row.item_id+'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Remove")+'</button>\n'; |
1458 |
return result; |
1459 |
}, |
1460 |
"title": "Actions", |
1461 |
"searchable": false, |
1462 |
"orderable": false |
1463 |
} |
1464 |
] |
1465 |
}, [], 1); |
1466 |
|
1467 |
$(".tbundle").on("click", ".remove", function(){ |
1468 |
console.log("Button Clicked"); |
1469 |
var bundle_table = $(this).closest('table'); |
1470 |
var host_itemnumber = bundle_table.data('itemnumber'); |
1471 |
var component_itemnumber = $(this).data('itemnumber'); |
1472 |
var unlink_item_url = "/api/v1/items/" + host_itemnumber + "/bundled_items/item/" + component_itemnumber; |
1473 |
$.ajax({ |
1474 |
type: "DELETE", |
1475 |
url: unlink_item_url, |
1476 |
success: function(){ |
1477 |
bundle_table.DataTable({ 'retrieve': true }).draw(false); |
1478 |
} |
1479 |
}); |
1480 |
}); |
1481 |
|
1482 |
return; |
1483 |
} |
1484 |
|
1485 |
|
1326 |
var ids = ['holdings_table', 'otherholdings_table']; |
1486 |
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 %] ]; |
1487 |
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 %]"]; |
1488 |
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>', |
1499 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
1340 |
}; |
1500 |
}; |
1341 |
var table = KohaTable(id, dt_parameters, columns_settings[i], 'with_filters'); |
1501 |
var table = KohaTable(id, dt_parameters, columns_settings[i], 'with_filters'); |
|
|
1502 |
|
1503 |
// Add event listener for opening and closing details |
1504 |
$('#' + id + ' tbody').on('click', 'td.details-control', function () { |
1505 |
var tr = $(this).closest('tr'); |
1506 |
var dTable = $(this).closest('table').DataTable({ 'retrieve': true }); |
1507 |
|
1508 |
var itemnumber = tr.data('itemnumber'); |
1509 |
var row = dTable.row( tr ); |
1510 |
|
1511 |
if ( row.child.isShown() ) { |
1512 |
// This row is already open - close it |
1513 |
row.child.hide(); |
1514 |
tr.removeClass('shown'); |
1515 |
} |
1516 |
else { |
1517 |
// Open this row |
1518 |
createChild(row, itemnumber); |
1519 |
tr.addClass('shown'); |
1520 |
} |
1521 |
} ); |
1342 |
} |
1522 |
} |
1343 |
|
1523 |
|
1344 |
[% IF Koha.Preference('AcquisitionDetails') %] |
1524 |
[% 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" |
1540 |
"sPaginationType": "full" |
1361 |
})); |
1541 |
})); |
1362 |
[% END %] |
1542 |
[% END %] |
|
|
1543 |
|
1544 |
$("#bundleItemsModal").on("shown.bs.modal", function(e){ |
1545 |
var button = $(e.relatedTarget); |
1546 |
var item_id = button.data('item'); |
1547 |
$("#result").replaceWith('<div id="result"></div>'); |
1548 |
$("#bundleItemsForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items/item'); |
1549 |
$("#external_id").focus(); |
1550 |
}); |
1551 |
|
1552 |
$("#bundleItemsForm").submit(function(event) { |
1553 |
|
1554 |
/* stop form from submitting normally */ |
1555 |
event.preventDefault(); |
1556 |
|
1557 |
/* get the action attribute from the <form action=""> element */ |
1558 |
var $form = $(this), |
1559 |
url = $form.attr('action'); |
1560 |
|
1561 |
/* Send the data using post with external_id */ |
1562 |
var posting = $.post(url, JSON.stringify({ |
1563 |
external_id: $('#external_id').val() |
1564 |
}), null, "json"); |
1565 |
|
1566 |
/* Report the results */ |
1567 |
posting.done(function(data) { |
1568 |
var barcode = $('#external_id').val(); |
1569 |
$('#result').replaceWith('<div id="result" class="alert alert-success">Success: Added '+barcode+'</div>'); |
1570 |
$('#external_id').val('').focus(); |
1571 |
}); |
1572 |
posting.fail(function(data) { |
1573 |
var barcode = $('#external_id').val(); |
1574 |
if ( data.status === 409 ) { |
1575 |
var response = data.responseJSON; |
1576 |
if ( response.key === "PRIMARY" ) { |
1577 |
$('#result').replaceWith('<div id="result" class="alert alert-warning">Warning: Item '+barcode+' already attached</div>'); |
1578 |
} else { |
1579 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure: Item '+barcode+' belongs to another bundle</div>'); |
1580 |
} |
1581 |
} else { |
1582 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure</div>'); |
1583 |
} |
1584 |
$('#external_id').val('').focus(); |
1585 |
}); |
1586 |
}); |
1363 |
}); |
1587 |
}); |
1364 |
|
1588 |
|
1365 |
$(document).ready(function() { |
1589 |
$(document).ready(function() { |