|
Lines 267-272
Link Here
|
| 267 |
<a href="#holdings">Holdings ([% itemloop.size() || 0 | html %])</a> |
267 |
<a href="#holdings">Holdings ([% itemloop.size() || 0 | html %])</a> |
| 268 |
</li> |
268 |
</li> |
| 269 |
[% END %] |
269 |
[% END %] |
|
|
270 |
[% IF Koha.Preference('EnableVolumes') %]<li><a href="#volumes">Volumes</a></li>[% END %] |
| 270 |
[% IF ( MARCNOTES || notes ) %]<li><a href="#description">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %] |
271 |
[% IF ( MARCNOTES || notes ) %]<li><a href="#description">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %] |
| 271 |
[% IF ( subscriptionsnumber ) %]<li><a href="#subscriptions">Subscriptions</a></li>[% END %] |
272 |
[% IF ( subscriptionsnumber ) %]<li><a href="#subscriptions">Subscriptions</a></li>[% END %] |
| 272 |
[% IF Koha.Preference('AcquisitionDetails') %]<li><a href="#acq_details">Acquisition details</a></li>[% END %] |
273 |
[% IF Koha.Preference('AcquisitionDetails') %]<li><a href="#acq_details">Acquisition details</a></li>[% END %] |
|
Lines 592-597
Note that permanent location is a code, and location may be an authval.
Link Here
|
| 592 |
|
593 |
|
| 593 |
[% END %][%# end of block items_table %] |
594 |
[% END %][%# end of block items_table %] |
| 594 |
|
595 |
|
|
|
596 |
[% IF Koha.Preference('EnableVolumes') %] |
| 597 |
<div id="volumes"> |
| 598 |
<div class="volumes_table_table_controls"> |
| 599 |
<a href="#" class="volume-create btn btn-default btn-xs"><i class="fa fa-plus"></i> Create new</a> |
| 600 |
</div> |
| 601 |
<table class="volumes-table" id="volumes-table"> |
| 602 |
<thead> |
| 603 |
<tr> |
| 604 |
<td>Display Order</td> |
| 605 |
<td>Description</td> |
| 606 |
<td> </td> |
| 607 |
</tr> |
| 608 |
</thead> |
| 609 |
</table> |
| 610 |
</div> |
| 611 |
[% END %] |
| 612 |
|
| 595 |
<div id="holdings"> |
613 |
<div id="holdings"> |
| 596 |
|
614 |
|
| 597 |
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] |
615 |
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] |
|
Lines 1010-1015
Note that permanent location is a code, and location may be an authval.
Link Here
|
| 1010 |
|
1028 |
|
| 1011 |
[% END %] |
1029 |
[% END %] |
| 1012 |
|
1030 |
|
|
|
1031 |
<div class="modal fade" id="modal-volume-create" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label"> |
| 1032 |
<div class="modal-dialog"> |
| 1033 |
<div class="modal-content"> |
| 1034 |
<div class="modal-header"> |
| 1035 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 1036 |
<h3 id="modal-volume-create-label"><i class="fa fa-plus"></i> Create a new volume</h3> |
| 1037 |
</div> |
| 1038 |
<form id="modal-volume-create-form" class="validated"> |
| 1039 |
<div class="modal-body"> |
| 1040 |
<fieldset> |
| 1041 |
<p> |
| 1042 |
<label for="volume_description" class="required">Name: </label> |
| 1043 |
<input name="description" id="modal-volume-create-form-description" type="text" size="30" required="required" class="required" /> |
| 1044 |
<span class="required">Required</span> |
| 1045 |
</p> |
| 1046 |
<p> |
| 1047 |
<label for="volume_display_order" class="required">Display order: </label> |
| 1048 |
<input name="display_order" id="modal-volume-create-form-display_order" value="0" type="number" size="5" required="required" class="required" /> |
| 1049 |
<span class="required">Required</span> |
| 1050 |
<br/> |
| 1051 |
<span class="hint">Numbers only, volumes will be displayed in counting order</span> |
| 1052 |
</p> |
| 1053 |
</fieldset> |
| 1054 |
</div> |
| 1055 |
<div class="modal-footer"> |
| 1056 |
<button id="modal-volume-create-submit" class="btn btn-default"><i class="fa fa-plus"></i> Submit</button> |
| 1057 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
| 1058 |
</div> |
| 1059 |
</form> |
| 1060 |
</div> |
| 1061 |
</div> |
| 1062 |
</div> |
| 1063 |
|
| 1064 |
<div class="modal fade" id="modal-volume-edit" tabindex="-1" role="dialog" aria-labelledby="modal-volume-edit-label"> |
| 1065 |
<div class="modal-dialog"> |
| 1066 |
<div class="modal-content"> |
| 1067 |
<div class="modal-header"> |
| 1068 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 1069 |
<h3 id="modal-volume-edit-label"><i class='fa fa-edit'></i> Edit volume</h3> |
| 1070 |
</div> |
| 1071 |
<form id="modal-volume-edit-form" class="validated"> |
| 1072 |
<div class="modal-body"> |
| 1073 |
<fieldset> |
| 1074 |
<p> |
| 1075 |
<label for="volume_description" class="required">Name: </label> |
| 1076 |
<input name="description" id="modal-volume-edit-form-description" type="text" size="30" required="required" class="required" /> |
| 1077 |
<span class="required">Required</span> |
| 1078 |
</p> |
| 1079 |
<p> |
| 1080 |
<label for="volume_display_order" class="required">Sort order: </label> |
| 1081 |
<input name="display_order" id="modal-volume-edit-form-display_order" type="number" size="5" /> |
| 1082 |
<span class="hint">Numbers only, volumes will be displayed in counting order</span> |
| 1083 |
</p> |
| 1084 |
</fieldset> |
| 1085 |
</div> |
| 1086 |
<div class="modal-footer"> |
| 1087 |
<button id="modal-volume-edit-submit" class="btn btn-default"><i class='fa fa-edit'></i> Submit</button> |
| 1088 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
| 1089 |
</div> |
| 1090 |
</form> |
| 1091 |
</div> |
| 1092 |
</div> |
| 1093 |
</div> |
| 1094 |
|
| 1095 |
<div class="modal fade" id="modal-volume-delete" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label"> |
| 1096 |
<div class="modal-dialog"> |
| 1097 |
<div class="modal-content"> |
| 1098 |
<div class="modal-header"> |
| 1099 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 1100 |
<h3 id="modal-volume-delete-label"><i class='fa fa-trash'></i> Delete volume</h3> |
| 1101 |
</div> |
| 1102 |
<div class="modal-body"> |
| 1103 |
Are you sure you want to delete this volume? |
| 1104 |
</div> |
| 1105 |
<div class="modal-footer"> |
| 1106 |
<button id="modal-volume-delete-submit" class="btn btn-danger"><i class='fa fa-trash'></i> Delete</button> |
| 1107 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
| 1108 |
</div> |
| 1109 |
</div> |
| 1110 |
</div> |
| 1111 |
</div> |
| 1112 |
|
| 1013 |
[% MACRO jsinclude BLOCK %] |
1113 |
[% MACRO jsinclude BLOCK %] |
| 1014 |
[% INCLUDE 'catalog-strings.inc' %] |
1114 |
[% INCLUDE 'catalog-strings.inc' %] |
| 1015 |
[% Asset.js("js/catalog.js") | $raw %] |
1115 |
[% Asset.js("js/catalog.js") | $raw %] |
|
Lines 1336-1341
Note that permanent location is a code, and location may be an authval.
Link Here
|
| 1336 |
if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)}; |
1436 |
if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)}; |
| 1337 |
if ( search_value ){ $('#cat-search-block #search-form').val(search_value)}; |
1437 |
if ( search_value ){ $('#cat-search-block #search-form').val(search_value)}; |
| 1338 |
}); |
1438 |
}); |
|
|
1439 |
|
| 1440 |
[% IF Koha.Preference('EnableVolumes') %] |
| 1441 |
// Load volumes table |
| 1442 |
var volumesTable = KohaTable("volumes-table", { |
| 1443 |
"bAutoWidth": false, |
| 1444 |
'sDom': '<"top pager"ilp>t<"bottom pager"ip>r', |
| 1445 |
"aoColumns": [ |
| 1446 |
{ |
| 1447 |
"mDataProp": function( oObj ) { |
| 1448 |
return oObj.display_order; |
| 1449 |
}, |
| 1450 |
}, |
| 1451 |
{ |
| 1452 |
"mDataProp": function( oObj ) { |
| 1453 |
return oObj.description; |
| 1454 |
}, |
| 1455 |
}, |
| 1456 |
{ |
| 1457 |
"mDataProp": function( oObj ) { |
| 1458 |
return `<button class='volume-edit btn btn-default btn-xs' data-volume-id='${oObj.volume_id}'> |
| 1459 |
<i class='fa fa-edit'></i> ${_('Edit')} |
| 1460 |
</button>` |
| 1461 |
+ ' ' |
| 1462 |
+ `<button class='volume-delete btn btn-default btn-xs' data-volume-id='${oObj.volume_id}'> |
| 1463 |
<i class='fa fa-trash'></i> ${('Delete')} |
| 1464 |
</button>`; |
| 1465 |
}, |
| 1466 |
}, |
| 1467 |
], |
| 1468 |
"bPaginate": false, |
| 1469 |
"bProcessing": true, |
| 1470 |
"bServerSide": false, |
| 1471 |
"sAjaxSource": `/api/v1/biblios/${biblionumber}/volumes?_per_page=-1`, |
| 1472 |
"sAjaxDataProp": "", |
| 1473 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
| 1474 |
$.getJSON( sSource, aoData, function (json) { |
| 1475 |
fnCallback(json) |
| 1476 |
} ); |
| 1477 |
}, |
| 1478 |
}); |
| 1479 |
|
| 1480 |
// Create new volumes |
| 1481 |
$('.volume-create').on('click', function(){ |
| 1482 |
$('#modal-volume-create-form-description').val(""); |
| 1483 |
$('#modal-volume-create-submit').removeAttr('disabled'); |
| 1484 |
$('#modal-volume-create').modal('show'); |
| 1485 |
}); |
| 1486 |
|
| 1487 |
$("#modal-volume-create-form").validate({ |
| 1488 |
submitHandler: function(form) { |
| 1489 |
$.ajax({ |
| 1490 |
url: `/api/v1/biblios/${biblionumber}/volumes`, |
| 1491 |
headers: { "x-koha-embed": "items" }, |
| 1492 |
success: function(volumes){ |
| 1493 |
$('#modal-volume-create-submit').attr('disabled', 'disabled'); |
| 1494 |
|
| 1495 |
var settings = { |
| 1496 |
"url": `/api/v1/biblios/${biblionumber}/volumes`, |
| 1497 |
"method": "POST", |
| 1498 |
"headers": { |
| 1499 |
"Content-Type": "application/json" |
| 1500 |
}, |
| 1501 |
"data": JSON.stringify( |
| 1502 |
{ |
| 1503 |
"description": $("#modal-volume-create-form-description").val(), |
| 1504 |
"display_order": $("#modal-volume-create-form-display_order").val(), |
| 1505 |
} |
| 1506 |
), |
| 1507 |
}; |
| 1508 |
|
| 1509 |
$.ajax(settings) |
| 1510 |
.done(function (response) { |
| 1511 |
$('#volume-add-form-select').append($('<option>', { |
| 1512 |
value: response.volume_id, |
| 1513 |
text: response.description |
| 1514 |
})); |
| 1515 |
|
| 1516 |
$('#modal-volume-create').modal('hide'); |
| 1517 |
if ( volumes.length == 0 ) { |
| 1518 |
// This bib has no previous volumes, reload the page |
| 1519 |
window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`); |
| 1520 |
} else { |
| 1521 |
// Has other volumes, just reload the table |
| 1522 |
volumesTable.api().ajax.reload(); |
| 1523 |
} |
| 1524 |
}) |
| 1525 |
.fail(function(err) { |
| 1526 |
var message = err.responseJSON.error; |
| 1527 |
alert(message); |
| 1528 |
}); |
| 1529 |
} |
| 1530 |
}); |
| 1531 |
} |
| 1532 |
}); |
| 1533 |
|
| 1534 |
$('#modal-volume-create').on('shown.bs.modal', function () { |
| 1535 |
$('#modal-volume-create-form-description').focus(); |
| 1536 |
}) |
| 1537 |
|
| 1538 |
// Edit existing volumes |
| 1539 |
$('body').on( 'click', '.volume-edit', function(){ |
| 1540 |
const volume_id = $(this).data('volume-id'); |
| 1541 |
const url = `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`; |
| 1542 |
$.get( url, function( data ) { |
| 1543 |
$('#modal-volume-edit-form-description').val( data.description ); |
| 1544 |
$('#modal-volume-edit-form-display_order').val( data.display_order ); |
| 1545 |
$('#modal-volume-edit-submit').data('volume-id', volume_id ); |
| 1546 |
$('#modal-volume-edit-submit').removeAttr('disabled'); |
| 1547 |
$('#modal-volume-edit').modal('show'); |
| 1548 |
}); |
| 1549 |
}); |
| 1550 |
|
| 1551 |
$("#modal-volume-edit-form").validate({ |
| 1552 |
submitHandler: function(form) { |
| 1553 |
$('#modal-volume-edit-submit').attr('disabled', 'disabled'); |
| 1554 |
|
| 1555 |
const volume_id = $('#modal-volume-edit-submit').data('volume-id'); |
| 1556 |
const url = `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`; |
| 1557 |
|
| 1558 |
var settings = { |
| 1559 |
"url": url, |
| 1560 |
"method": "PUT", |
| 1561 |
"headers": { |
| 1562 |
"Content-Type": "application/json" |
| 1563 |
}, |
| 1564 |
"data": JSON.stringify( |
| 1565 |
{ |
| 1566 |
"description": $("#modal-volume-edit-form-description").val(), |
| 1567 |
"display_order": $("#modal-volume-edit-form-display_order").val(), |
| 1568 |
} |
| 1569 |
), |
| 1570 |
}; |
| 1571 |
|
| 1572 |
$.ajax(settings) |
| 1573 |
.done(function (response) { |
| 1574 |
$('#modal-volume-edit').modal('hide'); |
| 1575 |
volumesTable.api().ajax.reload(); |
| 1576 |
}) |
| 1577 |
.fail(function(err) { |
| 1578 |
var message = err.responseJSON.error; |
| 1579 |
alert(message); |
| 1580 |
}); |
| 1581 |
} |
| 1582 |
}); |
| 1583 |
|
| 1584 |
$('#modal-volume-edit').on('shown.bs.modal', function () { |
| 1585 |
$('#modal-volume-edit-form-description').focus(); |
| 1586 |
}) |
| 1587 |
|
| 1588 |
// Delete existing volumes |
| 1589 |
$('body').on( 'click', '.volume-delete', function(){ |
| 1590 |
const volume_id = $(this).data('volume-id'); |
| 1591 |
$('#modal-volume-delete-submit').data('volume-id', volume_id ); |
| 1592 |
$('#modal-volume-delete-submit').removeAttr('disabled'); |
| 1593 |
$('#modal-volume-delete').modal('show'); |
| 1594 |
}); |
| 1595 |
$("#modal-volume-delete-submit").on('click', function(){ |
| 1596 |
$('#modal-volume-delete-submit').attr('disabled', 'disabled'); |
| 1597 |
const volume_id = $("#modal-volume-delete-submit").data('volume-id'); |
| 1598 |
|
| 1599 |
$.ajax({ |
| 1600 |
url: `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`, |
| 1601 |
headers: { "x-koha-embed": "items" }, |
| 1602 |
success: function(volume_data){ |
| 1603 |
$.ajax({ |
| 1604 |
"url": `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`, |
| 1605 |
"method": "DELETE", |
| 1606 |
}) |
| 1607 |
.done(function (response) { |
| 1608 |
$('#modal-volume-delete').modal('hide'); |
| 1609 |
$(`#volume-add-form-select option[value='${volume_id}']`).remove(); |
| 1610 |
if ( volume_data.items === null ) { |
| 1611 |
// No items for this volume, we can just refresh the table |
| 1612 |
volumesTable.api().ajax.reload(); |
| 1613 |
} else { |
| 1614 |
// This volume had items attached to it, we need to reload the page |
| 1615 |
window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`); |
| 1616 |
} |
| 1617 |
}) |
| 1618 |
.fail(function(err) { |
| 1619 |
var message = err.responseJSON.error; |
| 1620 |
alert(message); |
| 1621 |
}); |
| 1622 |
} |
| 1623 |
}); |
| 1624 |
}); |
| 1625 |
[% END %] |
| 1339 |
</script> |
1626 |
</script> |
| 1340 |
[% END %] |
1627 |
[% END %] |
| 1341 |
[% INCLUDE 'intranet-bottom.inc' %] |
1628 |
[% INCLUDE 'intranet-bottom.inc' %] |
| 1342 |
- |
|
|