Make it possible to disable open per product (closes #1911)

This commit is contained in:
Bernd Bestel
2025-01-19 14:57:19 +01:00
parent 72e1a9aee7
commit bc78359dba
10 changed files with 139 additions and 11 deletions

View File

@@ -570,10 +570,18 @@
</div>
@endif
@include('components.userfieldsform', array(
'userfields' => $userfields,
'entity' => 'products'
))
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
<div class="form-group">
<div class="custom-control custom-checkbox">
<input @if($mode=='edit'
&&
$product->disable_open == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="disable_open" name="disable_open" value="1">
<label class="form-check-label custom-control-label"
for="disable_open">{{ $__t('Can\'t be opened') }}
</label>
</div>
</div>
@endif
<div class="form-group">
<div class="custom-control custom-checkbox">
@@ -589,7 +597,7 @@
</div>
</div>
<div class="form-group mb-5">
<div class="form-group">
<div class="custom-control custom-checkbox">
<input @if($mode=='edit'
&&
@@ -603,6 +611,12 @@
</div>
</div>
@include('components.userfieldsform', array(
'userfields' => $userfields,
'entity' => 'products'
))
<div class="py-5"></div>
<div class="sticky-form-footer pt-1">
<small id="save-hint"
class="my-1 form-text text-muted @if($mode == 'edit') d-none @endif">{{ $__t('Save & continue to add quantity unit conversions & barcodes') }}</small>
@@ -878,10 +892,10 @@
class="img-fluid img-thumbnail mt-2 mb-5"
loading="lazy">
<p id="delete-current-product-picture-on-save-hint"
class="form-text text-muted font-italic d-none mb-5">{{ $__t('The current picture will be deleted on save') }}</p>
class="form-text text-muted font-italic d-none pb-5">{{ $__t('The current picture will be deleted on save') }}</p>
@else
<p id="no-current-product-picture-hint"
class="form-text text-muted font-italic mb-5">{{ $__t('No picture available') }}</p>
class="form-text text-muted font-italic pb-5">{{ $__t('No picture available') }}</p>
@endif
</div>
</div>

View File

@@ -121,7 +121,7 @@
<i class="fa-solid fa-utensils"></i>
</a>
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
<a class="btn btn-success btn-sm product-open-button @if($stockEntry->open == 1 || FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->enable_tare_weight_handling == 1) disabled @endif"
<a class="btn btn-success btn-sm product-open-button @if($stockEntry->open == 1 || FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->enable_tare_weight_handling == 1 || FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->disable_open == 1) disabled @endif"
href="#"
data-toggle="tooltip"
data-placement="left"

View File

@@ -221,7 +221,7 @@
<i class="fa-solid fa-utensils"></i> {{ $__t('All') }}
</a>
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
<a class="btn btn-success btn-sm product-open-button @if($currentStockEntry->amount_aggregated < $currentStockEntry->quick_open_amount || $currentStockEntry->amount_aggregated == $currentStockEntry->amount_opened_aggregated || $currentStockEntry->enable_tare_weight_handling == 1) disabled @endif"
<a class="btn btn-success btn-sm product-open-button @if($currentStockEntry->amount_aggregated < $currentStockEntry->quick_open_amount || $currentStockEntry->amount_aggregated == $currentStockEntry->amount_opened_aggregated || $currentStockEntry->enable_tare_weight_handling == 1 || $currentStockEntry->disable_open == 1) disabled @endif"
href="#"
data-toggle="tooltip"
data-placement="left"