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