diff --git a/changelog/52_UNRELEASED_2019-xx-xx.md b/changelog/52_UNRELEASED_2019-xx-xx.md index 38b9c9f5..47069bb6 100644 --- a/changelog/52_UNRELEASED_2019-xx-xx.md +++ b/changelog/52_UNRELEASED_2019-xx-xx.md @@ -9,6 +9,7 @@ - Products "inherit" the default conversion and additionally can have their own / override the default ones - It's now possible to print a "Location Content Sheet" with the current stock per location - new button at the top of the stock overview page (thought to hang it at the location, note used amounts on paper and track it in grocy later) - The product description now can have formattings (HTML/WYSIWYG editor like for recipes) + - "Factor purchase to stock quantity unit" (product option) can now also be a decimal number when "Allow partial units in stock" is enabled - Recipe improvements - Based on the new linked quantity units, recipe ingredients can now use any product related unit, the amount is calculated according to the cnoversion factor of the unit relation - Chores improvements @@ -16,7 +17,7 @@ - Option per chore, different "assignment types" like "Random", "Who least did first", etc. - On the chores overview page the list can be filterd to only show chores assigned to the currently logged in user (or to any other user) - New option "Due date rollover" per chore which means the chore can never be overdue, the due date will shift forward each day when due - - When tracking an execution from the chores overview page, filter are re-applied afterwards (means when have filtered the page to only show overdue chores and after the execution the chore is not overdue anymore, it will now immediately hide id) + - When tracking an execution from the chores overview page, filters are re-applied afterwards (means when have filtered the page to only show overdue chores and after the execution the chore is not overdue anymore, it will now immediately hide id) - Equipment improvements/fixes - Fixed that the delete button not always deleted the currently selected equipment item - Userfield improvements/fixes diff --git a/public/viewjs/productform.js b/public/viewjs/productform.js index a30932ba..f4fa151b 100644 --- a/public/viewjs/productform.js +++ b/public/viewjs/productform.js @@ -201,18 +201,7 @@ $('.input-group-qu').on('change', function(e) var quIdStock = $("#qu_id_stock").val(); var factor = $('#qu_factor_purchase_to_stock').val(); - if (quIdPurchase != quIdStock) - { - $('#qu_factor_purchase_to_stock').attr("min", 2); - $("#qu_factor_purchase_to_stock").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '2')); - } - else - { - $('#qu_factor_purchase_to_stock').attr("min", 1); - $("#qu_factor_purchase_to_stock").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1')); - } - - if (factor > 1) + if (factor > 1 || quIdPurchase != quIdStock) { $('#qu-conversion-info').text(__t('This means 1 %1$s purchased will be converted into %2$s %3$s in stock', $("#qu_id_purchase option:selected").text(), (1 * factor).toString(), $("#qu_id_stock option:selected").text())); $('#qu-conversion-info').removeClass('d-none'); @@ -298,13 +287,19 @@ $("#allow_partial_units_in_stock").on("click", function() { if (this.checked) { - $("#min_stock_amount").attr("min", "0.00"); - $("#min_stock_amount").attr("step", "0.01"); + $("#min_stock_amount").attr("min", "0.0000"); + $("#min_stock_amount").attr("step", "0.0001"); + $("#qu_factor_purchase_to_stock").attr("min", "0.0001"); + $("#qu_factor_purchase_to_stock").attr("step", "0.0001"); + $("#qu_factor_purchase_to_stock").parent().find(".invalid-feedback").text(__t('This cannot be lower than %1$s and must be a valid number with max. %2$s decimal places', 0.0001.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 4 }), '4')); } else { $("#min_stock_amount").attr("min", "0"); $("#min_stock_amount").attr("step", "1"); + $("#qu_factor_purchase_to_stock").attr("min", "1"); + $("#qu_factor_purchase_to_stock").attr("step", "1"); + $("#qu_factor_purchase_to_stock").parent().find(".invalid-feedback").text(__t('This cannot be lower than %1$s and must be a valid number with max. %2$s decimal places', '1', '0')); } Grocy.FrontendHelpers.ValidateForm("product-form");