From 10fe22289afc69419e623b82a45df555e0c81ea6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 26 Oct 2018 12:30:05 +0200 Subject: [PATCH] E-Mail-Dialog: Knopf E-Mail senden ausgrauen um mehrfaches Senden zu verhindern MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Author: Jan Büren --- js/kivi.Order.js | 8 ++++++++ templates/webpages/common/_send_email_dialog.html | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/js/kivi.Order.js b/js/kivi.Order.js index f305afb26..f6d042752 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -134,6 +134,9 @@ namespace('kivi.Order', function(ns) { }; ns.send_email = function() { + // push button only once -> slow response from mail server + ns.email_dialog_disable_send(); + var data = $('#order_form').serializeArray(); data = data.concat($('[name^="email_form."]').serializeArray()); data = data.concat($('[name^="print_options."]').serializeArray()); @@ -465,6 +468,11 @@ namespace('kivi.Order', function(ns) { pp.o.multiple=1; pp.open_dialog(); }; +ns.email_dialog_disable_send = function() { + // disable mail send event to prevent + // impatient users to send multiple times + $('#send_email').prop('disabled', true); + }; ns.add_multi_items = function(data) { var insert_before_item_id = ns.get_insert_before_item_id($('#multi_items_position').val()); diff --git a/templates/webpages/common/_send_email_dialog.html b/templates/webpages/common/_send_email_dialog.html index 36713ea4a..9f03f7e5f 100644 --- a/templates/webpages/common/_send_email_dialog.html +++ b/templates/webpages/common/_send_email_dialog.html @@ -110,6 +110,6 @@

- [% L.button_tag(email_form.js_send_function, LxERP.t8("Send email")) %] + [% L.button_tag(email_form.js_send_function, LxERP.t8("Send email"), id='send_email') %] [% L.button_tag("\$('#send_email_dialog').dialog('close');", LxERP.t8("Abort")) %]

-- 2.20.1