set default store for product, purchase set last store purchased if available or use product default (#672)

This commit is contained in:
kriddles
2020-03-27 13:27:40 -05:00
committed by GitHub
parent d509f9add0
commit 2fee4b45ff
10 changed files with 39 additions and 6 deletions

View File

@@ -140,7 +140,16 @@ if (Grocy.Components.ProductPicker !== undefined)
function(productDetails)
{
$('#price').val(productDetails.last_price);
Grocy.Components.ShoppingLocationPicker.SetId(productDetails.last_shopping_location_id);
if (productDetails.last_shopping_location_id != null)
{
Grocy.Components.ShoppingLocationPicker.SetId(productDetails.last_shopping_location_id);
}
else
{
Grocy.Components.ShoppingLocationPicker.SetId(productDetails.default_shopping_location_id);
}
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
{
Grocy.Components.LocationPicker.SetId(productDetails.location.id);