Immediately show the changed shopping location after edit on the stock entries page (references #658)

This commit is contained in:
Bernd Bestel
2020-03-25 20:00:52 +01:00
parent 06f65594de
commit 2d00f6f84a
2 changed files with 22 additions and 5 deletions

View File

@@ -166,18 +166,35 @@ function RefreshStockEntryRow(stockRowId)
function(locationResult)
{
locationName = locationResult.name;
$('#stock-' + stockRowId + '-location').attr('data-location-id', result.location_id);
$('#stock-' + stockRowId + '-location').text(locationName);
},
function(xhr)
{
console.error(xhr);
}
);
$('#stock-' + stockRowId + '-location').attr('data-location-id', result.location_id);
$('#stock-' + stockRowId + '-location').text(locationName);
$('#stock-' + stockRowId + '-price').text(result.price);
$('#stock-' + stockRowId + '-purchased-date').text(result.purchased_date);
$('#stock-' + stockRowId + '-purchased-date-timeago').attr('datetime', result.purchased_date + ' 23:59:59');
var shoppingLocationName = "";
Grocy.Api.Get("objects/shopping_locations/" + result.shopping_location_id,
function(shoppingLocationResult)
{
shoppingLocationName = shoppingLocationResult.name;
$('#stock-' + stockRowId + '-shopping-location').attr('data-shopping-location-id', result.location_id);
$('#stock-' + stockRowId + '-shopping-location').text(shoppingLocationName);
},
function (xhr)
{
console.error(xhr);
}
);
if (result.open == 1)
{
$('#stock-' + stockRowId + '-opened-amount').text(__t('Opened'));