mirror of
https://github.com/grocy/grocy.git
synced 2025-08-16 18:54:35 +00:00
Use the products "Quick consume amount" optionally also on the consume page (closes #1148)
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
- The product option "Allow partial units in stock" was removed, partial amounts are now possible by default for all products
|
- The product option "Allow partial units in stock" was removed, partial amounts are now possible by default for all products
|
||||||
- On purchase there is now a warning shown, when the due date of the purchased product is earlier than the next due date in stock (enabled by default, can be disabled by a new stock setting (top right corner settings menu))
|
- On purchase there is now a warning shown, when the due date of the purchased product is earlier than the next due date in stock (enabled by default, can be disabled by a new stock setting (top right corner settings menu))
|
||||||
- The amount to be used for the "quick consume/open buttons" on the stock overview page can now be configured per product (new product option "Quick consume amount", defaults to 1)
|
- The amount to be used for the "quick consume/open buttons" on the stock overview page can now be configured per product (new product option "Quick consume amount", defaults to 1)
|
||||||
|
- This "Quick consume amount" can optionally also be used as the default on the consume page (new stock setting / top right corner settings menu)
|
||||||
- Products can now be duplicated (new button on the products list page, all fields will be preset from the copied product, except the name)
|
- Products can now be duplicated (new button on the products list page, all fields will be preset from the copied product, except the name)
|
||||||
- Optimized/clarified what the total/unit price is on the purchase page (thanks @kriddles)
|
- Optimized/clarified what the total/unit price is on the purchase page (thanks @kriddles)
|
||||||
- On the purchase page the amount field is now displayed above/before the due date for better `TAB` handling (thanks @kriddles)
|
- On the purchase page the amount field is now displayed above/before the due date for better `TAB` handling (thanks @kriddles)
|
||||||
|
@@ -116,6 +116,7 @@ DefaultUserSetting('stock_decimal_places_prices', 2); // Default decimal places
|
|||||||
DefaultUserSetting('stock_due_soon_days', 5);
|
DefaultUserSetting('stock_due_soon_days', 5);
|
||||||
DefaultUserSetting('stock_default_purchase_amount', 0);
|
DefaultUserSetting('stock_default_purchase_amount', 0);
|
||||||
DefaultUserSetting('stock_default_consume_amount', 1);
|
DefaultUserSetting('stock_default_consume_amount', 1);
|
||||||
|
DefaultUserSetting('stock_default_consume_amount_use_quick_consume_amount', false);
|
||||||
DefaultUserSetting('scan_mode_consume_enabled', false);
|
DefaultUserSetting('scan_mode_consume_enabled', false);
|
||||||
DefaultUserSetting('scan_mode_purchase_enabled', false);
|
DefaultUserSetting('scan_mode_purchase_enabled', false);
|
||||||
DefaultUserSetting('show_icon_on_stock_overview_page_when_product_is_on_shopping_list', true);
|
DefaultUserSetting('show_icon_on_stock_overview_page_when_product_is_on_shopping_list', true);
|
||||||
|
@@ -1993,3 +1993,6 @@ msgstr ""
|
|||||||
|
|
||||||
msgid "Download file"
|
msgid "Download file"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Use the products \"Quick consume amount\""
|
||||||
|
msgstr ""
|
||||||
|
@@ -94,7 +94,14 @@
|
|||||||
Grocy.Components.ProductAmountPicker.Reset();
|
Grocy.Components.ProductAmountPicker.Reset();
|
||||||
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||||
$("#display_amount").removeAttr("max");
|
$("#display_amount").removeAttr("max");
|
||||||
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount));
|
if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount))
|
||||||
|
{
|
||||||
|
$('#display_amount').val(productDetails.product.quick_consume_amount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount));
|
||||||
|
}
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
$("#tare-weight-handling-info").addClass("d-none");
|
$("#tare-weight-handling-info").addClass("d-none");
|
||||||
@@ -160,7 +167,14 @@ $('#save-mark-as-open-button').on('click', function(e)
|
|||||||
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
toastr.success(__t('Marked %1$s of %2$s as opened', jsonForm.amount + " " + __n(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + result.transaction_id + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
toastr.success(__t('Marked %1$s of %2$s as opened', jsonForm.amount + " " + __n(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + result.transaction_id + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||||
|
|
||||||
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount));
|
if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount))
|
||||||
|
{
|
||||||
|
$('#display_amount').val(productDetails.product.quick_consume_amount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount));
|
||||||
|
}
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
Grocy.Components.ProductPicker.Clear();
|
Grocy.Components.ProductPicker.Clear();
|
||||||
@@ -276,7 +290,14 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
|
|
||||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||||
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount));
|
if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount))
|
||||||
|
{
|
||||||
|
$('#display_amount').val(productDetails.product.quick_consume_amount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount));
|
||||||
|
}
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
|
|
||||||
|
@@ -21,4 +21,22 @@ if (BoolVal(Grocy.UserSettings.show_warning_on_purchase_when_due_date_is_earlier
|
|||||||
$("#show_warning_on_purchase_when_due_date_is_earlier_than_next").prop("checked", true);
|
$("#show_warning_on_purchase_when_due_date_is_earlier_than_next").prop("checked", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount))
|
||||||
|
{
|
||||||
|
$("#stock_default_consume_amount_use_quick_consume_amount").prop("checked", true);
|
||||||
|
$("#stock_default_consume_amount").attr("disabled", "");
|
||||||
|
}
|
||||||
|
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
|
|
||||||
|
$("#stock_default_consume_amount_use_quick_consume_amount").on("click", function()
|
||||||
|
{
|
||||||
|
if (this.checked)
|
||||||
|
{
|
||||||
|
$("#stock_default_consume_amount").attr("disabled", "");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#stock_default_consume_amount").removeAttr("disabled");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@@ -122,9 +122,23 @@
|
|||||||
'label' => 'Default amount for consume',
|
'label' => 'Default amount for consume',
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'decimals' => $userSettings['stock_decimal_places_amounts'],
|
'decimals' => $userSettings['stock_decimal_places_amounts'],
|
||||||
'additionalCssClasses' => 'user-setting-control locale-number-input locale-number-quantity-amount'
|
'additionalCssClasses' => 'user-setting-control locale-number-input locale-number-quantity-amount',
|
||||||
|
'additionalGroupCssClasses' => 'mb-0'
|
||||||
))
|
))
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="custom-control custom-checkbox">
|
||||||
|
<input type="checkbox"
|
||||||
|
class="form-check-input custom-control-input user-setting-control"
|
||||||
|
id="stock_default_consume_amount_use_quick_consume_amount"
|
||||||
|
data-setting-key="stock_default_consume_amount_use_quick_consume_amount">
|
||||||
|
<label class="form-check-label custom-control-label"
|
||||||
|
for="stock_default_consume_amount_use_quick_consume_amount">
|
||||||
|
{{ $__t('Use the products "Quick consume amount"') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h4 class="mt-2">{{ $__t('Common') }}</h4>
|
<h4 class="mt-2">{{ $__t('Common') }}</h4>
|
||||||
|
|
||||||
@include('components.numberpicker', array(
|
@include('components.numberpicker', array(
|
||||||
|
Reference in New Issue
Block a user