From 484dc5110ac75324639f9b979cf818683f457a72 Mon Sep 17 00:00:00 2001 From: fipwmaqzufheoxq92ebc <29818044+fipwmaqzufheoxq92ebc@users.noreply.github.com> Date: Sun, 11 Oct 2020 11:38:15 +0200 Subject: [PATCH] Fixes #1036: Remove stock-related buttons/options from Shopping-list if FEATURE_FLAG_STOCK is disabled --- public/viewjs/shoppinglistitemform.js | 2 +- views/shoppinglist.blade.php | 12 ++++++------ views/shoppinglistitemform.blade.php | 20 +++++++++++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/public/viewjs/shoppinglistitemform.js b/public/viewjs/shoppinglistitemform.js index db706114..f08dae77 100644 --- a/public/viewjs/shoppinglistitemform.js +++ b/public/viewjs/shoppinglistitemform.js @@ -139,7 +139,7 @@ if (Grocy.EditMode === "edit") $('#amount').on('focus', function(e) { - if (Grocy.Components.ProductPicker.GetValue().length === 0) + if (Grocy.Components.ProductPicker.GetValue().length === 0 && Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK) { Grocy.Components.ProductPicker.GetInputElement().focus(); } diff --git a/views/shoppinglist.blade.php b/views/shoppinglist.blade.php index 4b81e588..ae3e0590 100644 --- a/views/shoppinglist.blade.php +++ b/views/shoppinglist.blade.php @@ -71,7 +71,7 @@

{{ $__n(count($missingProducts), '%s product is below defined min. stock amount', '%s products are below defined min. stock amount') }}

+ class="normal-message status-filter-message responsive-button @if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif">{{ $__n(count($missingProducts), '%s product is below defined min. stock amount', '%s products are below defined min. stock amount') }}

@@ -87,17 +87,17 @@ {{ $__t('Clear list') }} {{ $__t('Add all list items to stock') }} {{ $__t('Add products that are below defined min. stock amount') }} {{ $__t('Add expired products') }} @@ -121,7 +121,7 @@ @@ -188,7 +188,7 @@ title="{{ $__t('Delete this item') }}"> - product_id)) data-toggle="tooltip" title="{{ $__t('Add %1$s of %2$s to stock', $listItem->amount . ' ' . $__n($listItem->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name_plural), FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->name, $listItem->amount) }}" @endif> diff --git a/views/shoppinglistitemform.blade.php b/views/shoppinglistitemform.blade.php index b87bc17d..ccdea0b2 100644 --- a/views/shoppinglistitemform.blade.php +++ b/views/shoppinglistitemform.blade.php @@ -50,14 +50,15 @@ value="1"> @endif - @php if($mode == 'edit') { $productId = $listItem->product_id; } else { $productId = ''; } @endphp - @include('components.productpicker', array( - 'products' => $products, - 'nextInputSelector' => '#amount', - 'isRequired' => false, - 'prefillById' => $productId - )) - +
+ @php if($mode == 'edit') { $productId = $listItem->product_id; } else { $productId = ''; } @endphp + @include('components.productpicker', array( + 'products' => $products, + 'nextInputSelector' => '#amount', + 'isRequired' => false, + 'prefillById' => $productId + )) +
@php if($mode == 'edit') { $value = $listItem->amount; } else { $value = 1; } @endphp @include('components.numberpicker', array( 'id' => 'amount', @@ -82,9 +83,10 @@ - + @if(GROCY_FEATURE_FLAG_STOCK)
@include('components.productcard')
+ @endif @stop