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 1341-1346
Note that permanent location is a code, and location may be an authval.
Link Here
|
1341 |
browser.show(); |
1378 |
browser.show(); |
1342 |
|
1379 |
|
1343 |
$(document).ready(function() { |
1380 |
$(document).ready(function() { |
|
|
1381 |
|
1382 |
function createChild ( row, itemnumber ) { |
1383 |
|
1384 |
// Toolbar |
1385 |
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>'); |
1386 |
|
1387 |
// This is the table we'll convert into a DataTable |
1388 |
var bundles_table = $('<table class="display tbundle" data-itemnumber="'+itemnumber+'" id="bundle_table_'+itemnumber+'" width="100%"/>'); |
1389 |
|
1390 |
// Display it the child row |
1391 |
row.child( bundle_toolbar.add(bundles_table) ).show(); |
1392 |
|
1393 |
// Initialise as a DataTable |
1394 |
var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?"; |
1395 |
var bundle_table = bundles_table.kohaTable({ |
1396 |
"ajax": { |
1397 |
"url": bundle_table_url |
1398 |
}, |
1399 |
"header_filter": false, |
1400 |
"embed": [ |
1401 |
"biblio" |
1402 |
], |
1403 |
"order": [[ 1, "asc" ]], |
1404 |
"columns": [ |
1405 |
{ |
1406 |
"data": "biblio.title:biblio.medium", |
1407 |
"title": "Title", |
1408 |
"searchable": true, |
1409 |
"orderable": true, |
1410 |
"render": function(data, type, row, meta) { |
1411 |
var title = ""; |
1412 |
if ( row.biblio.title ) { |
1413 |
title = title.concat('<span class="biblio-title">',row.biblio.title,'</span>'); |
1414 |
} |
1415 |
if ( row.biblio.medium ) { |
1416 |
title = title.concat('<span class="biblio-medium">',row.biblio.medium,'</span>'); |
1417 |
} |
1418 |
return title; |
1419 |
} |
1420 |
}, |
1421 |
{ |
1422 |
"data": "biblio.author", |
1423 |
"title": "Author", |
1424 |
"searchable": true, |
1425 |
"orderable": true, |
1426 |
}, |
1427 |
{ |
1428 |
"data": "collection_code", |
1429 |
"title": "Collection code", |
1430 |
"searchable": true, |
1431 |
"orderable": true, |
1432 |
}, |
1433 |
{ |
1434 |
"data": "item_type", |
1435 |
"title": "Item Type", |
1436 |
"searchable": false, |
1437 |
"orderable": true, |
1438 |
}, |
1439 |
{ |
1440 |
"data": "callnumber", |
1441 |
"title": "Callnumber", |
1442 |
"searchable": true, |
1443 |
"orderable": true, |
1444 |
}, |
1445 |
{ |
1446 |
"data": "external_id", |
1447 |
"title": "Barcode", |
1448 |
"searchable": true, |
1449 |
"orderable": true, |
1450 |
}, |
1451 |
{ |
1452 |
"data": "lost_status:last_seen_date", |
1453 |
"title": "Status", |
1454 |
"searchable": false, |
1455 |
"orderable": true, |
1456 |
"render": function(data, type, row, meta) { |
1457 |
if ( row.lost_status ) { |
1458 |
return "Lost: " + row.lost_status; |
1459 |
} |
1460 |
return ""; |
1461 |
} |
1462 |
}, |
1463 |
{ |
1464 |
"data": function( row, type, val, meta ) { |
1465 |
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'; |
1466 |
return result; |
1467 |
}, |
1468 |
"title": "Actions", |
1469 |
"searchable": false, |
1470 |
"orderable": false, |
1471 |
"class": "noExport" |
1472 |
} |
1473 |
] |
1474 |
}, [], 1); |
1475 |
|
1476 |
$(".tbundle").on("click", ".remove", function(){ |
1477 |
var bundle_table = $(this).closest('table'); |
1478 |
var host_itemnumber = bundle_table.data('itemnumber'); |
1479 |
var component_itemnumber = $(this).data('itemnumber'); |
1480 |
var unlink_item_url = "/api/v1/items/" + host_itemnumber + "/bundled_items/item/" + component_itemnumber; |
1481 |
$.ajax({ |
1482 |
type: "DELETE", |
1483 |
url: unlink_item_url, |
1484 |
success: function(){ |
1485 |
bundle_table.DataTable({ 'retrieve': true }).draw(false); |
1486 |
} |
1487 |
}); |
1488 |
}); |
1489 |
|
1490 |
return; |
1491 |
} |
1492 |
|
1493 |
|
1344 |
var ids = ['holdings_table', 'otherholdings_table']; |
1494 |
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 %] ]; |
1495 |
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 %]"]; |
1496 |
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>', |
1507 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
1358 |
}; |
1508 |
}; |
1359 |
var table = KohaTable(id, dt_parameters, columns_settings[i], 'with_filters'); |
1509 |
var table = KohaTable(id, dt_parameters, columns_settings[i], 'with_filters'); |
|
|
1510 |
|
1511 |
// Add event listener for opening and closing details |
1512 |
$('#' + id + ' tbody').on('click', 'button.details-control', function () { |
1513 |
var tr = $(this).closest('tr'); |
1514 |
var dTable = $(this).closest('table').DataTable({ 'retrieve': true }); |
1515 |
|
1516 |
var itemnumber = tr.data('itemnumber'); |
1517 |
var row = dTable.row( tr ); |
1518 |
|
1519 |
if ( row.child.isShown() ) { |
1520 |
// This row is already open - close it |
1521 |
row.child.hide(); |
1522 |
tr.removeClass('shown'); |
1523 |
} |
1524 |
else { |
1525 |
// Open this row |
1526 |
createChild(row, itemnumber); |
1527 |
tr.addClass('shown'); |
1528 |
} |
1529 |
} ); |
1360 |
} |
1530 |
} |
1361 |
|
1531 |
|
1362 |
[% IF Koha.Preference('AcquisitionDetails') %] |
1532 |
[% 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" |
1548 |
"sPaginationType": "full" |
1379 |
})); |
1549 |
})); |
1380 |
[% END %] |
1550 |
[% END %] |
|
|
1551 |
|
1552 |
var bundle_changed; |
1553 |
var bundle_form_active; |
1554 |
$("#bundleItemsModal").on("shown.bs.modal", function(e){ |
1555 |
var button = $(e.relatedTarget); |
1556 |
var item_id = button.data('item'); |
1557 |
$("#result").replaceWith('<div id="result"></div>'); |
1558 |
$("#bundleItemsForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items/item'); |
1559 |
$("#external_id").focus(); |
1560 |
bundle_changed = 0; |
1561 |
bundle_form_active = item_id; |
1562 |
}); |
1563 |
|
1564 |
$("#bundleItemsForm").submit(function(event) { |
1565 |
|
1566 |
/* stop form from submitting normally */ |
1567 |
event.preventDefault(); |
1568 |
|
1569 |
/* get the action attribute from the <form action=""> element */ |
1570 |
var $form = $(this), |
1571 |
url = $form.attr('action'); |
1572 |
|
1573 |
/* Send the data using post with external_id */ |
1574 |
var posting = $.post(url, JSON.stringify({ |
1575 |
external_id: $('#external_id').val() |
1576 |
}), null, "json"); |
1577 |
|
1578 |
/* Report the results */ |
1579 |
posting.done(function(data) { |
1580 |
var barcode = $('#external_id').val(); |
1581 |
$('#result').replaceWith('<div id="result" class="alert alert-success">Success: Added '+barcode+'</div>'); |
1582 |
$('#external_id').val('').focus(); |
1583 |
bundle_changed = 1; |
1584 |
}); |
1585 |
posting.fail(function(data) { |
1586 |
var barcode = $('#external_id').val(); |
1587 |
if ( data.status === 409 ) { |
1588 |
var response = data.responseJSON; |
1589 |
if ( response.key === "PRIMARY" ) { |
1590 |
$('#result').replaceWith('<div id="result" class="alert alert-warning">Warning: Item '+barcode+' already attached</div>'); |
1591 |
} else { |
1592 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure: Item '+barcode+' belongs to another bundle</div>'); |
1593 |
} |
1594 |
} else { |
1595 |
$('#result').replaceWith('<div id="result" class="alert alert-danger">Failure</div>'); |
1596 |
} |
1597 |
$('#external_id').val('').focus(); |
1598 |
}); |
1599 |
}); |
1600 |
|
1601 |
$("#bundleItemsModal").on("hidden.bs.modal", function(e){ |
1602 |
if ( bundle_changed ) { |
1603 |
$('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload(); |
1604 |
} |
1605 |
bundle_form_active = 0; |
1606 |
bundle_changed = 0; |
1607 |
}); |
1381 |
}); |
1608 |
}); |
1382 |
|
1609 |
|
1383 |
$(document).ready(function() { |
1610 |
$(document).ready(function() { |
1384 |
- |
|
|