mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Don't allow a min. stock amount for child products when the parent has "Accumulate sub products min. stock amount" set (references #1409)
This commit is contained in:
parent
734e174442
commit
0dc37fb361
@ -505,4 +505,36 @@ else if (Grocy.EditMode === 'create')
|
||||
}
|
||||
}
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
var parentProductId = $(e.target).val();
|
||||
|
||||
if (parentProductId)
|
||||
{
|
||||
Grocy.Api.Get('objects/products/' + parentProductId,
|
||||
function(parentProduct)
|
||||
{
|
||||
if (BoolVal(parentProduct.cumulate_min_stock_amount_of_sub_products))
|
||||
{
|
||||
|
||||
$("#min_stock_amount").attr("disabled", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#min_stock_amount').removeAttr("disabled");
|
||||
}
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#min_stock_amount').removeAttr("disabled");
|
||||
}
|
||||
});
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm("product-form");
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger("change");
|
||||
|
@ -606,8 +606,10 @@
|
||||
title="{{ $__t('grocycode is a unique referer to this product in your grocy instance - print it onto a label and scan it like any other barcode') }}"></i>
|
||||
</h4>
|
||||
<p>
|
||||
@if($mode == 'edit')
|
||||
<img src="{{ $U('/product/' . $product->id . '/grocycode?size=60') }}"
|
||||
class="float-lg-left">
|
||||
@endif
|
||||
</p>
|
||||
<p>
|
||||
<a class="btn btn-outline-primary btn-sm"
|
||||
|
Loading…
x
Reference in New Issue
Block a user