|
Lines 273-278
Link Here
|
| 273 |
<a href="#holdings">Holdings ([% itemloop.size() || 0 | html %])</a> |
273 |
<a href="#holdings">Holdings ([% itemloop.size() || 0 | html %])</a> |
| 274 |
</li> |
274 |
</li> |
| 275 |
[% END %] |
275 |
[% END %] |
|
|
276 |
[% IF Koha.Preference('EnableVolumes') %]<li><a href="#volumes">Volumes</a></li>[% END %] |
| 276 |
[% IF ( MARCNOTES || notes ) %]<li><a href="#description">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %] |
277 |
[% IF ( MARCNOTES || notes ) %]<li><a href="#description">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %] |
| 277 |
[% IF ( subscriptionsnumber ) %]<li><a href="#subscriptions">Subscriptions</a></li>[% END %] |
278 |
[% IF ( subscriptionsnumber ) %]<li><a href="#subscriptions">Subscriptions</a></li>[% END %] |
| 278 |
[% IF Koha.Preference('AcquisitionDetails') %]<li><a href="#acq_details">Acquisition details</a></li>[% END %] |
279 |
[% IF Koha.Preference('AcquisitionDetails') %]<li><a href="#acq_details">Acquisition details</a></li>[% END %] |
|
Lines 602-607
Note that permanent location is a code, and location may be an authval.
Link Here
|
| 602 |
|
603 |
|
| 603 |
[% END %][%# end of block items_table %] |
604 |
[% END %][%# end of block items_table %] |
| 604 |
|
605 |
|
|
|
606 |
[% IF Koha.Preference('EnableVolumes') %] |
| 607 |
<div id="volumes"> |
| 608 |
<div class="volumes_table_table_controls"> |
| 609 |
<a href="#" class="volume-create btn btn-default btn-xs"><i class="fa fa-plus"></i> Create new</a> |
| 610 |
</div> |
| 611 |
<table class="volumes-table" id="volumes-table"> |
| 612 |
<thead> |
| 613 |
<tr> |
| 614 |
<td>Display Order</td> |
| 615 |
<td>Description</td> |
| 616 |
<td> </td> |
| 617 |
</tr> |
| 618 |
</thead> |
| 619 |
</table> |
| 620 |
</div> |
| 621 |
[% END %] |
| 622 |
|
| 605 |
<div id="holdings"> |
623 |
<div id="holdings"> |
| 606 |
|
624 |
|
| 607 |
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] |
625 |
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] |
|
Lines 1020-1025
Note that permanent location is a code, and location may be an authval.
Link Here
|
| 1020 |
|
1038 |
|
| 1021 |
[% END %] |
1039 |
[% END %] |
| 1022 |
|
1040 |
|
|
|
1041 |
<div class="modal fade" id="modal-volume-create" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label"> |
| 1042 |
<div class="modal-dialog"> |
| 1043 |
<div class="modal-content"> |
| 1044 |
<div class="modal-header"> |
| 1045 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 1046 |
<h3 id="modal-volume-create-label"><i class="fa fa-plus"></i> Create a new volume</h3> |
| 1047 |
</div> |
| 1048 |
<form id="modal-volume-create-form" class="validated"> |
| 1049 |
<div class="modal-body"> |
| 1050 |
<fieldset> |
| 1051 |
<p> |
| 1052 |
<label for="volume_description" class="required">Name: </label> |
| 1053 |
<input name="description" id="modal-volume-create-form-description" type="text" size="30" required="required" class="required" /> |
| 1054 |
<span class="required">Required</span> |
| 1055 |
</p> |
| 1056 |
<p> |
| 1057 |
<label for="volume_display_order" class="required">Display order: </label> |
| 1058 |
<input name="display_order" id="modal-volume-create-form-display_order" value="0" type="number" size="5" required="required" class="required" /> |
| 1059 |
<span class="required">Required</span> |
| 1060 |
<br/> |
| 1061 |
<span class="hint">Numbers only, volumes will be displayed in counting order</span> |
| 1062 |
</p> |
| 1063 |
</fieldset> |
| 1064 |
</div> |
| 1065 |
<div class="modal-footer"> |
| 1066 |
<button id="modal-volume-create-submit" class="btn btn-default"><i class="fa fa-plus"></i> Submit</button> |
| 1067 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
| 1068 |
</div> |
| 1069 |
</form> |
| 1070 |
</div> |
| 1071 |
</div> |
| 1072 |
</div> |
| 1073 |
|
| 1074 |
<div class="modal fade" id="modal-volume-edit" tabindex="-1" role="dialog" aria-labelledby="modal-volume-edit-label"> |
| 1075 |
<div class="modal-dialog"> |
| 1076 |
<div class="modal-content"> |
| 1077 |
<div class="modal-header"> |
| 1078 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 1079 |
<h3 id="modal-volume-edit-label"><i class='fa fa-edit'></i> Edit volume</h3> |
| 1080 |
</div> |
| 1081 |
<form id="modal-volume-edit-form" class="validated"> |
| 1082 |
<div class="modal-body"> |
| 1083 |
<fieldset> |
| 1084 |
<p> |
| 1085 |
<label for="volume_description" class="required">Name: </label> |
| 1086 |
<input name="description" id="modal-volume-edit-form-description" type="text" size="30" required="required" class="required" /> |
| 1087 |
<span class="required">Required</span> |
| 1088 |
</p> |
| 1089 |
<p> |
| 1090 |
<label for="volume_display_order" class="required">Sort order: </label> |
| 1091 |
<input name="display_order" id="modal-volume-edit-form-display_order" type="number" size="5" /> |
| 1092 |
<span class="hint">Numbers only, volumes will be displayed in counting order</span> |
| 1093 |
</p> |
| 1094 |
</fieldset> |
| 1095 |
</div> |
| 1096 |
<div class="modal-footer"> |
| 1097 |
<button id="modal-volume-edit-submit" class="btn btn-default"><i class='fa fa-edit'></i> Submit</button> |
| 1098 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
| 1099 |
</div> |
| 1100 |
</form> |
| 1101 |
</div> |
| 1102 |
</div> |
| 1103 |
</div> |
| 1104 |
|
| 1105 |
<div class="modal fade" id="modal-volume-delete" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label"> |
| 1106 |
<div class="modal-dialog"> |
| 1107 |
<div class="modal-content"> |
| 1108 |
<div class="modal-header"> |
| 1109 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 1110 |
<h3 id="modal-volume-delete-label"><i class='fa fa-trash'></i> Delete volume</h3> |
| 1111 |
</div> |
| 1112 |
<div class="modal-body"> |
| 1113 |
Are you sure you want to delete this volume? |
| 1114 |
</div> |
| 1115 |
<div class="modal-footer"> |
| 1116 |
<button id="modal-volume-delete-submit" class="btn btn-danger"><i class='fa fa-trash'></i> Delete</button> |
| 1117 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
| 1118 |
</div> |
| 1119 |
</div> |
| 1120 |
</div> |
| 1121 |
</div> |
| 1122 |
|
| 1023 |
[% MACRO jsinclude BLOCK %] |
1123 |
[% MACRO jsinclude BLOCK %] |
| 1024 |
[% INCLUDE 'catalog-strings.inc' %] |
1124 |
[% INCLUDE 'catalog-strings.inc' %] |
| 1025 |
[% Asset.js("js/catalog.js") | $raw %] |
1125 |
[% Asset.js("js/catalog.js") | $raw %] |
|
Lines 1368-1373
Note that permanent location is a code, and location may be an authval.
Link Here
|
| 1368 |
if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)}; |
1468 |
if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)}; |
| 1369 |
if ( search_value ){ $('#cat-search-block #search-form').val(search_value)}; |
1469 |
if ( search_value ){ $('#cat-search-block #search-form').val(search_value)}; |
| 1370 |
}); |
1470 |
}); |
|
|
1471 |
|
| 1472 |
[% IF Koha.Preference('EnableVolumes') %] |
| 1473 |
// Load volumes table |
| 1474 |
var volumesTable = KohaTable("volumes-table", { |
| 1475 |
"bAutoWidth": false, |
| 1476 |
'sDom': '<"top pager"ilp>t<"bottom pager"ip>r', |
| 1477 |
"aoColumns": [ |
| 1478 |
{ |
| 1479 |
"mDataProp": function( oObj ) { |
| 1480 |
return oObj.display_order; |
| 1481 |
}, |
| 1482 |
}, |
| 1483 |
{ |
| 1484 |
"mDataProp": function( oObj ) { |
| 1485 |
return oObj.description; |
| 1486 |
}, |
| 1487 |
}, |
| 1488 |
{ |
| 1489 |
"mDataProp": function( oObj ) { |
| 1490 |
return `<button class='volume-edit btn btn-default btn-xs' data-volume-id='${oObj.volume_id}'> |
| 1491 |
<i class='fa fa-edit'></i> ${_('Edit')} |
| 1492 |
</button>` |
| 1493 |
+ ' ' |
| 1494 |
+ `<button class='volume-delete btn btn-default btn-xs' data-volume-id='${oObj.volume_id}'> |
| 1495 |
<i class='fa fa-trash'></i> ${('Delete')} |
| 1496 |
</button>`; |
| 1497 |
}, |
| 1498 |
}, |
| 1499 |
], |
| 1500 |
"bPaginate": false, |
| 1501 |
"bProcessing": true, |
| 1502 |
"bServerSide": false, |
| 1503 |
"sAjaxSource": `/api/v1/biblios/${biblionumber}/volumes?_per_page=-1`, |
| 1504 |
"sAjaxDataProp": "", |
| 1505 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
| 1506 |
$.getJSON( sSource, aoData, function (json) { |
| 1507 |
fnCallback(json) |
| 1508 |
} ); |
| 1509 |
}, |
| 1510 |
}); |
| 1511 |
|
| 1512 |
// Create new volumes |
| 1513 |
$('.volume-create').on('click', function(){ |
| 1514 |
$('#modal-volume-create-form-description').val(""); |
| 1515 |
$('#modal-volume-create-submit').removeAttr('disabled'); |
| 1516 |
$('#modal-volume-create').modal('show'); |
| 1517 |
}); |
| 1518 |
|
| 1519 |
$("#modal-volume-create-form").validate({ |
| 1520 |
submitHandler: function(form) { |
| 1521 |
$.ajax({ |
| 1522 |
url: `/api/v1/biblios/${biblionumber}/volumes`, |
| 1523 |
headers: { "x-koha-embed": "items" }, |
| 1524 |
success: function(volumes){ |
| 1525 |
$('#modal-volume-create-submit').attr('disabled', 'disabled'); |
| 1526 |
|
| 1527 |
var settings = { |
| 1528 |
"url": `/api/v1/biblios/${biblionumber}/volumes`, |
| 1529 |
"method": "POST", |
| 1530 |
"headers": { |
| 1531 |
"Content-Type": "application/json" |
| 1532 |
}, |
| 1533 |
"data": JSON.stringify( |
| 1534 |
{ |
| 1535 |
"description": $("#modal-volume-create-form-description").val(), |
| 1536 |
"display_order": $("#modal-volume-create-form-display_order").val(), |
| 1537 |
} |
| 1538 |
), |
| 1539 |
}; |
| 1540 |
|
| 1541 |
$.ajax(settings) |
| 1542 |
.done(function (response) { |
| 1543 |
$('#volume-add-form-select').append($('<option>', { |
| 1544 |
value: response.volume_id, |
| 1545 |
text: response.description |
| 1546 |
})); |
| 1547 |
|
| 1548 |
$('#modal-volume-create').modal('hide'); |
| 1549 |
if ( volumes.length == 0 ) { |
| 1550 |
// This bib has no previous volumes, reload the page |
| 1551 |
window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`); |
| 1552 |
} else { |
| 1553 |
// Has other volumes, just reload the table |
| 1554 |
volumesTable.api().ajax.reload(); |
| 1555 |
} |
| 1556 |
}) |
| 1557 |
.fail(function(err) { |
| 1558 |
var message = err.responseJSON.error; |
| 1559 |
alert(message); |
| 1560 |
}); |
| 1561 |
} |
| 1562 |
}); |
| 1563 |
} |
| 1564 |
}); |
| 1565 |
|
| 1566 |
$('#modal-volume-create').on('shown.bs.modal', function () { |
| 1567 |
$('#modal-volume-create-form-description').focus(); |
| 1568 |
}) |
| 1569 |
|
| 1570 |
// Edit existing volumes |
| 1571 |
$('body').on( 'click', '.volume-edit', function(){ |
| 1572 |
const volume_id = $(this).data('volume-id'); |
| 1573 |
const url = `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`; |
| 1574 |
$.get( url, function( data ) { |
| 1575 |
$('#modal-volume-edit-form-description').val( data.description ); |
| 1576 |
$('#modal-volume-edit-form-display_order').val( data.display_order ); |
| 1577 |
$('#modal-volume-edit-submit').data('volume-id', volume_id ); |
| 1578 |
$('#modal-volume-edit-submit').removeAttr('disabled'); |
| 1579 |
$('#modal-volume-edit').modal('show'); |
| 1580 |
}); |
| 1581 |
}); |
| 1582 |
|
| 1583 |
$("#modal-volume-edit-form").validate({ |
| 1584 |
submitHandler: function(form) { |
| 1585 |
$('#modal-volume-edit-submit').attr('disabled', 'disabled'); |
| 1586 |
|
| 1587 |
const volume_id = $('#modal-volume-edit-submit').data('volume-id'); |
| 1588 |
const url = `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`; |
| 1589 |
|
| 1590 |
var settings = { |
| 1591 |
"url": url, |
| 1592 |
"method": "PUT", |
| 1593 |
"headers": { |
| 1594 |
"Content-Type": "application/json" |
| 1595 |
}, |
| 1596 |
"data": JSON.stringify( |
| 1597 |
{ |
| 1598 |
"description": $("#modal-volume-edit-form-description").val(), |
| 1599 |
"display_order": $("#modal-volume-edit-form-display_order").val(), |
| 1600 |
} |
| 1601 |
), |
| 1602 |
}; |
| 1603 |
|
| 1604 |
$.ajax(settings) |
| 1605 |
.done(function (response) { |
| 1606 |
$('#modal-volume-edit').modal('hide'); |
| 1607 |
volumesTable.api().ajax.reload(); |
| 1608 |
}) |
| 1609 |
.fail(function(err) { |
| 1610 |
var message = err.responseJSON.error; |
| 1611 |
alert(message); |
| 1612 |
}); |
| 1613 |
} |
| 1614 |
}); |
| 1615 |
|
| 1616 |
$('#modal-volume-edit').on('shown.bs.modal', function () { |
| 1617 |
$('#modal-volume-edit-form-description').focus(); |
| 1618 |
}) |
| 1619 |
|
| 1620 |
// Delete existing volumes |
| 1621 |
$('body').on( 'click', '.volume-delete', function(){ |
| 1622 |
const volume_id = $(this).data('volume-id'); |
| 1623 |
$('#modal-volume-delete-submit').data('volume-id', volume_id ); |
| 1624 |
$('#modal-volume-delete-submit').removeAttr('disabled'); |
| 1625 |
$('#modal-volume-delete').modal('show'); |
| 1626 |
}); |
| 1627 |
$("#modal-volume-delete-submit").on('click', function(){ |
| 1628 |
$('#modal-volume-delete-submit').attr('disabled', 'disabled'); |
| 1629 |
const volume_id = $("#modal-volume-delete-submit").data('volume-id'); |
| 1630 |
|
| 1631 |
$.ajax({ |
| 1632 |
url: `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`, |
| 1633 |
headers: { "x-koha-embed": "items" }, |
| 1634 |
success: function(volume_data){ |
| 1635 |
$.ajax({ |
| 1636 |
"url": `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`, |
| 1637 |
"method": "DELETE", |
| 1638 |
}) |
| 1639 |
.done(function (response) { |
| 1640 |
$('#modal-volume-delete').modal('hide'); |
| 1641 |
$(`#volume-add-form-select option[value='${volume_id}']`).remove(); |
| 1642 |
if ( volume_data.items === null ) { |
| 1643 |
// No items for this volume, we can just refresh the table |
| 1644 |
volumesTable.api().ajax.reload(); |
| 1645 |
} else { |
| 1646 |
// This volume had items attached to it, we need to reload the page |
| 1647 |
window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`); |
| 1648 |
} |
| 1649 |
}) |
| 1650 |
.fail(function(err) { |
| 1651 |
var message = err.responseJSON.error; |
| 1652 |
alert(message); |
| 1653 |
}); |
| 1654 |
} |
| 1655 |
}); |
| 1656 |
}); |
| 1657 |
[% END %] |
| 1371 |
</script> |
1658 |
</script> |
| 1372 |
[% END %] |
1659 |
[% END %] |
| 1373 |
[% INCLUDE 'intranet-bottom.inc' %] |
1660 |
[% INCLUDE 'intranet-bottom.inc' %] |
| 1374 |
- |
|
|