From 6b55c2498d04a8b4cafd7c93e11874861004e1e3 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 24 Feb 2020 12:06:17 -0500 Subject: [PATCH] Bug 24857: Add volume management to detail.pl Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Rebecca Coert --- .../prog/en/modules/catalogue/detail.tt | 287 ++++++++++++++++++ 1 file changed, 287 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 6bc8bcf49f..7ac8daf6fb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -230,6 +230,7 @@ Holdings ([% itemloop.size() || 0 | html %]) [% END %] +[% IF Koha.Preference('EnableVolumes') %]
  • Volumes
  • [% END %] [% IF ( MARCNOTES || notes ) %]
  • Descriptions ([% ( MARCNOTES.size || 1 ) | html %])
  • [% END %] [% IF ( subscriptionsnumber ) %]
  • Subscriptions
  • [% END %] [% IF Koha.Preference('AcquisitionDetails') %]
  • Acquisition details
  • [% END %] @@ -531,6 +532,23 @@ Note that permanent location is a code, and location may be an authval. [% END %][%# end of block items_table %] +[% IF Koha.Preference('EnableVolumes') %] +
    + + + + + + + + + +
    Display OrderDescription 
    +
    +[% END %] +
    [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %] @@ -947,6 +965,88 @@ Note that permanent location is a code, and location may be an authval. [% END %] + + + + + + [% MACRO jsinclude BLOCK %] [% INCLUDE 'catalog-strings.inc' %] [% Asset.js("js/catalog.js") | $raw %] @@ -1266,6 +1366,193 @@ Note that permanent location is a code, and location may be an authval. })); [% END %] }); + + [% IF Koha.Preference('EnableVolumes') %] + // Load volumes table + var volumesTable = KohaTable("volumes-table", { + "bAutoWidth": false, + 'sDom': '<"top pager"ilp>t<"bottom pager"ip>r', + "aoColumns": [ + { + "mDataProp": function( oObj ) { + return oObj.display_order; + }, + }, + { + "mDataProp": function( oObj ) { + return oObj.description; + }, + }, + { + "mDataProp": function( oObj ) { + return `` + + ' ' + + ``; + }, + }, + ], + "bPaginate": false, + "bProcessing": true, + "bServerSide": false, + "sAjaxSource": `/api/v1/biblios/${biblionumber}/volumes`, + "sAjaxDataProp": "", + "fnServerData": function ( sSource, aoData, fnCallback ) { + $.getJSON( sSource, aoData, function (json) { + fnCallback(json) + } ); + }, + }); + + // Create new volumes + $('.volume-create').on('click', function(){ + $('#modal-volume-create-form-description').val(""); + $('#modal-volume-create-submit').removeAttr('disabled'); + $('#modal-volume-create').modal('show'); + }); + + $("#modal-volume-create-form").validate({ + submitHandler: function(form) { + $.ajax({ + url: `/api/v1/biblios/${biblionumber}/volumes`, + headers: { "x-koha-embed": "items" }, + success: function(volumes){ + $('#modal-volume-create-submit').attr('disabled', 'disabled'); + + var settings = { + "url": `/api/v1/biblios/${biblionumber}/volumes`, + "method": "POST", + "headers": { + "Content-Type": "application/json" + }, + "data": JSON.stringify( + { + "description": $("#modal-volume-create-form-description").val(), + "display_order": $("#modal-volume-create-form-display_order").val(), + } + ), + }; + + $.ajax(settings) + .done(function (response) { + $('#volume-add-form-select').append($('