Added a new product option "Disable own stock" (closes #564)

This commit is contained in:
Bernd Bestel
2022-04-01 18:49:17 +02:00
parent b53d1a076f
commit ccc59dfc8b
10 changed files with 132 additions and 19 deletions

View File

@@ -38,8 +38,11 @@
href="#productcard-product-description">{{ $__t('Show more') }}</a>
</div>
<strong>{{ $__t('Stock amount') }}:</strong> <span id="productcard-product-stock-amount"
class="locale-number locale-number-quantity-amount"></span> <span id="productcard-product-stock-qu-name"></span>
<strong>{{ $__t('Stock amount') }}:</strong>
<span id="productcard-product-stock-amount-wrapper">
<span id="productcard-product-stock-amount"
class="locale-number locale-number-quantity-amount"></span> <span id="productcard-product-stock-qu-name"></span>
</span>
<span id="productcard-product-stock-opened-amount"
class="small font-italic locale-number locale-number-quantity-amount"></span>
<span id="productcard-aggregated-amounts"

View File

@@ -495,6 +495,20 @@
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input @if($mode=='edit'
&&
$product->no_own_stock == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="no_own_stock" name="no_own_stock" value="1">
<label class="form-check-label custom-control-label"
for="no_own_stock">{{ $__t('Disable own stock') }}&nbsp;<i class="fas fa-question-circle text-muted"
data-toggle="tooltip"
data-trigger="hover click"
title="{{ $__t('When enabled, this product can\'t have own stock, means it will not be selectable on purchase (useful for parent products which are just used as a summary/total view of the child products)') }}"></i>
</label>
</div>
</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>

View File

@@ -321,13 +321,15 @@
<td>
@if($currentStockEntry->product_group_name !== null){{ $currentStockEntry->product_group_name }}@endif
</td>
<td data-order="{{ $currentStockEntry->amount }}">
<span id="product-{{ $currentStockEntry->product_id }}-amount"
class="locale-number locale-number-quantity-amount">{{ $currentStockEntry->amount }}</span> <span id="product-{{ $currentStockEntry->product_id }}-qu-name">{{ $__n($currentStockEntry->amount, $currentStockEntry->qu_unit_name, $currentStockEntry->qu_unit_name_plural) }}</span>
<span id="product-{{ $currentStockEntry->product_id }}-opened-amount"
class="small font-italic">@if($currentStockEntry->amount_opened > 0){{ $__t('%s opened', $currentStockEntry->amount_opened) }}@endif</span>
<td data-order="@if($currentStockEntry->product_no_own_stock == 1){{ $currentStockEntry->amount_aggregated }}@else{{ $currentStockEntry->amount }}@endif">
<span class="@if($currentStockEntry->product_no_own_stock == 1) d-none @endif">
<span id="product-{{ $currentStockEntry->product_id }}-amount"
class="locale-number locale-number-quantity-amount">{{ $currentStockEntry->amount }}</span> <span id="product-{{ $currentStockEntry->product_id }}-qu-name">{{ $__n($currentStockEntry->amount, $currentStockEntry->qu_unit_name, $currentStockEntry->qu_unit_name_plural) }}</span>
<span id="product-{{ $currentStockEntry->product_id }}-opened-amount"
class="small font-italic">@if($currentStockEntry->amount_opened > 0){{ $__t('%s opened', $currentStockEntry->amount_opened) }}@endif</span>
</span>
@if($currentStockEntry->is_aggregated_amount == 1)
<span class="pl-1 text-secondary">
<span class="@if($currentStockEntry->product_no_own_stock == 0) pl-1 @endif text-secondary">
<i class="fas fa-custom-sigma-sign"></i> <span id="product-{{ $currentStockEntry->product_id }}-amount-aggregated"
class="locale-number locale-number-quantity-amount">{{ $currentStockEntry->amount_aggregated }}</span> {{ $__n($currentStockEntry->amount_aggregated, $currentStockEntry->qu_unit_name, $currentStockEntry->qu_unit_name_plural, true) }}
@if($currentStockEntry->amount_opened_aggregated > 0)