mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Made some forms more convenient (input handling)
This commit is contained in:
parent
05a9406a32
commit
dad6322bac
@ -79,6 +79,7 @@ $('#product_id').on('change', function(e)
|
||||
$('#product_id_text_input').parent('.input-group').removeClass('has-error');
|
||||
$('#product_id_text_input').closest('.form-group').removeClass('has-error');
|
||||
$('#product-error').hide();
|
||||
$('#amount').focus();
|
||||
}
|
||||
},
|
||||
function(xhr)
|
||||
|
@ -47,6 +47,8 @@ $('#habit_id').on('change', function(e)
|
||||
$('#selected-habit-last-tracked-timeago').text($.timeago(habitDetails.last_tracked || ''));
|
||||
$('#selected-habit-tracked-count').text((habitDetails.tracked_count || '0'));
|
||||
|
||||
$('#tracked_time').focus();
|
||||
|
||||
Grocy.EmptyElementWhenMatches('#selected-habit-last-tracked-timeago', 'NaN years ago');
|
||||
},
|
||||
function(xhr)
|
||||
|
@ -84,6 +84,8 @@ $('#product_id').on('change', function(e)
|
||||
$('#new_amount').attr('not-equal', productDetails.stock_amount);
|
||||
$('#new_amount_qu_unit').text(productDetails.quantity_unit_stock.name);
|
||||
|
||||
$('#new_amount').focus();
|
||||
|
||||
Grocy.EmptyElementWhenMatches('#selected-product-last-purchased-timeago', 'NaN years ago');
|
||||
Grocy.EmptyElementWhenMatches('#selected-product-last-used-timeago', 'NaN years ago');
|
||||
},
|
||||
|
@ -88,6 +88,11 @@ $('#product_id').on('change', function(e)
|
||||
{
|
||||
$('#best_before_date').val(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD'));
|
||||
$('#best_before_date').trigger('change');
|
||||
$('#amount').focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#best_before_date').focus();
|
||||
}
|
||||
|
||||
Grocy.EmptyElementWhenMatches('#selected-product-last-purchased-timeago', 'NaN years ago');
|
||||
@ -295,6 +300,14 @@ $('#best_before_date').on('change', function(e)
|
||||
}
|
||||
});
|
||||
|
||||
$('#best_before_date').on('keydown', function(e)
|
||||
{
|
||||
if (e.keyCode === 13) //Enter
|
||||
{
|
||||
$('#best_before_date').trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
$('#best_before_date').on('keypress', function(e)
|
||||
{
|
||||
var element = $(e.target);
|
||||
|
@ -78,6 +78,8 @@ $('#product_id').on('change', function(e)
|
||||
$('#product_id_text_input').parent('.input-group').removeClass('has-error');
|
||||
$('#product_id_text_input').closest('.form-group').removeClass('has-error');
|
||||
$('#product-error').hide();
|
||||
|
||||
$('#amount').focus();
|
||||
}
|
||||
},
|
||||
function(xhr)
|
||||
|
Loading…
x
Reference in New Issue
Block a user