mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Added a new product option "Should not be frozen" (closes #1320)
This commit is contained in:
parent
c048f403e6
commit
8cb8611b4f
@ -33,6 +33,8 @@
|
||||
- The product picker on the consume and transfer page now only shows products which are currently in stock
|
||||
- Added a filter option to only show in-stock products on the stock overview and products list page (master data)
|
||||
- Added new columns on the stock overview page (hidden by default): Product description, product default location, parent product
|
||||
- Added a new product option "Should not be frozen" (defaults to disabled and only visible when `FEATURE_FLAG_STOCK_PRODUCT_FREEZING` is enabled)
|
||||
- When enabled, on moving the product to a freezer location (so when freezing it), a corresponding warning will be shown
|
||||
- Optimized that when opening a product which has "Default due days after opened" set, the resulting date now never extends the original due date
|
||||
- Fixed that editing stock entries was not possible
|
||||
- Fixed that consuming with Scan Mode was not possible
|
||||
|
@ -2172,3 +2172,12 @@ msgstr ""
|
||||
|
||||
msgid "Timestamp"
|
||||
msgstr ""
|
||||
|
||||
msgid "Should not be frozen"
|
||||
msgstr ""
|
||||
|
||||
msgid "When enabled, on moving this product to a freezer location (so when freezing it), a warning will be shown"
|
||||
msgstr ""
|
||||
|
||||
msgid "This product shouldn't be frozen"
|
||||
msgstr ""
|
||||
|
2
migrations/0146.sql
Normal file
2
migrations/0146.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE products
|
||||
ADD should_not_be_frozen TINYINT NOT NULL DEFAULT 0 CHECK(should_not_be_frozen IN (0, 1));
|
@ -78,6 +78,11 @@
|
||||
if (parseInt($("#location_id_from option:selected").attr("data-is-freezer")) === 0 && parseInt($("#location_id_to option:selected").attr("data-is-freezer")) === 1) // Frozen
|
||||
{
|
||||
toastr.info('<span>' + __t("Frozen") + "</span> <i class='fas fa-snowflake'></i>");
|
||||
|
||||
if (BoolVal(productDetails.product.should_not_be_frozen))
|
||||
{
|
||||
toastr.warning(__t("This product shouldn't be frozen"));
|
||||
}
|
||||
}
|
||||
if (parseInt($("#location_id_from option:selected").attr("data-is-freezer")) === 1 && parseInt($("#location_id_to option:selected").attr("data-is-freezer")) === 0) // Thawed
|
||||
{
|
||||
|
@ -231,6 +231,50 @@
|
||||
value="1">
|
||||
@endif
|
||||
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING)
|
||||
@php if($mode == 'edit') { $value = $product->default_best_before_days_after_freezing; } else { $value = 0; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'default_best_before_days_after_freezing',
|
||||
'label' => 'Default due days after freezing',
|
||||
'min' => -1,
|
||||
'value' => $value,
|
||||
'hint' => $__t('On moving this product to a freezer location (so when freezing it), the due date will be replaced by today + this amount of days') . ' (' . $__t('-1 means that this product will be never overdue') . ')'
|
||||
))
|
||||
|
||||
@php if($mode == 'edit') { $value = $product->default_best_before_days_after_thawing; } else { $value = 0; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'default_best_before_days_after_thawing',
|
||||
'label' => 'Default due days after thawing',
|
||||
'min' => 0,
|
||||
'value' => $value,
|
||||
'hint' => $__t('On moving this product from a freezer location (so when thawing it), the due date will be replaced by today + this amount of days')
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input @if($mode=='edit'
|
||||
&&
|
||||
$product->should_not_be_frozen == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="should_not_be_frozen" name="should_not_be_frozen" value="1">
|
||||
<label class="form-check-label custom-control-label"
|
||||
for="should_not_be_frozen">{{ $__t('Should not be frozen') }} <i class="fas fa-question-circle text-muted"
|
||||
data-toggle="tooltip"
|
||||
data-trigger="hover click"
|
||||
title="{{ $__t('When enabled, on moving this product to a freezer location (so when freezing it), a warning will be shown') }}"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<input type="hidden"
|
||||
name="default_best_before_days_after_freezing"
|
||||
value="0">
|
||||
<input type="hidden"
|
||||
name="default_best_before_days_after_thawing"
|
||||
value="0">
|
||||
<input type="hidden"
|
||||
name="should_not_be_frozen"
|
||||
value="0">
|
||||
@endif
|
||||
|
||||
<div class="form-group">
|
||||
<label for="product_group_id">{{ $__t('Product group') }}</label>
|
||||
<select class="custom-control custom-select"
|
||||
@ -364,33 +408,6 @@
|
||||
'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount'
|
||||
))
|
||||
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING)
|
||||
@php if($mode == 'edit') { $value = $product->default_best_before_days_after_freezing; } else { $value = 0; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'default_best_before_days_after_freezing',
|
||||
'label' => 'Default due days after freezing',
|
||||
'min' => -1,
|
||||
'value' => $value,
|
||||
'hint' => $__t('On moving this product to a freezer location (so when freezing it), the due date will be replaced by today + this amount of days') . ' (' . $__t('-1 means that this product will be never overdue') . ')'
|
||||
))
|
||||
|
||||
@php if($mode == 'edit') { $value = $product->default_best_before_days_after_thawing; } else { $value = 0; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'default_best_before_days_after_thawing',
|
||||
'label' => 'Default due days after thawing',
|
||||
'min' => 0,
|
||||
'value' => $value,
|
||||
'hint' => $__t('On moving this product from a freezer location (so when thawing it), the due date will be replaced by today + this amount of days')
|
||||
))
|
||||
@else
|
||||
<input type="hidden"
|
||||
name="default_best_before_days_after_freezing"
|
||||
value="0">
|
||||
<input type="hidden"
|
||||
name="default_best_before_days_after_thawing"
|
||||
value="0">
|
||||
@endif
|
||||
|
||||
@php if($mode == 'edit') { $value = $product->quick_consume_amount; } else { $value = 1; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'quick_consume_amount',
|
||||
|
Loading…
x
Reference in New Issue
Block a user