mirror of
https://github.com/grocy/grocy.git
synced 2025-08-19 11:48:55 +00:00
Fixed date "never" display on stock overview page (again closes #296)
This commit is contained in:
@@ -299,13 +299,15 @@ RefreshContextualTimeago = function()
|
|||||||
{
|
{
|
||||||
var element = $(this);
|
var element = $(this);
|
||||||
var timestamp = element.attr("datetime");
|
var timestamp = element.attr("datetime");
|
||||||
|
|
||||||
var isNever = timestamp && timestamp.substring(0, 10) == "2999-12-31";
|
var isNever = timestamp && timestamp.substring(0, 10) == "2999-12-31";
|
||||||
var isToday = timestamp && timestamp.length == 10 && timestamp.substring(0, 10) == moment().format("YYYY-MM-DD");
|
var isToday = timestamp && timestamp.length == 10 && timestamp.substring(0, 10) == moment().format("YYYY-MM-DD");
|
||||||
|
|
||||||
if (isNever)
|
if (isNever)
|
||||||
{
|
{
|
||||||
element.prev().text(__t("Never"));
|
element.prev().text(__t("Never"));
|
||||||
}
|
}
|
||||||
if (isToday)
|
else if (isToday)
|
||||||
{
|
{
|
||||||
element.text(__t("Today"));
|
element.text(__t("Today"));
|
||||||
}
|
}
|
||||||
|
@@ -164,8 +164,13 @@ $(document).on('click', '.product-consume-button', function(e)
|
|||||||
|
|
||||||
Grocy.FrontendHelpers.EndUiBusy();
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(toastMessage);
|
toastr.success(toastMessage);
|
||||||
RefreshContextualTimeago();
|
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
|
|
||||||
|
// Needs to be delayed because of the animation above the date-text would be wrong if fired immediately...
|
||||||
|
setTimeout(function ()
|
||||||
|
{
|
||||||
|
RefreshContextualTimeago();
|
||||||
|
}, 520);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
@@ -220,14 +225,14 @@ $(document).on('click', '.product-open-button', function(e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#product-' + productId + '-next-best-before-date').parent().effect('highlight', {}, 500);
|
$('#product-' + productId + '-next-best-before-date').parent().effect('highlight', {}, 500);
|
||||||
$('#product-' + productId + '-next-best-before-date').fadeOut(500, function ()
|
$('#product-' + productId + '-next-best-before-date').fadeOut(500, function()
|
||||||
{
|
{
|
||||||
$(this).text(result.next_best_before_date).fadeIn(500);
|
$(this).text(result.next_best_before_date).fadeIn(500);
|
||||||
});
|
});
|
||||||
$('#product-' + productId + '-next-best-before-date-timeago').attr('datetime', result.next_best_before_date);
|
$('#product-' + productId + '-next-best-before-date-timeago').attr('datetime', result.next_best_before_date);
|
||||||
|
|
||||||
$('#product-' + productId + '-opened-amount').parent().effect('highlight', {}, 500);
|
$('#product-' + productId + '-opened-amount').parent().effect('highlight', {}, 500);
|
||||||
$('#product-' + productId + '-opened-amount').fadeOut(500, function ()
|
$('#product-' + productId + '-opened-amount').fadeOut(500, function()
|
||||||
{
|
{
|
||||||
$(this).text(__t('%s opened', result.stock_amount_opened)).fadeIn(500);
|
$(this).text(__t('%s opened', result.stock_amount_opened)).fadeIn(500);
|
||||||
});
|
});
|
||||||
@@ -239,8 +244,13 @@ $(document).on('click', '.product-open-button', function(e)
|
|||||||
|
|
||||||
Grocy.FrontendHelpers.EndUiBusy();
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(__t('Marked %1$s of %2$s as opened', 1 + " " + productQuName, productName));
|
toastr.success(__t('Marked %1$s of %2$s as opened', 1 + " " + productQuName, productName));
|
||||||
RefreshContextualTimeago();
|
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
|
|
||||||
|
// Needs to be delayed because of the animation above the date-text would be wrong if fired immediately...
|
||||||
|
setTimeout(function()
|
||||||
|
{
|
||||||
|
RefreshContextualTimeago();
|
||||||
|
}, 600);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user