From 94fca0d40d4b73c5a065760826a367c32b07f83a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Thu, 10 Sep 2015 11:55:31 +0200 Subject: [PATCH] Auftrags-Controller: zweite Zeile per Shift-Hoch/Runter verstecken/anzeigen --- SL/Controller/Order.pm | 1 + templates/webpages/order/tabs/_row.html | 2 +- templates/webpages/order/tabs/basic_data.html | 28 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 93015a77e..fb3078cff 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -169,6 +169,7 @@ sub action_add_item { ->val('#add_item_sellprice_as_number', '') ->val('#add_item_discount_as_percent', '') ->run('row_table_scroll_down') + ->run('row_set_keyboard_events_by_id', $item->id) ->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 42e4225ea..4d5656f23 100644 --- a/templates/webpages/order/tabs/_row.html +++ b/templates/webpages/order/tabs/_row.html @@ -3,7 +3,7 @@ [%- USE LxERP %] [%- USE L %] - + diff --git a/templates/webpages/order/tabs/basic_data.html b/templates/webpages/order/tabs/basic_data.html index 5733e3749..fffd88c19 100644 --- a/templates/webpages/order/tabs/basic_data.html +++ b/templates/webpages/order/tabs/basic_data.html @@ -220,6 +220,33 @@ function row_table_scroll_down() { $('#row_table_scroll_id').scrollTop($('#row_table_scroll_id')[0].scrollHeight); } +function row_set_keyboard_events_by_id(item_id) { + var row = $('#item_' + item_id).parents("tbody").first(); + + row_set_keyboard_events(row); +} + +function row_set_keyboard_events(rows) { + console.log(rows); + + $(rows).keydown(function(event) { + if(event.keyCode == 40 && event.shiftKey == true) { + // shift arrow down + event.preventDefault(); + var row = $(event.target).parents("tbody").first(); + $(row).children().not(':first').show(); + return false; + } + if(event.keyCode == 38 && event.shiftKey == true) { + // shift arrow up + event.preventDefault(); + var row = $(event.target).parents("tbody").first(); + $(row).children().not(':first').hide(); + return false; + } + }); +} + $(function(){ $('#order_[%- cv_id %]').change(reload_cv_dependend_selections); $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) }); @@ -231,6 +258,7 @@ $(function(){ return false; } }); + row_set_keyboard_events($('.row_entry')); }); -- 2.20.1