mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Always set number inputs in browser locale format (fixes #610)
This commit is contained in:
parent
86ef36d76a
commit
81e6530ddc
@ -27,7 +27,8 @@
|
|||||||
### API improvements
|
### API improvements
|
||||||
- The endpoint `/stock/products/{productId}/locations` now also returns the current stock amount of the product in that loctation (new field/property `amount`) (thanks @Forceu)
|
- The endpoint `/stock/products/{productId}/locations` now also returns the current stock amount of the product in that loctation (new field/property `amount`) (thanks @Forceu)
|
||||||
|
|
||||||
### General & other improvements
|
### General & other improvements/fixes
|
||||||
|
- Fixed that all number inputs are always prefilled in the browser locale number format
|
||||||
- New `config.php` setting `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD` which activates the number pad for best-before-date fields on (supported) mobile browsers (useful because of [shorthands](https://github.com/grocy/grocy#input-shorthands-for-date-fields)) (defaults to `true`) (thanks @Mik-)
|
- New `config.php` setting `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD` which activates the number pad for best-before-date fields on (supported) mobile browsers (useful because of [shorthands](https://github.com/grocy/grocy#input-shorthands-for-date-fields)) (defaults to `true`) (thanks @Mik-)
|
||||||
- Enhancements for the camera barcode scanner (thanks @Mik-)
|
- Enhancements for the camera barcode scanner (thanks @Mik-)
|
||||||
- The light button only displayed when the device has a flash light
|
- The light button only displayed when the device has a flash light
|
||||||
|
@ -83,7 +83,7 @@ $(".input-group-productamountpicker").on("change", function()
|
|||||||
$("#qu-conversion-info").text(__t("This equals %1$s %2$s in stock", destinationAmount.toLocaleString(), destinationQuName));
|
$("#qu-conversion-info").text(__t("This equals %1$s %2$s in stock", destinationAmount.toLocaleString(), destinationQuName));
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#amount").val(destinationAmount);
|
$("#amount").val(destinationAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#display_amount").on("keyup", function()
|
$("#display_amount").on("keyup", function()
|
||||||
|
@ -98,7 +98,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(Grocy.UserSettings.stock_default_consume_amount);
|
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
||||||
$('#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();
|
||||||
@ -162,7 +162,7 @@ $('#save-mark-as-open-button').on('click', function(e)
|
|||||||
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
toastr.success(__t('Marked %1$s of %2$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="UndoStockTransaction(\'' + result.transaction_id + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
toastr.success(__t('Marked %1$s of %2$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="UndoStockTransaction(\'' + result.transaction_id + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||||
|
|
||||||
$('#amount').val(Grocy.UserSettings.stock_default_consume_amount);
|
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
||||||
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');
|
||||||
@ -379,7 +379,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#amount').val(Grocy.UserSettings.stock_default_consume_amount);
|
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
|
|
||||||
$('#amount').on('focus', function(e)
|
$('#amount').on('focus', function(e)
|
||||||
|
@ -155,7 +155,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
$("#tare-weight-handling-info").addClass("d-none");
|
$("#tare-weight-handling-info").addClass("d-none");
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#price').val(productDetails.last_price);
|
$('#price').val(parseFloat(productDetails.last_price).toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: 2 }));
|
||||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
||||||
Grocy.Components.ShoppingLocationPicker.SetId(productDetails.last_shopping_location_id);
|
Grocy.Components.ShoppingLocationPicker.SetId(productDetails.last_shopping_location_id);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,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(Grocy.UserSettings.stock_default_purchase_amount);
|
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
||||||
$('#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");
|
||||||
@ -143,7 +143,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
|||||||
Grocy.Api.Get('stock/products/' + productId,
|
Grocy.Api.Get('stock/products/' + productId,
|
||||||
function(productDetails)
|
function(productDetails)
|
||||||
{
|
{
|
||||||
$('#price').val(productDetails.last_price);
|
$('#price').val(parseFloat(productDetails.last_price).toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: 2 }));
|
||||||
|
|
||||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
||||||
if (productDetails.last_shopping_location_id != null)
|
if (productDetails.last_shopping_location_id != null)
|
||||||
@ -258,7 +258,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#amount').val(Grocy.UserSettings.stock_default_purchase_amount);
|
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
|
|
||||||
if (Grocy.Components.ProductPicker)
|
if (Grocy.Components.ProductPicker)
|
||||||
@ -327,7 +327,7 @@ $('#amount').on('change', function(e)
|
|||||||
|
|
||||||
if (GetUriParam("flow") === "shoppinglistitemtostock")
|
if (GetUriParam("flow") === "shoppinglistitemtostock")
|
||||||
{
|
{
|
||||||
$('#amount').val(GetUriParam("amount"));
|
$('#amount').val(parseFloat(GetUriParam("amount")).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
||||||
}
|
}
|
||||||
|
|
||||||
function UndoStockBooking(bookingId)
|
function UndoStockBooking(bookingId)
|
||||||
|
@ -191,6 +191,6 @@ if (GetUriParam("list") !== undefined)
|
|||||||
|
|
||||||
if (GetUriParam("amount") !== undefined)
|
if (GetUriParam("amount") !== undefined)
|
||||||
{
|
{
|
||||||
$("#amount").val(GetUriParam("amount"));
|
$("#amount").val(parseFloat(GetUriParam("amount")).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
||||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,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(Grocy.UserSettings.stock_default_transfer_amount);
|
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_transfer_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
||||||
$('#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();
|
||||||
@ -233,7 +233,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#amount').val(Grocy.UserSettings.stock_default_transfer_amount);
|
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_transfer_amount)..toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
||||||
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
||||||
|
|
||||||
$("#location_id_from").on('change', function(e)
|
$("#location_id_from").on('change', function(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user