|
Lines 184-189
Link Here
|
| 184 |
<a href="#holdings">Holdings ([% itemloop.size() || 0 | html %])</a> |
184 |
<a href="#holdings">Holdings ([% itemloop.size() || 0 | html %])</a> |
| 185 |
</li> |
185 |
</li> |
| 186 |
[% END %] |
186 |
[% END %] |
|
|
187 |
[% IF Koha.Preference('EnableVolumes') %]<li><a href="#volumes">Volumes</a></li>[% END %] |
| 187 |
[% IF ( MARCNOTES || notes ) %]<li><a href="#description">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %] |
188 |
[% IF ( MARCNOTES || notes ) %]<li><a href="#description">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %] |
| 188 |
[% IF ( subscriptionsnumber ) %]<li><a href="#subscriptions">Subscriptions</a></li>[% END %] |
189 |
[% IF ( subscriptionsnumber ) %]<li><a href="#subscriptions">Subscriptions</a></li>[% END %] |
| 189 |
[% IF Koha.Preference('AcquisitionDetails') %]<li><a href="#acq_details">Acquisition details</a></li>[% END %] |
190 |
[% IF Koha.Preference('AcquisitionDetails') %]<li><a href="#acq_details">Acquisition details</a></li>[% END %] |
|
Lines 483-488
Note that permanent location is a code, and location may be an authval.
Link Here
|
| 483 |
</table> |
484 |
</table> |
| 484 |
[% END %][%# end of block items_table %] |
485 |
[% END %][%# end of block items_table %] |
| 485 |
|
486 |
|
|
|
487 |
[% IF Koha.Preference('EnableVolumes') %] |
| 488 |
<div id="volumes"> |
| 489 |
<div class="volumes_table_table_controls"> |
| 490 |
<a href="#" class="volume-create btn btn-default btn-xs"><i class="fa fa-plus"></i> Create new</a> |
| 491 |
</div> |
| 492 |
<table class="volumes-table" id="volumes-table"> |
| 493 |
<thead> |
| 494 |
<tr> |
| 495 |
<td>Display Order</td> |
| 496 |
<td>Description</td> |
| 497 |
<td> </td> |
| 498 |
</tr> |
| 499 |
</thead> |
| 500 |
</table> |
| 501 |
</div> |
| 502 |
[% END %] |
| 503 |
|
| 486 |
<div id="holdings"> |
504 |
<div id="holdings"> |
| 487 |
|
505 |
|
| 488 |
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] |
506 |
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] |
|
Lines 899-904
Note that permanent location is a code, and location may be an authval.
Link Here
|
| 899 |
|
917 |
|
| 900 |
[% END %] |
918 |
[% END %] |
| 901 |
|
919 |
|
|
|
920 |
<div class="modal fade" id="modal-volume-create" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label"> |
| 921 |
<div class="modal-dialog"> |
| 922 |
<div class="modal-content"> |
| 923 |
<div class="modal-header"> |
| 924 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 925 |
<h3 id="modal-volume-create-label"><i class="fa fa-plus"></i> Create a new volume</h3> |
| 926 |
</div> |
| 927 |
<form id="modal-volume-create-form" class="validated"> |
| 928 |
<div class="modal-body"> |
| 929 |
<fieldset> |
| 930 |
<p> |
| 931 |
<label for="volume_description" class="required">Name: </label> |
| 932 |
<input name="description" id="modal-volume-create-form-description" type="text" size="30" required="required" class="required" /> |
| 933 |
<span class="required">Required</span> |
| 934 |
</p> |
| 935 |
<p> |
| 936 |
<label for="volume_display_order" class="required">Display order: </label> |
| 937 |
<input name="display_order" id="modal-volume-create-form-display_order" value="0" type="number" size="5" required="required" class="required" /> |
| 938 |
<span class="required">Required</span> |
| 939 |
<br/> |
| 940 |
<span class="hint">Numbers only, volumes will be displayed in counting order</span> |
| 941 |
</p> |
| 942 |
</fieldset> |
| 943 |
</div> |
| 944 |
<div class="modal-footer"> |
| 945 |
<button id="modal-volume-create-submit" class="btn btn-default"><i class="fa fa-plus"></i> Submit</button> |
| 946 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
| 947 |
</div> |
| 948 |
</form> |
| 949 |
</div> |
| 950 |
</div> |
| 951 |
</div> |
| 952 |
|
| 953 |
<div class="modal fade" id="modal-volume-edit" tabindex="-1" role="dialog" aria-labelledby="modal-volume-edit-label"> |
| 954 |
<div class="modal-dialog"> |
| 955 |
<div class="modal-content"> |
| 956 |
<div class="modal-header"> |
| 957 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 958 |
<h3 id="modal-volume-edit-label"><i class='fa fa-edit'></i> Edit volume</h3> |
| 959 |
</div> |
| 960 |
<form id="modal-volume-edit-form" class="validated"> |
| 961 |
<div class="modal-body"> |
| 962 |
<fieldset> |
| 963 |
<p> |
| 964 |
<label for="volume_description" class="required">Name: </label> |
| 965 |
<input name="description" id="modal-volume-edit-form-description" type="text" size="30" required="required" class="required" /> |
| 966 |
<span class="required">Required</span> |
| 967 |
</p> |
| 968 |
<p> |
| 969 |
<label for="volume_display_order" class="required">Sort order: </label> |
| 970 |
<input name="display_order" id="modal-volume-edit-form-display_order" type="number" size="5" /> |
| 971 |
<span class="hint">Numbers only, volumes will be displayed in counting order</span> |
| 972 |
</p> |
| 973 |
</fieldset> |
| 974 |
</div> |
| 975 |
<div class="modal-footer"> |
| 976 |
<button id="modal-volume-edit-submit" class="btn btn-default"><i class='fa fa-edit'></i> Submit</button> |
| 977 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
| 978 |
</div> |
| 979 |
</form> |
| 980 |
</div> |
| 981 |
</div> |
| 982 |
</div> |
| 983 |
|
| 984 |
<div class="modal fade" id="modal-volume-delete" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label"> |
| 985 |
<div class="modal-dialog"> |
| 986 |
<div class="modal-content"> |
| 987 |
<div class="modal-header"> |
| 988 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 989 |
<h3 id="modal-volume-delete-label"><i class='fa fa-trash'></i> Delete volume</h3> |
| 990 |
</div> |
| 991 |
<div class="modal-body"> |
| 992 |
Are you sure you want to delete this volume? |
| 993 |
</div> |
| 994 |
<div class="modal-footer"> |
| 995 |
<button id="modal-volume-delete-submit" class="btn btn-danger"><i class='fa fa-trash'></i> Delete</button> |
| 996 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
| 997 |
</div> |
| 998 |
</div> |
| 999 |
</div> |
| 1000 |
</div> |
| 1001 |
|
| 902 |
[% MACRO jsinclude BLOCK %] |
1002 |
[% MACRO jsinclude BLOCK %] |
| 903 |
[% INCLUDE 'catalog-strings.inc' %] |
1003 |
[% INCLUDE 'catalog-strings.inc' %] |
| 904 |
[% Asset.js("js/catalog.js") | $raw %] |
1004 |
[% Asset.js("js/catalog.js") | $raw %] |
|
Lines 1162-1167
Note that permanent location is a code, and location may be an authval.
Link Here
|
| 1162 |
})); |
1262 |
})); |
| 1163 |
[% END %] |
1263 |
[% END %] |
| 1164 |
}); |
1264 |
}); |
|
|
1265 |
|
| 1266 |
[% IF Koha.Preference('EnableVolumes') %] |
| 1267 |
// Load volumes table |
| 1268 |
var volumesTable = KohaTable("volumes-table", { |
| 1269 |
"bAutoWidth": false, |
| 1270 |
'sDom': '<"top pager"ilp>t<"bottom pager"ip>r', |
| 1271 |
"aoColumns": [ |
| 1272 |
{ |
| 1273 |
"mDataProp": function( oObj ) { |
| 1274 |
return oObj.display_order; |
| 1275 |
}, |
| 1276 |
}, |
| 1277 |
{ |
| 1278 |
"mDataProp": function( oObj ) { |
| 1279 |
return oObj.description; |
| 1280 |
}, |
| 1281 |
}, |
| 1282 |
{ |
| 1283 |
"mDataProp": function( oObj ) { |
| 1284 |
return `<button class='volume-edit btn btn-default btn-xs' data-volume-id='${oObj.volume_id}'> |
| 1285 |
<i class='fa fa-edit'></i> ${_('Edit')} |
| 1286 |
</button>` |
| 1287 |
+ ' ' |
| 1288 |
+ `<button class='volume-delete btn btn-default btn-xs' data-volume-id='${oObj.volume_id}'> |
| 1289 |
<i class='fa fa-trash'></i> ${('Delete')} |
| 1290 |
</button>`; |
| 1291 |
}, |
| 1292 |
}, |
| 1293 |
], |
| 1294 |
"bPaginate": false, |
| 1295 |
"bProcessing": true, |
| 1296 |
"bServerSide": false, |
| 1297 |
"sAjaxSource": `/api/v1/biblios/${biblionumber}/volumes`, |
| 1298 |
"sAjaxDataProp": "", |
| 1299 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
| 1300 |
$.getJSON( sSource, aoData, function (json) { |
| 1301 |
fnCallback(json) |
| 1302 |
} ); |
| 1303 |
}, |
| 1304 |
}); |
| 1305 |
|
| 1306 |
// Create new volumes |
| 1307 |
$('.volume-create').on('click', function(){ |
| 1308 |
$('#modal-volume-create-form-description').val(""); |
| 1309 |
$('#modal-volume-create-submit').removeAttr('disabled'); |
| 1310 |
$('#modal-volume-create').modal('show'); |
| 1311 |
}); |
| 1312 |
|
| 1313 |
$("#modal-volume-create-form").validate({ |
| 1314 |
submitHandler: function(form) { |
| 1315 |
$.ajax({ |
| 1316 |
url: `/api/v1/biblios/${biblionumber}/volumes`, |
| 1317 |
headers: { "x-koha-embed": "items" }, |
| 1318 |
success: function(volumes){ |
| 1319 |
$('#modal-volume-create-submit').attr('disabled', 'disabled'); |
| 1320 |
|
| 1321 |
var settings = { |
| 1322 |
"url": `/api/v1/biblios/${biblionumber}/volumes`, |
| 1323 |
"method": "POST", |
| 1324 |
"headers": { |
| 1325 |
"Content-Type": "application/json" |
| 1326 |
}, |
| 1327 |
"data": JSON.stringify( |
| 1328 |
{ |
| 1329 |
"description": $("#modal-volume-create-form-description").val(), |
| 1330 |
"display_order": $("#modal-volume-create-form-display_order").val(), |
| 1331 |
} |
| 1332 |
), |
| 1333 |
}; |
| 1334 |
|
| 1335 |
$.ajax(settings) |
| 1336 |
.done(function (response) { |
| 1337 |
$('#volume-add-form-select').append($('<option>', { |
| 1338 |
value: response.volume_id, |
| 1339 |
text: response.description |
| 1340 |
})); |
| 1341 |
|
| 1342 |
$('#modal-volume-create').modal('hide'); |
| 1343 |
if ( volumes.length == 0 ) { |
| 1344 |
// This bib has no previous volumes, reload the page |
| 1345 |
window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`); |
| 1346 |
} else { |
| 1347 |
// Has other volumes, just reload the table |
| 1348 |
volumesTable.api().ajax.reload(); |
| 1349 |
} |
| 1350 |
}) |
| 1351 |
.fail(function(err) { |
| 1352 |
var message = err.responseJSON.error; |
| 1353 |
alert(message); |
| 1354 |
}); |
| 1355 |
} |
| 1356 |
}); |
| 1357 |
} |
| 1358 |
}); |
| 1359 |
|
| 1360 |
$('#modal-volume-create').on('shown.bs.modal', function () { |
| 1361 |
$('#modal-volume-create-form-description').focus(); |
| 1362 |
}) |
| 1363 |
|
| 1364 |
// Edit existing volumes |
| 1365 |
$('body').on( 'click', '.volume-edit', function(){ |
| 1366 |
const volume_id = $(this).data('volume-id'); |
| 1367 |
const url = `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`; |
| 1368 |
$.get( url, function( data ) { |
| 1369 |
$('#modal-volume-edit-form-description').val( data.description ); |
| 1370 |
$('#modal-volume-edit-form-display_order').val( data.display_order ); |
| 1371 |
$('#modal-volume-edit-submit').data('volume-id', volume_id ); |
| 1372 |
$('#modal-volume-edit-submit').removeAttr('disabled'); |
| 1373 |
$('#modal-volume-edit').modal('show'); |
| 1374 |
}); |
| 1375 |
}); |
| 1376 |
|
| 1377 |
$("#modal-volume-edit-form").validate({ |
| 1378 |
submitHandler: function(form) { |
| 1379 |
$('#modal-volume-edit-submit').attr('disabled', 'disabled'); |
| 1380 |
|
| 1381 |
const volume_id = $('#modal-volume-edit-submit').data('volume-id'); |
| 1382 |
const url = `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`; |
| 1383 |
|
| 1384 |
var settings = { |
| 1385 |
"url": url, |
| 1386 |
"method": "PUT", |
| 1387 |
"headers": { |
| 1388 |
"Content-Type": "application/json" |
| 1389 |
}, |
| 1390 |
"data": JSON.stringify( |
| 1391 |
{ |
| 1392 |
"description": $("#modal-volume-edit-form-description").val(), |
| 1393 |
"display_order": $("#modal-volume-edit-form-display_order").val(), |
| 1394 |
} |
| 1395 |
), |
| 1396 |
}; |
| 1397 |
|
| 1398 |
$.ajax(settings) |
| 1399 |
.done(function (response) { |
| 1400 |
$('#modal-volume-edit').modal('hide'); |
| 1401 |
volumesTable.api().ajax.reload(); |
| 1402 |
}) |
| 1403 |
.fail(function(err) { |
| 1404 |
var message = err.responseJSON.error; |
| 1405 |
alert(message); |
| 1406 |
}); |
| 1407 |
} |
| 1408 |
}); |
| 1409 |
|
| 1410 |
$('#modal-volume-edit').on('shown.bs.modal', function () { |
| 1411 |
$('#modal-volume-edit-form-description').focus(); |
| 1412 |
}) |
| 1413 |
|
| 1414 |
// Delete existing volumes |
| 1415 |
$('body').on( 'click', '.volume-delete', function(){ |
| 1416 |
const volume_id = $(this).data('volume-id'); |
| 1417 |
$('#modal-volume-delete-submit').data('volume-id', volume_id ); |
| 1418 |
$('#modal-volume-delete-submit').removeAttr('disabled'); |
| 1419 |
$('#modal-volume-delete').modal('show'); |
| 1420 |
}); |
| 1421 |
$("#modal-volume-delete-submit").on('click', function(){ |
| 1422 |
$('#modal-volume-delete-submit').attr('disabled', 'disabled'); |
| 1423 |
const volume_id = $("#modal-volume-delete-submit").data('volume-id'); |
| 1424 |
|
| 1425 |
$.ajax({ |
| 1426 |
url: `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`, |
| 1427 |
headers: { "x-koha-embed": "items" }, |
| 1428 |
success: function(volume_data){ |
| 1429 |
$.ajax({ |
| 1430 |
"url": `/api/v1/biblios/${biblionumber}/volumes/${volume_id}`, |
| 1431 |
"method": "DELETE", |
| 1432 |
}) |
| 1433 |
.done(function (response) { |
| 1434 |
$('#modal-volume-delete').modal('hide'); |
| 1435 |
$(`#volume-add-form-select option[value='${volume_id}']`).remove(); |
| 1436 |
if ( volume_data.items === null ) { |
| 1437 |
// No items for this volume, we can just refresh the table |
| 1438 |
volumesTable.api().ajax.reload(); |
| 1439 |
} else { |
| 1440 |
// This volume had items attached to it, we need to reload the page |
| 1441 |
window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`); |
| 1442 |
} |
| 1443 |
}) |
| 1444 |
.fail(function(err) { |
| 1445 |
var message = err.responseJSON.error; |
| 1446 |
alert(message); |
| 1447 |
}); |
| 1448 |
} |
| 1449 |
}); |
| 1450 |
}); |
| 1451 |
[% END %] |
| 1165 |
</script> |
1452 |
</script> |
| 1166 |
[% END %] |
1453 |
[% END %] |
| 1167 |
[% INCLUDE 'intranet-bottom.inc' %] |
1454 |
[% INCLUDE 'intranet-bottom.inc' %] |
| 1168 |
- |
|
|