From ed2613322ee39baa01f0d1165e196328324a0b23 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 --- .../prog/en/modules/catalogue/detail.tt | 268 ++++++++++++++++++ 1 file changed, 268 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 6ef518489b..9f37fbffde 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -182,6 +182,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 %] @@ -475,6 +476,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' ) %] @@ -816,6 +834,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 %] @@ -1066,6 +1166,174 @@ Note that permanent location is a code, and location may be an authval. }, columns_settings); [% 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) { + $('#modal-volume-create-submit').attr('disabled', 'disabled'); + + const url = `/api/v1/biblios/${biblionumber}/volumes`; + + 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($('