mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 01:55:47 +00:00
Immediately show the changed shopping location after edit on the stock entries page (references #658)
This commit is contained in:
parent
06f65594de
commit
2d00f6f84a
@ -166,18 +166,35 @@ function RefreshStockEntryRow(stockRowId)
|
|||||||
function(locationResult)
|
function(locationResult)
|
||||||
{
|
{
|
||||||
locationName = locationResult.name;
|
locationName = locationResult.name;
|
||||||
|
|
||||||
|
$('#stock-' + stockRowId + '-location').attr('data-location-id', result.location_id);
|
||||||
|
$('#stock-' + stockRowId + '-location').text(locationName);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
console.error(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 + '-price').text(result.price);
|
||||||
$('#stock-' + stockRowId + '-purchased-date').text(result.purchased_date);
|
$('#stock-' + stockRowId + '-purchased-date').text(result.purchased_date);
|
||||||
$('#stock-' + stockRowId + '-purchased-date-timeago').attr('datetime', result.purchased_date + ' 23:59:59');
|
$('#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)
|
if (result.open == 1)
|
||||||
{
|
{
|
||||||
$('#stock-' + stockRowId + '-opened-amount').text(__t('Opened'));
|
$('#stock-' + stockRowId + '-opened-amount').text(__t('Opened'));
|
||||||
|
@ -143,14 +143,14 @@
|
|||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||||
<td id="stock-{{ $stockEntry->id }}-price" class="locale-number locale-number-currency" data-price-id="{{ $stockEntry->price }}">
|
|
||||||
{{ $stockEntry->price }}
|
|
||||||
</td>
|
|
||||||
<td id="stock-{{ $stockEntry->id }}-shopping-location" data-shopping-location-id="{{ $stockEntry->shopping_location_id }}">
|
<td id="stock-{{ $stockEntry->id }}-shopping-location" data-shopping-location-id="{{ $stockEntry->shopping_location_id }}">
|
||||||
@if (FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id) !== null)
|
@if (FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id) !== null)
|
||||||
{{ FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id)->name }}
|
{{ FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id)->name }}
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
|
<td id="stock-{{ $stockEntry->id }}-price" class="locale-number locale-number-currency" data-price-id="{{ $stockEntry->price }}">
|
||||||
|
{{ $stockEntry->price }}
|
||||||
|
</td>
|
||||||
@endif
|
@endif
|
||||||
<td>
|
<td>
|
||||||
<span id="stock-{{ $stockEntry->id }}-purchased-date">{{ $stockEntry->purchased_date }}</span>
|
<span id="stock-{{ $stockEntry->id }}-purchased-date">{{ $stockEntry->purchased_date }}</span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user