From 3d6d473145356023b7009118809153e21034aeeb Mon Sep 17 00:00:00 2001 From: jekkos-t520 Date: Mon, 19 Jan 2015 12:35:09 +0100 Subject: [PATCH] Add item field autofocus in sales module auto submit payment form when hitting enter in amount_tendered input field --- application/views/sales/register.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/application/views/sales/register.php b/application/views/sales/register.php index 1a32ee2b8..627398599 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -421,19 +421,23 @@ $(document).ready(function() $("#add_item_form").submit(); }); + $('#item').focus(); + $('#item').blur(function() { $(this).val("lang->line('sales_start_typing_item_name'); ?>"); }); - $('#item, #customer').focus(function() + var clear_fields = function() { if ($(this).val().match("lang->line('sales_start_typing_item_name') . '|' . $this->lang->line('sales_start_typing_customer_name'); ?>")) { $(this).val(''); } - }); + }; + + $('#item, #customer').focus(clear_fields).click(clear_fields); $("#customer").autocomplete('', { @@ -523,6 +527,12 @@ $(document).ready(function() }); $("#payment_types").change(check_payment_type_gifcard).ready(check_payment_type_gifcard) + + $("#amount_tendered").keyup(function(event){ + if(event.which == 13) { + $('#add_payment_form').submit(); + } + }); }); function post_item_form_submit(response)