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