mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Show to amount of "Label per unit" stock entry labels (closes #2241)
This commit is contained in:
parent
55adc140b2
commit
02fe3f2119
@ -37,6 +37,7 @@
|
||||
- When clicking a product name on the products list (master data) or on the stock journal page, the product card will now be displayed (like on the stock overview page)
|
||||
- When using/scanning a product barcode and the purchase or inventory page, the barcode's note will now also be prefilled (if any)
|
||||
- Each row on the stock journal now also has a context-/more menu for quick access to product related actions (the same as on the stock overview page)
|
||||
- The amount of "Label per unit" stock entry labels (on purchase and inventory) is now displayed, to help prevent printing a lot of labels where this maybe is not intended
|
||||
- Fixed that hiding the "Purchased date" column (table options) on the stock entries page didn't work
|
||||
- Fixed that sorting by the "Value" and "Min. stock amount" columns on the stock overview page didn't work
|
||||
- Fixed that the consumed amount was wrong, when consuming multiple substituted subproducts at once and when multiple/different conversion factors were involved
|
||||
|
@ -2421,3 +2421,8 @@ msgstr ""
|
||||
|
||||
msgid "When displaying prices for this product, they will be related to this quantity unit"
|
||||
msgstr ""
|
||||
|
||||
msgid "This means 1 label will be printed"
|
||||
msgid_plural "This means %1$s labels will be printed"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
@ -283,11 +283,11 @@ __n = function(number, singularForm, pluralForm, isQu = false)
|
||||
|
||||
if (isQu)
|
||||
{
|
||||
return sprintf(Grocy.TranslatorQu.n__(singularForm, pluralForm, number, number), number.toString());
|
||||
return sprintf(Grocy.TranslatorQu.n__(singularForm, pluralForm, number, number), number.toLocaleString());
|
||||
}
|
||||
else
|
||||
{
|
||||
return sprintf(Grocy.Translator.n__(singularForm, pluralForm, number, number), number.toString());
|
||||
return sprintf(Grocy.Translator.n__(singularForm, pluralForm, number, number), number.toLocaleString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,11 @@ Grocy.Components.ProductAmountPicker.Reload = function(productId, destinationQuI
|
||||
|
||||
conversionsForProduct.forEach(conversion =>
|
||||
{
|
||||
if (conversion.to_qu_id == destinationQuId)
|
||||
{
|
||||
conversion.factor = 1;
|
||||
}
|
||||
|
||||
// Only conversions related to the destination QU are needed
|
||||
// + only add one conversion per to_qu_id (multiple ones can be a result of contradictory definitions = user input bullshit)
|
||||
if ((conversion.from_qu_id == destinationQuId || conversion.to_qu_id == destinationQuId) && !$('#qu_id option[value="' + conversion.to_qu_id + '"]').length)
|
||||
@ -108,7 +113,7 @@ $(".input-group-productamountpicker").on("change", function()
|
||||
n = 1;
|
||||
}
|
||||
|
||||
$("#amount").val(destinationAmount.toFixed(n).replace(/0*$/g, ''));
|
||||
$("#amount").val(destinationAmount.toFixed(n).replace(/0*$/g, '')).trigger("change");
|
||||
});
|
||||
|
||||
$("#display_amount").on("keyup", function()
|
||||
|
@ -77,7 +77,7 @@ $('#save-inventory-button').on('click', function(e)
|
||||
);
|
||||
}
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER && Number.parseFloat($("#display_amount").attr("data-estimated-booking-amount")) > 0)
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER && Number.parseFloat($("#amount").attr("data-estimated-booking-amount")) > 0)
|
||||
{
|
||||
if (Grocy.Webhooks.labelprinter !== undefined)
|
||||
{
|
||||
@ -265,6 +265,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER)
|
||||
{
|
||||
$("#stock_label_type").val(productDetails.product.default_stock_label_type);
|
||||
$("#stock_label_type").trigger("change");
|
||||
}
|
||||
|
||||
if (document.getElementById("product_id").getAttribute("barcode") != "null")
|
||||
@ -440,7 +441,7 @@ $('#display_amount').on('keyup', function(e)
|
||||
}
|
||||
|
||||
var estimatedBookingAmount = (newAmount - productStockAmount - containerWeight).toFixed(Grocy.UserSettings.stock_decimal_places_amounts);
|
||||
$("#display_amount").attr("data-estimated-booking-amount", estimatedBookingAmount);
|
||||
$("#amount").attr("data-estimated-booking-amount", estimatedBookingAmount).trigger("change");
|
||||
estimatedBookingAmount = Math.abs(estimatedBookingAmount);
|
||||
$('#inventory-change-info').removeClass('d-none');
|
||||
|
||||
@ -521,3 +522,23 @@ function UndoStockTransaction(transactionId)
|
||||
};
|
||||
|
||||
$("#display_amount").attr("min", "0");
|
||||
|
||||
$("#stock_label_type, #amount").on("change", function(e)
|
||||
{
|
||||
if ($("#stock_label_type").val() == 2)
|
||||
{
|
||||
var estimatedBookingAmount = Number.parseFloat($("#amount").attr("data-estimated-booking-amount"));
|
||||
if (estimatedBookingAmount > 0)
|
||||
{
|
||||
$("#stock-entry-label-info").text(__n(estimatedBookingAmount, "This means 1 label will be printed", "This means %1$s labels will be printed"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#stock-entry-label-info").text("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#stock-entry-label-info").text("");
|
||||
}
|
||||
});
|
||||
|
@ -340,6 +340,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER)
|
||||
{
|
||||
$("#stock_label_type").val(productDetails.product.default_stock_label_type);
|
||||
$("#stock_label_type").trigger("change");
|
||||
}
|
||||
|
||||
$("#display_amount").focus();
|
||||
@ -719,3 +720,15 @@ function ScanModeSubmit(singleUnit = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#stock_label_type, #amount").on("change", function(e)
|
||||
{
|
||||
if ($("#stock_label_type").val() == 2)
|
||||
{
|
||||
$("#stock-entry-label-info").text(__n(Number.parseFloat($("#amount").val()), "This means 1 label will be printed", "This means %1$s labels will be printed"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#stock-entry-label-info").text("");
|
||||
}
|
||||
});
|
||||
|
@ -123,7 +123,8 @@
|
||||
<option value="1">{{ $__t('Single label') }}</option>
|
||||
<option value="2">{{ $__t('Label per unit') }}</option>
|
||||
</select>
|
||||
<div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div>
|
||||
<div id="stock-entry-label-info"
|
||||
class="form-text text-info"></div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
@ -158,7 +158,8 @@
|
||||
<option value="1">{{ $__t('Single label') }}</option>
|
||||
<option value="2">{{ $__t('Label per unit') }}</option>
|
||||
</select>
|
||||
<div class="invalid-feedback">{{ $__t('A quantity unit is required') }}</div>
|
||||
<div id="stock-entry-label-info"
|
||||
class="form-text text-info"></div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user