mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Make presets for new products configurable (closes #92)
This commit is contained in:
@@ -283,8 +283,13 @@ $("form").on("click", "select", function()
|
||||
$(".user-setting-control").on("change", function()
|
||||
{
|
||||
var element = $(this);
|
||||
var inputType = element.attr("type").toLowerCase();
|
||||
var settingKey = element.attr("data-setting-key");
|
||||
|
||||
var inputType = "unknown";
|
||||
if (typeof element.attr("type") !== typeof undefined && element.attr("type") !== false)
|
||||
{
|
||||
inputType = element.attr("type").toLowerCase();
|
||||
}
|
||||
|
||||
if (inputType === "checkbox")
|
||||
{
|
||||
|
@@ -196,6 +196,24 @@ $('#delete-current-product-picture-button').on('click', function (e)
|
||||
$("#delete-current-product-picture-button").addClass("disabled");
|
||||
});
|
||||
|
||||
if (Grocy.EditMode === 'create')
|
||||
{
|
||||
if (Grocy.UserSettings.product_presets_location_id.toString() !== '-1')
|
||||
{
|
||||
$("#location_id").val(Grocy.UserSettings.product_presets_location_id);
|
||||
}
|
||||
|
||||
if (Grocy.UserSettings.product_presets_product_group_id.toString() !== '-1')
|
||||
{
|
||||
$("#product_group_id").val(Grocy.UserSettings.product_presets_product_group_id);
|
||||
}
|
||||
|
||||
if (Grocy.UserSettings.product_presets_qu_id.toString() !== '-1')
|
||||
{
|
||||
$("select.input-group-qu").val(Grocy.UserSettings.product_presets_qu_id);
|
||||
}
|
||||
}
|
||||
|
||||
$('#name').focus();
|
||||
$('.input-group-qu').trigger('change');
|
||||
Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||
|
3
public/viewjs/productpresets.js
Normal file
3
public/viewjs/productpresets.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$("#product_presets_location_id").val(Grocy.UserSettings.product_presets_location_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);
|
Reference in New Issue
Block a user