Add a checkbox to set the "never expires date" (closes #40)

This commit is contained in:
Bernd Bestel
2018-08-06 22:41:35 +02:00
parent 282ee0885b
commit 339d81318f
7 changed files with 47 additions and 7 deletions

View File

@@ -85,7 +85,17 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
if (productDetails.product.default_best_before_days.toString() !== '0')
{
Grocy.Components.DateTimePicker.SetValue(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD'));
if (productDetails.product.default_best_before_days == -1)
{
if (!$("#datetimepicker-shortcut").is(":checked"))
{
$("#datetimepicker-shortcut").click();
}
}
else
{
Grocy.Components.DateTimePicker.SetValue(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD'));
}
$('#amount').focus();
}
else