From c5c169f6fc8961c617903e2700af1ae451335ec0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 26 Oct 2015 16:15:55 +0100 Subject: [PATCH] Auftrags-Controller: freie Preise und Rabatte nach der Eingabe neu formatieren. --- SL/Controller/Order.pm | 1 + templates/webpages/order/tabs/_row.html | 4 ++-- templates/webpages/order/tabs/basic_data.html | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 33628ba46..38f511cb5 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -350,6 +350,7 @@ sub action_add_item { ->run('row_table_scroll_down') ->run('row_set_keyboard_events_by_id', $item_id) ->on('.recalc', 'change', 'recalc_amounts_and_taxes') + ->on('.reformat_number', 'change', 'reformat_number') ->focus('#add_item_parts_id_name'); $self->_js_redisplay_amounts_and_taxes; diff --git a/templates/webpages/order/tabs/_row.html b/templates/webpages/order/tabs/_row.html index d8ec4df0e..08fd81d64 100644 --- a/templates/webpages/order/tabs/_row.html +++ b/templates/webpages/order/tabs/_row.html @@ -59,7 +59,7 @@ size = 10, style='text-align:right', disabled=(EDIT_PRICE? '' : 1), - class="recalc") %] + class="recalc reformat_number") %]
[%- L.div_tag(ITEM.sellprice_as_number, name="sellprice_text", style='text-align:right') %] @@ -77,7 +77,7 @@ size = 5, style='text-align:right', disabled=(EDIT_DISCOUNT? '' : 1), - class="recalc") %] + class="recalc reformat_number") %]
[%- L.div_tag(ITEM.discount_as_percent, name="discount_text", style='text-align:right') %] diff --git a/templates/webpages/order/tabs/basic_data.html b/templates/webpages/order/tabs/basic_data.html index c67ed3788..ea37fafbe 100644 --- a/templates/webpages/order/tabs/basic_data.html +++ b/templates/webpages/order/tabs/basic_data.html @@ -348,6 +348,10 @@ function update_discount_source(item_id, source, discount_str) { kivi.io.close_dialog(); } +function reformat_number(event) { + $(event.target).val(kivi.format_amount(kivi.parse_amount($(event.target).val()), -2)); +} + function recalc_amounts_and_taxes() { var data = $('#order_form').serialize(); data += '&action=Order/recalc_amounts_and_taxes'; @@ -446,6 +450,7 @@ $(function(){ }); row_set_keyboard_events($('.row_entry')); $('.recalc').change(recalc_amounts_and_taxes); + $('.reformat_number').change(reformat_number); }); -- 2.20.1