diff --git a/public/viewjs/productform.js b/public/viewjs/productform.js index 6292a7a6..3761b2f5 100644 --- a/public/viewjs/productform.js +++ b/public/viewjs/productform.js @@ -186,6 +186,20 @@ } }); +Grocy.Api.Get('stock/products/' + Grocy.EditObjectId, + function(productDetails) + { + if (productDetails.last_purchased == null) + { + $('#qu_id_stock').removeAttr("disabled"); + } + }, + function(xhr) + { + console.error(xhr); + } +); + var prefillName = GetUriParam('prefillname'); if (prefillName !== undefined) { diff --git a/views/productform.blade.php b/views/productform.blade.php index 10eb367d..09a6c2b1 100644 --- a/views/productform.blade.php +++ b/views/productform.blade.php @@ -170,7 +170,8 @@