Lines 230-235
Link Here
|
230 |
<a href="#holdings">Holdings ([% itemloop.size() || 0 | html %])</a> |
230 |
<a href="#holdings">Holdings ([% itemloop.size() || 0 | html %])</a> |
231 |
</li> |
231 |
</li> |
232 |
[% END %] |
232 |
[% END %] |
|
|
233 |
[% IF Koha.Preference('EnableVolumes') %]<li><a href="#volumes">Volumes</a></li>[% END %] |
233 |
[% IF ( MARCNOTES || notes ) %]<li><a href="#description">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %] |
234 |
[% IF ( MARCNOTES || notes ) %]<li><a href="#description">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %] |
234 |
[% IF ( subscriptionsnumber ) %]<li><a href="#subscriptions">Subscriptions</a></li>[% END %] |
235 |
[% IF ( subscriptionsnumber ) %]<li><a href="#subscriptions">Subscriptions</a></li>[% END %] |
235 |
[% IF Koha.Preference('AcquisitionDetails') %]<li><a href="#acq_details">Acquisition details</a></li>[% END %] |
236 |
[% IF Koha.Preference('AcquisitionDetails') %]<li><a href="#acq_details">Acquisition details</a></li>[% END %] |
Lines 531-536
Note that permanent location is a code, and location may be an authval.
Link Here
|
531 |
</table> |
532 |
</table> |
532 |
[% END %][%# end of block items_table %] |
533 |
[% END %][%# end of block items_table %] |
533 |
|
534 |
|
|
|
535 |
[% IF Koha.Preference('EnableVolumes') %] |
536 |
<div id="volumes"> |
537 |
<div class="volumes_table_table_controls"> |
538 |
<a href="#" class="volume-create btn btn-default btn-xs"><i class="fa fa-plus"></i> Create new</a> |
539 |
</div> |
540 |
<table class="volumes-table" id="volumes-table"> |
541 |
<thead> |
542 |
<tr> |
543 |
<td>Display Order</td> |
544 |
<td>Description</td> |
545 |
<td> </td> |
546 |
</tr> |
547 |
</thead> |
548 |
</table> |
549 |
</div> |
550 |
[% END %] |
551 |
|
534 |
<div id="holdings"> |
552 |
<div id="holdings"> |
535 |
|
553 |
|
536 |
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] |
554 |
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] |
Lines 947-952
Note that permanent location is a code, and location may be an authval.
Link Here
|
947 |
|
965 |
|
948 |
[% END %] |
966 |
[% END %] |
949 |
|
967 |
|
|
|
968 |
<div class="modal fade" id="modal-volume-create" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label"> |
969 |
<div class="modal-dialog"> |
970 |
<div class="modal-content"> |
971 |
<div class="modal-header"> |
972 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
973 |
<h3 id="modal-volume-create-label"><i class="fa fa-plus"></i> Create a new volume</h3> |
974 |
</div> |
975 |
<form id="modal-volume-create-form" class="validated"> |
976 |
<div class="modal-body"> |
977 |
<fieldset> |
978 |
<p> |
979 |
<label for="volume_description" class="required">Name: </label> |
980 |
<input name="description" id="modal-volume-create-form-description" type="text" size="30" required="required" class="required" /> |
981 |
<span class="required">Required</span> |
982 |
</p> |
983 |
<p> |
984 |
<label for="volume_display_order" class="required">Display order: </label> |
985 |
<input name="display_order" id="modal-volume-create-form-display_order" value="0" type="number" size="5" required="required" class="required" /> |
986 |
<span class="required">Required</span> |
987 |
<br/> |
988 |
<span class="hint">Numbers only, volumes will be displayed in counting order</span> |
989 |
</p> |
990 |
</fieldset> |
991 |
</div> |
992 |
<div class="modal-footer"> |
993 |
<button id="modal-volume-create-submit" class="btn btn-default"><i class="fa fa-plus"></i> Submit</button> |
994 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
995 |
</div> |
996 |
</form> |
997 |
</div> |
998 |
</div> |
999 |
</div> |
1000 |
|
1001 |
<div class="modal fade" id="modal-volume-edit" tabindex="-1" role="dialog" aria-labelledby="modal-volume-edit-label"> |
1002 |
<div class="modal-dialog"> |
1003 |
<div class="modal-content"> |
1004 |
<div class="modal-header"> |
1005 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1006 |
<h3 id="modal-volume-edit-label"><i class='fa fa-edit'></i> Edit volume</h3> |
1007 |
</div> |
1008 |
<form id="modal-volume-edit-form" class="validated"> |
1009 |
<div class="modal-body"> |
1010 |
<fieldset> |
1011 |
<p> |
1012 |
<label for="volume_description" class="required">Name: </label> |
1013 |
<input name="description" id="modal-volume-edit-form-description" type="text" size="30" required="required" class="required" /> |
1014 |
<span class="required">Required</span> |
1015 |
</p> |
1016 |
<p> |
1017 |
<label for="volume_display_order" class="required">Sort order: </label> |
1018 |
<input name="display_order" id="modal-volume-edit-form-display_order" type="number" size="5" /> |
1019 |
<span class="hint">Numbers only, volumes will be displayed in counting order</span> |
1020 |
</p> |
1021 |
</fieldset> |
1022 |
</div> |
1023 |
<div class="modal-footer"> |
1024 |
<button id="modal-volume-edit-submit" class="btn btn-default"><i class='fa fa-edit'></i> Submit</button> |
1025 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
1026 |
</div> |
1027 |
</form> |
1028 |
</div> |
1029 |
</div> |
1030 |
</div> |
1031 |
|
1032 |
<div class="modal fade" id="modal-volume-delete" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label"> |
1033 |
<div class="modal-dialog"> |
1034 |
<div class="modal-content"> |
1035 |
<div class="modal-header"> |
1036 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
1037 |
<h3 id="modal-volume-delete-label"><i class='fa fa-trash'></i> Delete volume</h3> |
1038 |
</div> |
1039 |
<div class="modal-body"> |
1040 |
Are you sure you want to delete this volume? |
1041 |
</div> |
1042 |
<div class="modal-footer"> |
1043 |
<button id="modal-volume-delete-submit" class="btn btn-danger"><i class='fa fa-trash'></i> Delete</button> |
1044 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
1045 |
</div> |
1046 |
</div> |
1047 |
</div> |
1048 |
</div> |
1049 |
|
950 |
[% MACRO jsinclude BLOCK %] |
1050 |
[% MACRO jsinclude BLOCK %] |
951 |
[% INCLUDE 'catalog-strings.inc' %] |
1051 |
[% INCLUDE 'catalog-strings.inc' %] |
952 |
[% Asset.js("js/catalog.js") | $raw %] |
1052 |
[% Asset.js("js/catalog.js") | $raw %] |
Lines 1266-1271
Note that permanent location is a code, and location may be an authval.
Link Here
|
1266 |
})); |
1366 |
})); |
1267 |
[% END %] |
1367 |
[% END %] |
1268 |
}); |
1368 |
}); |
|
|
1369 |
|
1370 |
[% IF Koha.Preference('EnableVolumes') %] |
1371 |
// Load volumes table |
1372 |
var volumesTable = KohaTable("volumes-table", { |
1373 |
"bAutoWidth": false, |
1374 |
'sDom': '<"top pager"ilp>t<"bottom pager"ip>r', |
1375 |
"aoColumns": [ |
1376 |
{ |
1377 |
"mDataProp": function( oObj ) { |
1378 |
return oObj.display_order; |
1379 |
}, |
1380 |
}, |
1381 |
{ |
1382 |
"mDataProp": function( oObj ) { |
1383 |
return oObj.description; |
1384 |
}, |
1385 |
}, |
1386 |
{ |
1387 |
"mDataProp": function( oObj ) { |
1388 |
return `<button class='volume-edit btn btn-default btn-xs' data-volume-id='${oObj.volume_id}'> |
1389 |
<i class='fa fa-edit'></i> ${_('Edit')} |
1390 |
</button>` |
1391 |
+ ' ' |
1392 |
+ `<button class='volume-delete btn btn-default btn-xs' data-volume-id='${oObj.volume_id}'> |
1393 |
<i class='fa fa-trash'></i> ${('Delete')} |
1394 |
</button>`; |
1395 |
}, |
1396 |
}, |
1397 |
], |
1398 |
"bPaginate": false, |
1399 |
"bProcessing": true, |
1400 |
"bServerSide": false, |
1401 |
"sAjaxSource": `/api/v1/biblios/${biblionumber}/volumes`, |
1402 |
"sAjaxDataProp": "", |
1403 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
1404 |
$.getJSON( sSource, aoData, function (json) { |
1405 |
fnCallback(json) |
1406 |
} ); |
1407 |
}, |
1408 |
}); |
1409 |
|
1410 |
// Create new volumes |
1411 |
$('.volume-create').on('click', function(){ |
1412 |
$('#modal-volume-create-form-description').val(""); |
1413 |
$('#modal-volume-create-submit').removeAttr('disabled'); |
1414 |
$('#modal-volume-create').modal('show'); |
1415 |
}); |
1416 |
|
1417 |
$("#modal-volume-create-form").validate({ |
1418 |
submitHandler: function(form) { |
1419 |
$.ajax({ |
1420 |
url: `/api/v1/biblios/${biblionumber}/volumes`, |
1421 |
headers: { "x-koha-embed": "items" }, |
1422 |
success: function(volumes){ |
1423 |
$('#modal-volume-create-submit').attr('disabled', 'disabled'); |
1424 |
|
1425 |
var settings = { |
1426 |
"url": `/api/v1/biblios/${biblionumber}/volumes`, |
1427 |
"method": "POST", |
1428 |
"headers": { |
1429 |
"Content-Type": "application/json" |
1430 |
}, |
1431 |
"data": JSON.stringify( |
1432 |
{ |
1433 |
"description": $("#modal-volume-create-form-description").val(), |
1434 |
"display_order": $("#modal-volume-create-form-display_order").val(), |
1435 |
} |
1436 |
), |
1437 |
}; |
1438 |
|
1439 |
$.ajax(settings) |
1440 |
.done(function (response) { |
1441 |
$('#volume-add-form-select').append($('<option>', { |
1442 |
value: response.volume_id, |
1443 |
text: response.description |
1444 |
})); |
1445 |
|
1446 |
$('#modal-volume-create').modal('hide'); |
1447 |
if ( volumes.length == 0 ) { |
1448 |
// This bib has no previous volumes, reload the page |
1449 |
window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`); |
1450 |
} else { |
1451 |
// Has other volumes, just reload the table |
1452 |
volumesTable.api().ajax.reload(); |
1453 |
} |
1454 |
}) |
1455 |
.fail(function(err) { |
1456 |
var message = err.responseJSON.error; |
1457 |
alert(message); |
1458 |
}); |
1459 |
} |
1460 |
}); |
1461 |
} |
1462 |
}); |
1463 |
|
1464 |
$('#modal-volume-create').on('shown.bs.modal', function () { |
1465 |
$('#modal-volume-create-form-description').focus(); |
1466 |
}) |
1467 |
|
1468 |
// Edit existing volumes |
1469 |
$('body').on( 'click', '.volume-edit', function(){ |
1470 |
const volume_id = $(this).data('volume-id'); |
1471 |
const url = `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`; |
1472 |
$.get( url, function( data ) { |
1473 |
$('#modal-volume-edit-form-description').val( data.description ); |
1474 |
$('#modal-volume-edit-form-display_order').val( data.display_order ); |
1475 |
$('#modal-volume-edit-submit').data('volume-id', volume_id ); |
1476 |
$('#modal-volume-edit-submit').removeAttr('disabled'); |
1477 |
$('#modal-volume-edit').modal('show'); |
1478 |
}); |
1479 |
}); |
1480 |
|
1481 |
$("#modal-volume-edit-form").validate({ |
1482 |
submitHandler: function(form) { |
1483 |
$('#modal-volume-edit-submit').attr('disabled', 'disabled'); |
1484 |
|
1485 |
const volume_id = $('#modal-volume-edit-submit').data('volume-id'); |
1486 |
const url = `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`; |
1487 |
|
1488 |
var settings = { |
1489 |
"url": url, |
1490 |
"method": "PUT", |
1491 |
"headers": { |
1492 |
"Content-Type": "application/json" |
1493 |
}, |
1494 |
"data": JSON.stringify( |
1495 |
{ |
1496 |
"description": $("#modal-volume-edit-form-description").val(), |
1497 |
"display_order": $("#modal-volume-edit-form-display_order").val(), |
1498 |
} |
1499 |
), |
1500 |
}; |
1501 |
|
1502 |
$.ajax(settings) |
1503 |
.done(function (response) { |
1504 |
$('#modal-volume-edit').modal('hide'); |
1505 |
volumesTable.api().ajax.reload(); |
1506 |
}) |
1507 |
.fail(function(err) { |
1508 |
var message = err.responseJSON.error; |
1509 |
alert(message); |
1510 |
}); |
1511 |
} |
1512 |
}); |
1513 |
|
1514 |
$('#modal-volume-edit').on('shown.bs.modal', function () { |
1515 |
$('#modal-volume-edit-form-description').focus(); |
1516 |
}) |
1517 |
|
1518 |
// Delete existing volumes |
1519 |
$('body').on( 'click', '.volume-delete', function(){ |
1520 |
const volume_id = $(this).data('volume-id'); |
1521 |
$('#modal-volume-delete-submit').data('volume-id', volume_id ); |
1522 |
$('#modal-volume-delete-submit').removeAttr('disabled'); |
1523 |
$('#modal-volume-delete').modal('show'); |
1524 |
}); |
1525 |
$("#modal-volume-delete-submit").on('click', function(){ |
1526 |
$('#modal-volume-delete-submit').attr('disabled', 'disabled'); |
1527 |
const volume_id = $("#modal-volume-delete-submit").data('volume-id'); |
1528 |
|
1529 |
$.ajax({ |
1530 |
url: `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`, |
1531 |
headers: { "x-koha-embed": "items" }, |
1532 |
success: function(volume_data){ |
1533 |
$.ajax({ |
1534 |
"url": `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`, |
1535 |
"method": "DELETE", |
1536 |
}) |
1537 |
.done(function (response) { |
1538 |
$('#modal-volume-delete').modal('hide'); |
1539 |
$(`#volume-add-form-select option[value='${volume_id}']`).remove(); |
1540 |
if ( volume_data.items === null ) { |
1541 |
// No items for this volume, we can just refresh the table |
1542 |
volumesTable.api().ajax.reload(); |
1543 |
} else { |
1544 |
// This volume had items attached to it, we need to reload the page |
1545 |
window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`); |
1546 |
} |
1547 |
}) |
1548 |
.fail(function(err) { |
1549 |
var message = err.responseJSON.error; |
1550 |
alert(message); |
1551 |
}); |
1552 |
} |
1553 |
}); |
1554 |
}); |
1555 |
[% END %] |
1269 |
</script> |
1556 |
</script> |
1270 |
[% END %] |
1557 |
[% END %] |
1271 |
[% INCLUDE 'intranet-bottom.inc' %] |
1558 |
[% INCLUDE 'intranet-bottom.inc' %] |
1272 |
- |
|
|