From 36a6c56f5cd8d9263015418a73daa8123635c05e Mon Sep 17 00:00:00 2001 From: Kurt Riddlesperger Date: Wed, 15 Jan 2020 17:30:43 -0600 Subject: [PATCH] stockdetail refresh with location name --- public/viewjs/stockdetail.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/public/viewjs/stockdetail.js b/public/viewjs/stockdetail.js index 3cba3c47..90178f58 100644 --- a/public/viewjs/stockdetail.js +++ b/public/viewjs/stockdetail.js @@ -249,11 +249,20 @@ function RefreshStockDetailRow(stockRowId) $(this).text(result.best_before_date).fadeIn(500); }); + var locationName = ""; + Grocy.Api.Get("objects/locations/" + result.location_id, + function(locationResult) + { + locationName = locationResult.name; + }, + function(xhr) + { + console.error(xhr); + }); $('#stock-' + stockRowId + '-location').parent().effect('highlight', { }, 500); $('#stock-' + stockRowId + '-location').fadeOut(500, function() { - //TODO grab location name instead of id - $(this).text(result.location_id).fadeIn(500); + $(this).text(locationName).fadeIn(500); }); $('#stock-' + stockRowId + '-price').parent().effect('highlight', { }, 500);