From 96f1ca3f8c25da557d8e2e1c2d8dcd4eb47cc7f4 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 26 Apr 2016 14:09:58 -0400 Subject: [PATCH] Bug 16738 - Improve EDIFACT messages template MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch makes several improvements to the EDIFACT messages template to make it more consistent with similar interfaces in Koha. Changes to edimsg.tt are made to simplify the display of the data in a modal. This patch also corrects a couple of markup errors. To test you must have multiple rows of data in the edifact_messages table. I tested with dummy data I inserted manually. Should should have some rows which use 'QUOTE' and 'ORDERS' as the message_type. To test deletions you may need to apply the patch for Bug 16737. - Apply the patch and go to Acquisitions -> EDIFACT messages. - In the table of messages, the date should be displayed according to your system preference. - Sorting by date should work correctly regardless of date format setting. - The 'Actions' column should contain 'View message' and 'Delete' Bootstrap-style buttons with Font Awesome icons. The column should be unsorted. - Clicking the 'Delete' button should prompt you to confirm. - Clicking the 'View message' button should trigger a modal which loads the message data. - Test the page with no messages or when all messages have been deleted. The page should display a standard message dialog instead of an empty table. Signed-off-by: Nicole C Engard Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall (cherry picked from commit 4e52b81247b852f9cda9838825148bb2696dc064) Signed-off-by: Frédéric Demians --- .../prog/en/modules/acqui/edifactmsgs.tt | 78 +++++++++++++++---- .../prog/en/modules/acqui/edimsg.tt | 40 +++++----- 2 files changed, 83 insertions(+), 35 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt index 15ed26d996..93a1c03568 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt @@ -1,5 +1,6 @@ +[% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] -Koha › Acquisitions +Koha › Acquisitions › EDIFACT messages [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'datatables.inc' %] @@ -7,11 +8,37 @@ $(document).ready(function() { $('#edi_msgs').dataTable($.extend(true, {}, dataTablesDefaults, { 'aaSorting': [[1, "desc" ]], - 'sPaginationType': "four_button" - })); + 'sPaginationType': "four_button", + "aoColumnDefs": [ + { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, + { "sType": "title-string", "aTargets" : [ "title-string" ] } + ] + })); + + var EDIModal = $("#EDI_modal"); + var EDIModalBody = $("#EDI_modal .modal-body"); + + $(".view_message").on("click", function(e){ + e.preventDefault(); + var page = $(this).attr("href"); + EDIModalBody.load(page + " #edimsg"); + EDIModal.modal("show"); + }); + EDIModal.on("click",".closebtn",function(e){ + e.preventDefault(); + EDIModal.modal("hide"); + }); + EDIModal.on("hidden", function(){ + EDIModalBody.html("
\"\" "+_("Loading")+"
"); + }); + $(".delete_msg").on("click",function(){ + return confirm(_("Are you sure you want to delete this message?")); + }); }); - + [% INCLUDE 'header.inc' %] @@ -32,27 +59,29 @@ $(document).ready(function() {

EDIFACT messages

- +[% IF ( messages ) %] + - + - - + + [% FOREACH msg IN messages %] - + - - - [% END %] @@ -80,6 +109,25 @@ $(document).ready(function() {
TypeTransferredTransferred Status Vendor Details Filename ActionActions
[% msg.message_type %][% msg.transfer_date %][% msg.transfer_date | $KohaDates %] [% msg.status %] - -[% msg.vendor.name %] + + [% msg.vendor.name %] + [% IF msg.message_type == 'QUOTE' || msg.message_type == 'ORDERS' %] @@ -68,11 +97,11 @@ $(document).ready(function() { [% END %] [% msg.filename %]View message -Delete + + + View message + Delete
+ + + + +[% ELSE %] +
There are no EDIFACT messages.
+[% END %] +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edimsg.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edimsg.tt index 8f0dba4eec..0307e47d47 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edimsg.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edimsg.tt @@ -12,24 +12,24 @@
- -[% IF no_message %] -
The requested message cannot be displayed
-[% ELSE %] -
-
-
-
    - [% FOREACH seg IN segments %] -
  • [% seg | html %]
  • - [% END %] -
-[% END %] - -
-
-
-[% INCLUDE 'acquisitions-menu.inc' %] -
-
+
+
+
+
+ [% IF no_message %] +
The requested message cannot be displayed
+ [% ELSE %] +
    + [% FOREACH seg IN segments %] +
  • [% seg | html %]
  • + [% END %] +
+ [% END %] +
+
+
+
+ [% INCLUDE 'acquisitions-menu.inc' %] +
+
[% INCLUDE 'intranet-bottom.inc' %] -- 2.39.5