mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 10:05:45 +00:00
Make it possible to customize the default amount for purchase/consume (closes #215)
This commit is contained in:
parent
bcd6dd4b20
commit
0eb974bd92
@ -11,6 +11,7 @@
|
|||||||
- Automations still use the default shopping list and also the default shopping list cannot be deleted
|
- Automations still use the default shopping list and also the default shopping list cannot be deleted
|
||||||
- More information on the product card like "Spoil rate" or "Average shelf life"
|
- More information on the product card like "Spoil rate" or "Average shelf life"
|
||||||
- It's now possible to set a price for added products during inventory
|
- It's now possible to set a price for added products during inventory
|
||||||
|
- It's now possible to customize the default amount for purchase/consume (see stock settings under the settings icon on the top right)
|
||||||
- Chores improvements
|
- Chores improvements
|
||||||
- New recurrence patterns - chores can now also be "scheduled" to repat daily/weekly/monthly
|
- New recurrence patterns - chores can now also be "scheduled" to repat daily/weekly/monthly
|
||||||
- New translations: (thanks all the translators)
|
- New translations: (thanks all the translators)
|
||||||
|
@ -61,6 +61,8 @@ DefaultUserSetting('product_presets_location_id', -1); // Default location id fo
|
|||||||
DefaultUserSetting('product_presets_product_group_id', -1); // Default product group id for new products (-1 means no product group is preset)
|
DefaultUserSetting('product_presets_product_group_id', -1); // Default product group id for new products (-1 means no product group is preset)
|
||||||
DefaultUserSetting('product_presets_qu_id', -1); // Default quantity unit id for new products (-1 means no quantity unit is preset)
|
DefaultUserSetting('product_presets_qu_id', -1); // Default quantity unit id for new products (-1 means no quantity unit is preset)
|
||||||
DefaultUserSetting('stock_expring_soon_days', 5);
|
DefaultUserSetting('stock_expring_soon_days', 5);
|
||||||
|
DefaultUserSetting('stock_default_purchase_amount', 0);
|
||||||
|
DefaultUserSetting('stock_default_consume_amount', 1);
|
||||||
|
|
||||||
# Chores settings
|
# Chores settings
|
||||||
DefaultUserSetting('chores_due_soon_days', 5);
|
DefaultUserSetting('chores_due_soon_days', 5);
|
||||||
|
@ -1212,3 +1212,12 @@ msgstr ""
|
|||||||
|
|
||||||
msgid "Not enough in stock"
|
msgid "Not enough in stock"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Expiring soon days"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Default amount for purchase"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Default amount for consume"
|
||||||
|
msgstr ""
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
$("#amount").attr("max", "999999");
|
$("#amount").attr("max", "999999");
|
||||||
$("#amount").attr("step", "1");
|
$("#amount").attr("step", "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
||||||
$('#amount').val(1);
|
$('#amount').val(Grocy.UserSettings.stock_default_consume_amount);
|
||||||
$('#amount_qu_unit').text("");
|
$('#amount_qu_unit').text("");
|
||||||
$("#tare-weight-handling-info").addClass("d-none");
|
$("#tare-weight-handling-info").addClass("d-none");
|
||||||
Grocy.Components.ProductPicker.Clear();
|
Grocy.Components.ProductPicker.Clear();
|
||||||
@ -135,7 +135,7 @@ $('#save-mark-as-open-button').on('click', function(e)
|
|||||||
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
toastr.success(__t('Marked %s %s of %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="UndoStockBooking(' + result.id + ')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
toastr.success(__t('Marked %s %s of %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="UndoStockBooking(' + result.id + ')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||||
|
|
||||||
$('#amount').val(1);
|
$('#amount').val(Grocy.UserSettings.stock_default_consume_amount);
|
||||||
Grocy.Components.ProductPicker.Clear();
|
Grocy.Components.ProductPicker.Clear();
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
@ -257,7 +257,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#amount').val(1);
|
$('#amount').val(Grocy.UserSettings.stock_default_consume_amount);
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
$("#amount").attr("min", "1");
|
$("#amount").attr("min", "1");
|
||||||
$("#amount").attr("step", "1");
|
$("#amount").attr("step", "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
||||||
$('#amount').val(0);
|
$('#amount').val(Grocy.UserSettings.stock_default_purchase_amount);
|
||||||
$('#price').val('');
|
$('#price').val('');
|
||||||
$('#amount_qu_unit').text("");
|
$('#amount_qu_unit').text("");
|
||||||
$("#tare-weight-handling-info").addClass("d-none");
|
$("#tare-weight-handling-info").addClass("d-none");
|
||||||
@ -177,7 +177,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#amount').val(0);
|
$('#amount').val(Grocy.UserSettings.stock_default_purchase_amount);
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
|
|
||||||
if (Grocy.Components.ProductPicker.InProductAddWorkflow() === false)
|
if (Grocy.Components.ProductPicker.InProductAddWorkflow() === false)
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
$("#product_presets_product_group_id").val(Grocy.UserSettings.product_presets_product_group_id);
|
$("#product_presets_product_group_id").val(Grocy.UserSettings.product_presets_product_group_id);
|
||||||
$("#product_presets_qu_id").val(Grocy.UserSettings.product_presets_qu_id);
|
$("#product_presets_qu_id").val(Grocy.UserSettings.product_presets_qu_id);
|
||||||
$("#stock_expring_soon_days").val(Grocy.UserSettings.stock_expring_soon_days);
|
$("#stock_expring_soon_days").val(Grocy.UserSettings.stock_expring_soon_days);
|
||||||
|
$("#stock_default_purchase_amount").val(Grocy.UserSettings.stock_default_purchase_amount);
|
||||||
|
$("#stock_default_consume_amount").val(Grocy.UserSettings.stock_default_consume_amount);
|
||||||
|
|
||||||
if (BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled))
|
if (BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled))
|
||||||
{
|
{
|
||||||
|
@ -53,6 +53,26 @@
|
|||||||
'additionalCssClasses' => 'user-setting-control'
|
'additionalCssClasses' => 'user-setting-control'
|
||||||
))
|
))
|
||||||
|
|
||||||
|
<h4 class="mt-2">{{ $__t('Purchase') }}</h4>
|
||||||
|
@include('components.numberpicker', array(
|
||||||
|
'id' => 'stock_default_purchase_amount',
|
||||||
|
'additionalAttributes' => 'data-setting-key="stock_default_purchase_amount"',
|
||||||
|
'label' => 'Default amount for purchase',
|
||||||
|
'min' => 0,
|
||||||
|
'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
|
||||||
|
'additionalCssClasses' => 'user-setting-control'
|
||||||
|
))
|
||||||
|
|
||||||
|
<h4 class="mt-2">{{ $__t('Consume') }}</h4>
|
||||||
|
@include('components.numberpicker', array(
|
||||||
|
'id' => 'stock_default_consume_amount',
|
||||||
|
'additionalAttributes' => 'data-setting-key="stock_default_consume_amount"',
|
||||||
|
'label' => 'Default amount for consume',
|
||||||
|
'min' => 1,
|
||||||
|
'invalidFeedback' => $__t('This cannot be lower than %s', '1'),
|
||||||
|
'additionalCssClasses' => 'user-setting-control'
|
||||||
|
))
|
||||||
|
|
||||||
@if(GROCY_FEATURE_FLAG_SHOPPINGLIST)
|
@if(GROCY_FEATURE_FLAG_SHOPPINGLIST)
|
||||||
<h4 class="mt-2">{{ $__t('Shopping list to stock workflow') }}</h4>
|
<h4 class="mt-2">{{ $__t('Shopping list to stock workflow') }}</h4>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user