Squashed commit

Make it possible to actively not-check a mandatory checkbox Userfield (closes #2601)
Pluralize the "opened" localization string (closes #2280)
Added a trendline to the price history chart (closes #2237)
Various minor style/code refinements
This commit is contained in:
Bernd Bestel
2025-01-14 17:54:06 +01:00
parent c99dd46007
commit 11d28622e8
32 changed files with 134 additions and 86 deletions

View File

@@ -182,11 +182,19 @@ Grocy.Components.UserfieldsForm.Load = function()
if (userfield.type == "datetime" && userfield.default_value == "now")
{
input.val(moment().format("YYYY-MM-DD HH:mm:ss"))
input.val(moment().format("YYYY-MM-DD HH:mm:ss"));
}
else if (userfield.type == "date" && userfield.default_value == "now")
{
input.val(moment().format("YYYY-MM-DD"))
input.val(moment().format("YYYY-MM-DD"));
}
else if (userfield.type == "checkbox" && userfield.input_required == 1)
{
input.prop("indeterminate", true);
input.on("change", function()
{
input.removeAttr("required");
});
}
});
@@ -212,6 +220,12 @@ Grocy.Components.UserfieldsForm.Load = function()
{
var input = $(".userfield-input[data-userfield-name='" + key + "']");
if (input.attr("type") == "checkbox")
{
// The required attribute for checkboxes is only relevant when creating objects
input.removeAttr("required");
}
if (input.attr("type") == "checkbox" && value == 1)
{
input.prop("checked", true);