From f69e62ff9fbe2958fbb9720a8d914df4566244ab Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 20 Jun 2018 12:39:05 +0000 Subject: [PATCH] Bug 20969: Use modal to add and edit notes from basket This patch modifies the acquisitions basket page so that links to add or edit vendor or internal notes trigger a modal with the notes edit form instead of redirecting to a different page. This is a markup change only -- The form still submits to modordernotes.pl. To test, apply the patch and view a basket in acquisitions which has multiple orders. Test various note controls: Add internal note, Add vendor note, Edit internal note, edit vendor note. Confirm that the operations work correctly with multiple orders in the basket. Signed-off-by: Katrin Fischer Signed-off-by: Charles Farmer Signed-off-by: Nick Clemens --- .../prog/en/modules/acqui/basket.tt | 54 +++++++++++++++++-- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index e9a94f8701..a909a938bf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -450,14 +450,14 @@ [% END %]

[% IF ( books_loo.order_internalnote ) %] -

Internal note: [% books_loo.order_internalnote|html %] [Change internal note]

+

Internal note: [% books_loo.order_internalnote|html %] Edit internal note

[% ELSE %] - [Add internal note] + Add internal note [% END %] [% IF ( books_loo.order_vendornote ) %] -

Vendor note: [% books_loo.order_vendornote|html %] [Change vendor note]

+

Vendor note: [% books_loo.order_vendornote|html %] Edit vendor note

[% ELSE %] - [Add vendor note] + Add vendor note [% END %] [% IF (books_loo.transferred_from) %] [% basket = books_loo.transferred_from.basket %] @@ -685,6 +685,30 @@ + + + [% MACRO jsinclude BLOCK %] [% Asset.js("js/acquisitions-menu.js") %] [% INCLUDE 'datatables.inc' %] @@ -730,6 +754,28 @@ e.preventDefault(); transfer_order_popup( $(this).data("ordernumber")); }); + + $(".edit_note").on("click", function(e) { + e.preventDefault(); + var ordernumber = $(this).data("ordernumber"); + var note_type = $(this).data("note_type"); + var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")"; + var note_text = $( "#" + note_type + "-note-" + ordernumber ).html(); + $("#noteEditor .modal-title").text(modalTitle); + $("#ordernumber").val( ordernumber ); + $("#ordernotes").html( note_text ); + $("#type").val( note_type ); + $("#noteEditor").modal("show"); + }); + + $("#noteEditor").on('hidden.bs.modal', function (e) { + $("#noteEditorLabel").html(""); + $("#noteEditor .modal-title").text(""); + $("#ordernotes").html( "" ); + $("#ordernumber").val(""); + $("#type").val(""); + }); + }); -- 2.39.5