mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Use producamountpicker "everywhere" (closes #1015)
This commit is contained in:
parent
5f920e2cc6
commit
8bd157ca9d
@ -15,7 +15,9 @@ class StockController extends BaseController
|
|||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name'),
|
||||||
'barcodes' => $productBarcodes,
|
'barcodes' => $productBarcodes,
|
||||||
'recipes' => $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name'),
|
'recipes' => $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name'),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name')
|
'locations' => $this->getDatabase()->locations()->orderBy('name'),
|
||||||
|
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name'),
|
||||||
|
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +211,9 @@ class StockController extends BaseController
|
|||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name'),
|
||||||
'barcodes' => $productBarcodes,
|
'barcodes' => $productBarcodes,
|
||||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'),
|
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'),
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name')
|
'locations' => $this->getDatabase()->locations()->orderBy('name'),
|
||||||
|
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name'),
|
||||||
|
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,7 +437,9 @@ class StockController extends BaseController
|
|||||||
return $this->renderPage($response, 'transfer', [
|
return $this->renderPage($response, 'transfer', [
|
||||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name'),
|
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name'),
|
||||||
'barcodes' => $productBarcodes,
|
'barcodes' => $productBarcodes,
|
||||||
'locations' => $this->getDatabase()->locations()->orderBy('name')
|
'locations' => $this->getDatabase()->locations()->orderBy('name'),
|
||||||
|
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name'),
|
||||||
|
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,13 @@ Grocy.Components.ProductAmountPicker.AllowAnyQu = function(keepInitialQu = false
|
|||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.Components.ProductAmountPicker.Reset = function()
|
||||||
|
{
|
||||||
|
$("#qu_id").find("option").remove();
|
||||||
|
$("#qu-conversion-info").addClass("d-none");
|
||||||
|
$("#qu-display_amount-info").val("");
|
||||||
|
}
|
||||||
|
|
||||||
$(".input-group-productamountpicker").on("change", function()
|
$(".input-group-productamountpicker").on("change", function()
|
||||||
{
|
{
|
||||||
var destinationQuName = $("#qu_id").attr("data-destination-qu-name");
|
var destinationQuName = $("#qu_id").attr("data-destination-qu-name");
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
var jsonData = {};
|
var jsonData = {};
|
||||||
jsonData.amount = jsonForm.amount;
|
jsonData.amount = jsonForm.amount;
|
||||||
jsonData.exact_amount = (jsonForm.exact_amount == "on");
|
jsonData.exact_amount = $('#consume-exact-amount').is(':checked');
|
||||||
jsonData.spoiled = $('#spoiled').is(':checked');
|
jsonData.spoiled = $('#spoiled').is(':checked');
|
||||||
|
|
||||||
if ($("#use_specific_stock_entry").is(":checked"))
|
if ($("#use_specific_stock_entry").is(":checked"))
|
||||||
@ -91,12 +91,12 @@
|
|||||||
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
toastr.success(successMessage);
|
toastr.success(successMessage);
|
||||||
|
|
||||||
$("#amount").attr("min", "1");
|
Grocy.Components.ProductAmountPicker.Reset();
|
||||||
$("#amount").attr("max", "999999");
|
$("#display_amount").attr("min", "1");
|
||||||
$("#amount").attr("step", "1");
|
$("#display_amount").attr("max", "999999");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
$("#display_amount").attr("step", "1");
|
||||||
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
||||||
$('#amount_qu_unit').text("");
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
||||||
$("#tare-weight-handling-info").addClass("d-none");
|
$("#tare-weight-handling-info").addClass("d-none");
|
||||||
Grocy.Components.ProductPicker.Clear();
|
Grocy.Components.ProductPicker.Clear();
|
||||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_RECIPES)
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_RECIPES)
|
||||||
@ -110,6 +110,7 @@
|
|||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
Grocy.Components.ProductCard.Refresh(jsonForm.product_id);
|
Grocy.Components.ProductCard.Refresh(jsonForm.product_id);
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
|
$("#consume-exact-amount-group").addClass("d-none");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
@ -159,7 +160,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(parseFloat(Grocy.UserSettings.stock_default_consume_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
||||||
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');
|
||||||
@ -269,7 +270,8 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
Grocy.Api.Get('stock/products/' + productId,
|
Grocy.Api.Get('stock/products/' + productId,
|
||||||
function(productDetails)
|
function(productDetails)
|
||||||
{
|
{
|
||||||
$('#amount_qu_unit').text(productDetails.quantity_unit_stock.name);
|
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||||
|
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_purchase.id);
|
||||||
|
|
||||||
$("#location_id").find("option").remove().end().append("<option></option>");
|
$("#location_id").find("option").remove().end().append("<option></option>");
|
||||||
Grocy.Api.Get("stock/products/" + productId + '/locations',
|
Grocy.Api.Get("stock/products/" + productId + '/locations',
|
||||||
@ -305,7 +307,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
|
|
||||||
if (BoolVal(Grocy.UserSettings.scan_mode_consume_enabled))
|
if (BoolVal(Grocy.UserSettings.scan_mode_consume_enabled))
|
||||||
{
|
{
|
||||||
$("#amount").val(1);
|
$("#display_amount").val(1);
|
||||||
Grocy.FrontendHelpers.ValidateForm("consume-form");
|
Grocy.FrontendHelpers.ValidateForm("consume-form");
|
||||||
if (document.getElementById("consume-form").checkValidity() === true)
|
if (document.getElementById("consume-form").checkValidity() === true)
|
||||||
{
|
{
|
||||||
@ -326,22 +328,22 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
|
|
||||||
if (productDetails.product.allow_partial_units_in_stock == 1)
|
if (productDetails.product.allow_partial_units_in_stock == 1)
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||||
$("#amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
$("#display_amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1", parseFloat(productDetails.stock_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1", parseFloat(productDetails.stock_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", "1");
|
$("#display_amount").attr("min", "1");
|
||||||
$("#amount").attr("step", "1");
|
$("#display_amount").attr("step", "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", parseFloat(productDetails.stock_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", parseFloat(productDetails.stock_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (productDetails.product.enable_tare_weight_handling == 1)
|
if (productDetails.product.enable_tare_weight_handling == 1)
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", productDetails.product.tare_weight);
|
$("#display_amount").attr("min", productDetails.product.tare_weight);
|
||||||
$('#amount').attr('max', parseFloat(productDetails.stock_amount) + parseFloat(productDetails.product.tare_weight));
|
$('#display_amount').attr('max', parseFloat(productDetails.stock_amount) + parseFloat(productDetails.product.tare_weight));
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', parseFloat(productDetails.product.tare_weight).toLocaleString(), (parseFloat(productDetails.stock_amount) + parseFloat(productDetails.product.tare_weight)).toLocaleString()));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', parseFloat(productDetails.product.tare_weight).toLocaleString(), (parseFloat(productDetails.stock_amount) + parseFloat(productDetails.product.tare_weight)).toLocaleString()));
|
||||||
$("#tare-weight-handling-info").removeClass("d-none");
|
$("#tare-weight-handling-info").removeClass("d-none");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -351,6 +353,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
|
|
||||||
if ((parseFloat(productDetails.stock_amount) || 0) === 0)
|
if ((parseFloat(productDetails.stock_amount) || 0) === 0)
|
||||||
{
|
{
|
||||||
|
Grocy.Components.ProductAmountPicker.Reset();
|
||||||
Grocy.Components.ProductPicker.Clear();
|
Grocy.Components.ProductPicker.Clear();
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
Grocy.Components.ProductPicker.ShowCustomError(__t('This product is not in stock'));
|
Grocy.Components.ProductPicker.ShowCustomError(__t('This product is not in stock'));
|
||||||
@ -360,7 +363,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.HideCustomError();
|
Grocy.Components.ProductPicker.HideCustomError();
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
$('#amount').focus();
|
$('#display_amount').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (productDetails.stock_amount == productDetails.stock_amount_opened)
|
if (productDetails.stock_amount == productDetails.stock_amount_opened)
|
||||||
@ -380,10 +383,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
|
|
||||||
$('#amount').on('focus', function(e)
|
$('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
@ -436,14 +439,14 @@ $("#specific_stock_entry").on("change", function(e)
|
|||||||
sumValue = sumValue + parseFloat(stockEntry.amount);
|
sumValue = sumValue + parseFloat(stockEntry.amount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#amount").attr("max", sumValue);
|
$("#display_amount").attr("max", sumValue);
|
||||||
if (sumValue == 0)
|
if (sumValue == 0)
|
||||||
{
|
{
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('There are no units available at this location'));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('There are no units available at this location'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", sumValue));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", sumValue));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
@ -454,8 +457,8 @@ $("#specific_stock_entry").on("change", function(e)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", $('option:selected', this).attr('amount')));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", $('option:selected', this).attr('amount')));
|
||||||
$("#amount").attr("max", $('option:selected', this).attr('amount'));
|
$("#display_amount").attr("max", $('option:selected', this).attr('amount'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -558,17 +561,17 @@ function RefreshForm()
|
|||||||
var productDetails = current_productDetails;
|
var productDetails = current_productDetails;
|
||||||
if (productDetails.product.enable_tare_weight_handling == 1)
|
if (productDetails.product.enable_tare_weight_handling == 1)
|
||||||
{
|
{
|
||||||
$("#consume-exact-amount").parent().removeClass("d-none");
|
$("#consume-exact-amount-group").removeClass("d-none");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#consume-exact-amount").parent().addClass("d-none");
|
$("#consume-exact-amount-group").addClass("d-none");
|
||||||
}
|
}
|
||||||
if (productDetails.product.enable_tare_weight_handling == 1 && !$('#consume-exact-amount').is(':checked'))
|
if (productDetails.product.enable_tare_weight_handling == 1 && !$('#consume-exact-amount').is(':checked'))
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", productDetails.product.tare_weight);
|
$("#display_amount").attr("min", productDetails.product.tare_weight);
|
||||||
$('#amount').attr('max', sumValue + parseFloat(productDetails.product.tare_weight));
|
$('#display_amount').attr('max', sumValue + parseFloat(productDetails.product.tare_weight));
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', parseFloat(productDetails.product.tare_weight).toLocaleString(), (parseFloat(productDetails.stock_amount) + parseFloat(productDetails.product.tare_weight)).toLocaleString()));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', parseFloat(productDetails.product.tare_weight).toLocaleString(), (parseFloat(productDetails.stock_amount) + parseFloat(productDetails.product.tare_weight)).toLocaleString()));
|
||||||
$("#tare-weight-handling-info").removeClass("d-none");
|
$("#tare-weight-handling-info").removeClass("d-none");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -577,22 +580,22 @@ function RefreshForm()
|
|||||||
|
|
||||||
if (productDetails.product.allow_partial_units_in_stock == 1)
|
if (productDetails.product.allow_partial_units_in_stock == 1)
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||||
$("#amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
$("#display_amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1", parseFloat(productDetails.stock_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1", parseFloat(productDetails.stock_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", "1");
|
$("#display_amount").attr("min", "1");
|
||||||
$("#amount").attr("step", "1");
|
$("#display_amount").attr("step", "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", parseFloat(productDetails.stock_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", parseFloat(productDetails.stock_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#amount').attr('max', sumValue);
|
$('#display_amount').attr('max', sumValue);
|
||||||
|
|
||||||
if (sumValue == 0)
|
if (sumValue == 0)
|
||||||
{
|
{
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('There are no units available at this location'));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('There are no units available at this location'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,15 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonForm = $('#purchase-form').serializeJSON();
|
var jsonForm = $('#purchase-form').serializeJSON();
|
||||||
|
jsonForm.qu_factor_purchase_to_stock = $("#qu_id option:selected").attr("data-qu-factor");
|
||||||
|
|
||||||
Grocy.FrontendHelpers.BeginUiBusy("purchase-form");
|
Grocy.FrontendHelpers.BeginUiBusy("purchase-form");
|
||||||
|
|
||||||
Grocy.Api.Get('stock/products/' + jsonForm.product_id,
|
Grocy.Api.Get('stock/products/' + jsonForm.product_id,
|
||||||
function(productDetails)
|
function(productDetails)
|
||||||
{
|
{
|
||||||
var jsonData = {};
|
var jsonData = {};
|
||||||
jsonData.amount = jsonForm.amount * jsonForm.qu_factor_purchase_to_stock;
|
jsonData.amount = jsonForm.amount;
|
||||||
|
|
||||||
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||||
{
|
{
|
||||||
@ -97,12 +99,12 @@
|
|||||||
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
||||||
toastr.success(successMessage);
|
toastr.success(successMessage);
|
||||||
|
|
||||||
$("#amount").attr("min", "1");
|
Grocy.Components.ProductAmountPicker.Reset();
|
||||||
$("#amount").attr("step", "1");
|
$("#display_amount").attr("min", "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
$("#display_amount").attr("step", "1");
|
||||||
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
||||||
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
||||||
$('#price').val('');
|
$('#price').val('');
|
||||||
$('#amount_qu_unit').text("");
|
|
||||||
$("#tare-weight-handling-info").addClass("d-none");
|
$("#tare-weight-handling-info").addClass("d-none");
|
||||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||||
{
|
{
|
||||||
@ -183,7 +185,8 @@ if (Grocy.Components.ProductPicker !== undefined)
|
|||||||
Grocy.Api.Get('stock/products/' + productId,
|
Grocy.Api.Get('stock/products/' + productId,
|
||||||
function(productDetails)
|
function(productDetails)
|
||||||
{
|
{
|
||||||
|
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||||
|
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_purchase.id);
|
||||||
|
|
||||||
var qu_factor_purchase_to_stock = null;
|
var qu_factor_purchase_to_stock = null;
|
||||||
var barcode_shopping_location_id = null;
|
var barcode_shopping_location_id = null;
|
||||||
@ -226,26 +229,8 @@ if (Grocy.Components.ProductPicker !== undefined)
|
|||||||
Grocy.Components.LocationPicker.SetId(productDetails.location.id);
|
Grocy.Components.LocationPicker.SetId(productDetails.location.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#amount_qu_unit').attr("qu-factor-purchase-to-stock", qu_factor_purchase_to_stock);
|
|
||||||
$('#amount_qu_unit').attr("quantity-unit-purchase-name", productDetails.quantity_unit_purchase.name);
|
|
||||||
$('#amount_qu_unit').attr("quantity-unit-stock-name", productDetails.quantity_unit_stock.name);
|
|
||||||
$('#amount_qu_unit').attr("quantity-unit-stock-name-plural", productDetails.quantity_unit_stock.name_plural);
|
|
||||||
$('#qu_factor_purchase_to_stock').val(qu_factor_purchase_to_stock);
|
|
||||||
|
|
||||||
$('#price').val(parseFloat(productDetails.last_price * qu_factor_purchase_to_stock).toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }));
|
$('#price').val(parseFloat(productDetails.last_price * qu_factor_purchase_to_stock).toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }));
|
||||||
|
|
||||||
|
|
||||||
if (qu_factor_purchase_to_stock == 1)
|
|
||||||
{
|
|
||||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
|
|
||||||
$('#group-qu_factor_purchase_to_stock').addClass('d-none');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name + " (" + __t("will be multiplied by a factor of %1$s to get %2$s", parseFloat(qu_factor_purchase_to_stock).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }), __n(2, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural)) + ")");
|
|
||||||
$('#group-qu_factor_purchase_to_stock').removeClass('d-none');
|
|
||||||
}
|
|
||||||
|
|
||||||
var priceTypeUnitPrice = $("#price-type-unit-price");
|
var priceTypeUnitPrice = $("#price-type-unit-price");
|
||||||
var priceTypeUnitPriceLabel = $("[for=" + priceTypeUnitPrice.attr("id") + "]");
|
var priceTypeUnitPriceLabel = $("[for=" + priceTypeUnitPrice.attr("id") + "]");
|
||||||
priceTypeUnitPriceLabel.text(productDetails.quantity_unit_purchase.name + " price");
|
priceTypeUnitPriceLabel.text(productDetails.quantity_unit_purchase.name + " price");
|
||||||
@ -254,23 +239,23 @@ if (Grocy.Components.ProductPicker !== undefined)
|
|||||||
|
|
||||||
if (productDetails.product.allow_partial_units_in_stock == 1)
|
if (productDetails.product.allow_partial_units_in_stock == 1)
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||||
$("#amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
$("#display_amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", "1");
|
$("#display_amount").attr("min", "1");
|
||||||
$("#amount").attr("step", "1");
|
$("#display_amount").attr("step", "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (productDetails.product.enable_tare_weight_handling == 1)
|
if (productDetails.product.enable_tare_weight_handling == 1)
|
||||||
{
|
{
|
||||||
var minAmount = parseFloat(productDetails.product.tare_weight) / qu_factor_purchase_to_stock + parseFloat(productDetails.stock_amount);
|
var minAmount = parseFloat(productDetails.product.tare_weight) / qu_factor_purchase_to_stock + parseFloat(productDetails.stock_amount);
|
||||||
$("#amount").attr("min", minAmount);
|
$("#display_amount").attr("min", minAmount);
|
||||||
$("#amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
$("#display_amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', minAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', minAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts })));
|
||||||
$("#tare-weight-handling-info").removeClass("d-none");
|
$("#tare-weight-handling-info").removeClass("d-none");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -296,7 +281,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#amount").focus();
|
$("#display_amount").focus();
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && document.getElementById("purchase-form").checkValidity() === true)
|
if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && document.getElementById("purchase-form").checkValidity() === true)
|
||||||
@ -306,7 +291,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
|||||||
|
|
||||||
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
|
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
|
||||||
{
|
{
|
||||||
$("#amount").val(1);
|
$("#display_amount").val(1);
|
||||||
Grocy.FrontendHelpers.ValidateForm("purchase-form");
|
Grocy.FrontendHelpers.ValidateForm("purchase-form");
|
||||||
if (document.getElementById("purchase-form").checkValidity() === true)
|
if (document.getElementById("purchase-form").checkValidity() === true)
|
||||||
{
|
{
|
||||||
@ -328,7 +313,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
|
|
||||||
if (Grocy.Components.ProductPicker)
|
if (Grocy.Components.ProductPicker)
|
||||||
@ -343,7 +328,7 @@ if (Grocy.Components.ProductPicker)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#amount').on('focus', function(e)
|
$('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
||||||
{
|
{
|
||||||
@ -410,29 +395,19 @@ $('#price-type-total-price').on('change', function(e)
|
|||||||
refreshPriceHint();
|
refreshPriceHint();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#amount').on('change', function(e)
|
$('#display_amount').on('change', function(e)
|
||||||
{
|
{
|
||||||
refreshPriceHint();
|
refreshPriceHint();
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#qu_factor_purchase_to_stock').on('change', function(e)
|
|
||||||
{
|
|
||||||
var value = $(e.target).val();
|
|
||||||
$('#amount_qu_unit').attr("qu-factor-purchase-to-stock", value);
|
|
||||||
$('#amount_qu_unit').text(document.getElementById("amount_qu_unit").getAttribute("quantity-unit-purchase-name") + " (" + __t("will be multiplied by a factor of %1$s to get %2$s", parseFloat(value).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }), __n(2, document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name"), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name-plural")) + ")"));
|
|
||||||
refreshPriceHint();
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
|
||||||
});
|
|
||||||
|
|
||||||
if (GetUriParam("flow") === "shoppinglistitemtostock")
|
if (GetUriParam("flow") === "shoppinglistitemtostock")
|
||||||
{
|
{
|
||||||
$('#amount').val(parseFloat(GetUriParam("amount")).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
$('#display_amount').val(parseFloat(GetUriParam("amount")).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshPriceHint()
|
function refreshPriceHint()
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($('#amount').val() == 0)
|
if ($('#amount').val() == 0)
|
||||||
{
|
{
|
||||||
$('#price-hint').text("");
|
$('#price-hint').text("");
|
||||||
@ -446,24 +421,24 @@ function refreshPriceHint()
|
|||||||
|
|
||||||
if ($("input[name='price-type']:checked").val() == "total-price")
|
if ($("input[name='price-type']:checked").val() == "total-price")
|
||||||
{
|
{
|
||||||
var price = $('#price').val() / document.getElementById("amount_qu_unit").getAttribute("qu-factor-purchase-to-stock") / $('#amount').val();
|
var price = $('#price').val() / $("#qu_id option:selected").attr("data-qu-factor") / $('#amount').val();
|
||||||
var quprice = $('#price').val() / $('#amount').val();
|
var quprice = $('#price').val() / $('#amount').val();
|
||||||
|
|
||||||
if (document.getElementById("amount_qu_unit").getAttribute("qu-factor-purchase-to-stock") > 1)
|
if ($("#qu_id option:selected").attr("data-qu-factor") > 1)
|
||||||
{
|
{
|
||||||
$('#price-hint').text(__t('means %1$s per %2$s and %3$s per %4$s', price.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name"), quprice.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-purchase-name")));
|
$('#price-hint').text(__t('means %1$s per %2$s and %3$s per %4$s', price.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }), $("#qu_id").attr("data-destination-qu-name"), quprice.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-purchase-name")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#price-hint').text(__t('means %1$s per %2$s', price.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name")));
|
$('#price-hint').text(__t('means %1$s per %2$s', price.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }), $("#qu_id").attr("data-destination-qu-name")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (document.getElementById("amount_qu_unit").getAttribute("qu-factor-purchase-to-stock") > 1)
|
if ($("#qu_id option:selected").attr("data-qu-factor") > 1)
|
||||||
{
|
{
|
||||||
var price = $('#price').val() / document.getElementById("amount_qu_unit").getAttribute("qu-factor-purchase-to-stock");
|
var price = $('#price').val() / $("#qu_id option:selected").attr("data-qu-factor");
|
||||||
$('#price-hint').text(__t('means %1$s per %2$s', price.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name")));
|
$('#price-hint').text(__t('means %1$s per %2$s', price.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_prices }), $("#qu_id").attr("data-destination-qu-name")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -87,13 +87,13 @@
|
|||||||
$("#use_specific_stock_entry").click();
|
$("#use_specific_stock_entry").click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.Components.ProductAmountPicker.Reset();
|
||||||
$("#location_id_from").find("option").remove().end().append("<option></option>");
|
$("#location_id_from").find("option").remove().end().append("<option></option>");
|
||||||
$("#amount").attr("min", "1");
|
$("#display_amount").attr("min", "1");
|
||||||
$("#amount").attr("max", "999999");
|
$("#display_amount").attr("max", "999999");
|
||||||
$("#amount").attr("step", "1");
|
$("#display_amount").attr("step", "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount cannot be lower than %s', '1'));
|
||||||
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_transfer_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_transfer_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }));
|
||||||
$('#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();
|
||||||
$("#location_id_to").val("");
|
$("#location_id_to").val("");
|
||||||
@ -137,13 +137,15 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
Grocy.Api.Get('stock/products/' + productId,
|
Grocy.Api.Get('stock/products/' + productId,
|
||||||
function(productDetails)
|
function(productDetails)
|
||||||
{
|
{
|
||||||
|
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||||
|
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_purchase.id);
|
||||||
|
|
||||||
if (productDetails.product.enable_tare_weight_handling == 1)
|
if (productDetails.product.enable_tare_weight_handling == 1)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetPicker().parent().find(".invalid-feedback").text(__t('Products with Tare weight enabled are currently not supported for Transfer. Please select another product.'));
|
Grocy.Components.ProductPicker.GetPicker().parent().find(".invalid-feedback").text(__t('Products with Tare weight enabled are currently not supported for Transfer. Please select another product.'));
|
||||||
Grocy.Components.ProductPicker.Clear();
|
Grocy.Components.ProductPicker.Clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('#amount_qu_unit').text(productDetails.quantity_unit_stock.name);
|
|
||||||
|
|
||||||
$("#location_id_from").find("option").remove().end().append("<option></option>");
|
$("#location_id_from").find("option").remove().end().append("<option></option>");
|
||||||
Grocy.Api.Get("stock/products/" + productId + '/locations',
|
Grocy.Api.Get("stock/products/" + productId + '/locations',
|
||||||
@ -187,20 +189,20 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
|
|
||||||
if (productDetails.product.allow_partial_units_in_stock == 1)
|
if (productDetails.product.allow_partial_units_in_stock == 1)
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||||
$("#amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
$("#display_amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", "1");
|
$("#display_amount").attr("min", "1");
|
||||||
$("#amount").attr("step", "1");
|
$("#display_amount").attr("step", "1");
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", parseFloat(productDetails.stock_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 })));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", parseFloat(productDetails.stock_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 })));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (productDetails.product.enable_tare_weight_handling == 1)
|
if (productDetails.product.enable_tare_weight_handling == 1)
|
||||||
{
|
{
|
||||||
$("#amount").attr("min", productDetails.product.tare_weight);
|
$("#display_amount").attr("min", productDetails.product.tare_weight);
|
||||||
$("#tare-weight-handling-info").removeClass("d-none");
|
$("#tare-weight-handling-info").removeClass("d-none");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -219,7 +221,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.HideCustomError();
|
Grocy.Components.ProductPicker.HideCustomError();
|
||||||
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
||||||
$('#amount').focus();
|
$('#display_amount').focus();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
@ -230,7 +232,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#amount').val(parseFloat(Grocy.UserSettings.stock_default_transfer_amount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 4 }));
|
$('#display_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)
|
||||||
@ -282,14 +284,14 @@ $("#location_id_from").on('change', function(e)
|
|||||||
sumValue = sumValue + parseFloat(stockEntry.amount);
|
sumValue = sumValue + parseFloat(stockEntry.amount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#amount").attr("max", sumValue);
|
$("#display_amount").attr("max", sumValue);
|
||||||
if (sumValue == 0)
|
if (sumValue == 0)
|
||||||
{
|
{
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('There are no units available at this location'));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('There are no units available at this location'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", sumValue));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", sumValue));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
@ -311,7 +313,7 @@ $("#location_id_to").on('change', function(e)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#amount').on('focus', function(e)
|
$('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
@ -358,14 +360,14 @@ $("#specific_stock_entry").on("change", function(e)
|
|||||||
sumValue = sumValue + parseFloat(stockEntry.amount);
|
sumValue = sumValue + parseFloat(stockEntry.amount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#amount").attr("max", sumValue);
|
$("#display_amount").attr("max", sumValue);
|
||||||
if (sumValue == 0)
|
if (sumValue == 0)
|
||||||
{
|
{
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('There are no units available at this location'));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('There are no units available at this location'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", sumValue));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", sumValue));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
@ -376,8 +378,8 @@ $("#specific_stock_entry").on("change", function(e)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$("#amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", $('option:selected', this).attr('amount')));
|
$("#display_amount").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", $('option:selected', this).attr('amount')));
|
||||||
$("#amount").attr("max", $('option:selected', this).attr('amount'));
|
$("#display_amount").attr("max", $('option:selected', this).attr('amount'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -19,8 +19,12 @@
|
|||||||
<div id="datetimepicker-wrapper"
|
<div id="datetimepicker-wrapper"
|
||||||
class="form-group {{ $additionalGroupCssClasses }}">
|
class="form-group {{ $additionalGroupCssClasses }}">
|
||||||
<label for="{{ $id }}">{{ $__t($label) }}
|
<label for="{{ $id }}">{{ $__t($label) }}
|
||||||
|
@if(!empty($hint))
|
||||||
|
<i class="fas fa-question-circle"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="{{ $hint }}"></i>
|
||||||
|
@endif
|
||||||
<span class="small text-muted">
|
<span class="small text-muted">
|
||||||
@if(!empty($hint)){{ $__t($hint) }}@endif
|
|
||||||
<time id="datetimepicker-timeago"
|
<time id="datetimepicker-timeago"
|
||||||
class="timeago timeago-contextual"></time>
|
class="timeago timeago-contextual"></time>
|
||||||
</span>
|
</span>
|
||||||
@ -63,13 +67,21 @@
|
|||||||
<div id="datetimepicker-earlier-than-info"
|
<div id="datetimepicker-earlier-than-info"
|
||||||
class="form-text text-info font-italic d-none">{{ $earlierThanInfoText }}</div>
|
class="form-text text-info font-italic d-none">{{ $earlierThanInfoText }}</div>
|
||||||
@if(isset($shortcutValue) && isset($shortcutLabel))
|
@if(isset($shortcutValue) && isset($shortcutLabel))
|
||||||
<div class="form-check w-100">
|
<div class="form-group my-0">
|
||||||
<input class="form-check-input"
|
<div class="custom-control custom-checkbox">
|
||||||
type="checkbox"
|
<input type="hidden"
|
||||||
id="datetimepicker-shortcut"
|
name="datetimepicker-shortcut"
|
||||||
data-datetimepicker-shortcut-value="{{ $shortcutValue }}">
|
value="0">
|
||||||
<label class="form-check-label"
|
<input class="form-check-input custom-control-input"
|
||||||
for="datetimepicker-shortcut">{{ $__t($shortcutLabel) }}</label>
|
type="checkbox"
|
||||||
|
id="datetimepicker-shortcut"
|
||||||
|
name="datetimepicker-shortcut"
|
||||||
|
value="1"
|
||||||
|
data-datetimepicker-shortcut-value="{{ $shortcutValue }}">
|
||||||
|
<label class="form-check-label custom-control-label"
|
||||||
|
for="datetimepicker-shortcut">{{ $__t($shortcutLabel) }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,8 +18,12 @@
|
|||||||
<div id="datetimepicker2-wrapper"
|
<div id="datetimepicker2-wrapper"
|
||||||
class="form-group {{ $additionalGroupCssClasses }}">
|
class="form-group {{ $additionalGroupCssClasses }}">
|
||||||
<label for="{{ $id }}">{{ $__t($label) }}
|
<label for="{{ $id }}">{{ $__t($label) }}
|
||||||
|
@if(!empty($hint))
|
||||||
|
<i class="fas fa-question-circle"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="{{ $hint }}"></i>
|
||||||
|
@endif
|
||||||
<span class="small text-muted">
|
<span class="small text-muted">
|
||||||
@if(!empty($hint)){{ $__t($hint) }}@endif
|
|
||||||
<time id="datetimepicker2-timeago"
|
<time id="datetimepicker2-timeago"
|
||||||
class="timeago timeago-contextual"></time>
|
class="timeago timeago-contextual"></time>
|
||||||
</span>
|
</span>
|
||||||
|
@ -3,10 +3,13 @@
|
|||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
|
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
|
||||||
|
@php if(empty($additionalHtmlContextHelp)) { $additionalHtmlContextHelp = ''; } @endphp
|
||||||
|
|
||||||
<div class="form-group row {{ $additionalGroupCssClasses }}">
|
<div class="form-group row mb-0 {{ $additionalGroupCssClasses }}">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
{!! $additionalHtmlContextHelp !!}
|
||||||
|
|
||||||
|
<div class="row my-0">
|
||||||
|
|
||||||
@include('components.numberpicker', array(
|
@include('components.numberpicker', array(
|
||||||
'id' => 'display_amount',
|
'id' => 'display_amount',
|
||||||
@ -15,11 +18,12 @@
|
|||||||
'decimals' => $userSettings['stock_decimal_places_amounts'],
|
'decimals' => $userSettings['stock_decimal_places_amounts'],
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'invalidFeedback' => $__t('This cannot be negative and must be an integral number'),
|
'invalidFeedback' => $__t('This cannot be negative and must be an integral number'),
|
||||||
'additionalGroupCssClasses' => 'col-4 mb-1',
|
'additionalGroupCssClasses' => 'col-5 mb-1',
|
||||||
'additionalCssClasses' => 'input-group-productamountpicker'
|
'additionalCssClasses' => 'input-group-productamountpicker',
|
||||||
|
'additionalHtmlContextHelp' => ''
|
||||||
))
|
))
|
||||||
|
|
||||||
<div class="form-group col-8 mb-1">
|
<div class="form-group col-7 mb-1">
|
||||||
<label for="qu_id">{{ $__t('Quantity unit') }}</label>
|
<label for="qu_id">{{ $__t('Quantity unit') }}</label>
|
||||||
<select required
|
<select required
|
||||||
class="form-control input-group-productamountpicker"
|
class="form-control input-group-productamountpicker"
|
||||||
|
@ -6,15 +6,19 @@
|
|||||||
@php if(empty($prefillById)) { $prefillById = ''; } @endphp
|
@php if(empty($prefillById)) { $prefillById = ''; } @endphp
|
||||||
@php if(!isset($isRequired)) { $isRequired = true; } @endphp
|
@php if(!isset($isRequired)) { $isRequired = true; } @endphp
|
||||||
@php if(empty($hint)) { $hint = ''; } @endphp
|
@php if(empty($hint)) { $hint = ''; } @endphp
|
||||||
@php if(empty($hintId)) { $hintId = ''; } @endphp
|
|
||||||
@php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp
|
@php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp
|
||||||
|
|
||||||
<div class="form-group"
|
<div class="form-group"
|
||||||
data-next-input-selector="{{ $nextInputSelector }}"
|
data-next-input-selector="{{ $nextInputSelector }}"
|
||||||
data-prefill-by-name="{{ $prefillByName }}"
|
data-prefill-by-name="{{ $prefillByName }}"
|
||||||
data-prefill-by-id="{{ $prefillById }}">
|
data-prefill-by-id="{{ $prefillById }}">
|
||||||
<label for="recipe_id">{{ $__t('Recipe') }} <span id="{{ $hintId }}"
|
<label for="recipe_id">{{ $__t('Recipe') }}
|
||||||
class="small text-muted">{{ $hint }}</span></label>
|
@if(!empty($hint))
|
||||||
|
<i class="fas fa-question-circle"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="{{ $hint }}"></i>
|
||||||
|
@endif
|
||||||
|
</label>
|
||||||
<select class="form-control recipe-combobox"
|
<select class="form-control recipe-combobox"
|
||||||
id="recipe_id"
|
id="recipe_id"
|
||||||
name="recipe_id"
|
name="recipe_id"
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
<script>
|
||||||
|
Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!};
|
||||||
|
Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!};
|
||||||
|
</script>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-md-6 col-xl-4 pb-3">
|
<div class="col-xs-12 col-md-6 col-xl-4 pb-3">
|
||||||
<div class="title-related-links">
|
<div class="title-related-links">
|
||||||
@ -51,33 +56,31 @@
|
|||||||
'nextInputSelector' => '#amount',
|
'nextInputSelector' => '#amount',
|
||||||
'disallowAddProductWorkflows' => true
|
'disallowAddProductWorkflows' => true
|
||||||
))
|
))
|
||||||
<label for="consume-exact-amount"
|
|
||||||
class="d-none">
|
<div id="consume-exact-amount-group"
|
||||||
<input type="checkbox"
|
class="form-group d-none">
|
||||||
id="consume-exact-amount"
|
<div class="custom-control custom-checkbox">
|
||||||
name="exact_amount">
|
<input type="hidden"
|
||||||
{{ $__t('Consume exact amount') }}
|
name="consume-exact-amount"
|
||||||
</label>
|
value="0">
|
||||||
@include('components.numberpicker', array(
|
<input class="form-check-input custom-control-input"
|
||||||
'id' => 'amount',
|
type="checkbox"
|
||||||
'label' => 'Amount',
|
id="consume-exact-amount"
|
||||||
'hintId' => 'amount_qu_unit',
|
name="consume-exact-amount"
|
||||||
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1',
|
value="1">
|
||||||
'decimals' => $userSettings['stock_decimal_places_amounts'],
|
<label class="form-check-label custom-control-label"
|
||||||
'value' => 0,
|
for="consume-exact-amount">{{ $__t('Consume exact amount') }}
|
||||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@include('components.productamountpicker', array(
|
||||||
|
'value' => 1,
|
||||||
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
|
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
|
||||||
class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
|
class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
|
||||||
))
|
))
|
||||||
|
|
||||||
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||||
@php /*@include('components.locationpicker', array(
|
|
||||||
'id' => 'location_id',
|
|
||||||
'locations' => $locations,
|
|
||||||
'isRequired' => true,
|
|
||||||
'label' => 'Location'
|
|
||||||
))*/ @endphp
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="location_id">{{ $__t('Location') }}</label>
|
<label for="location_id">{{ $__t('Location') }}</label>
|
||||||
<select required
|
<select required
|
||||||
@ -94,26 +97,44 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="use_specific_stock_entry">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox"
|
<input type="hidden"
|
||||||
|
name="use_specific_stock_entry"
|
||||||
|
value="0">
|
||||||
|
<input class="form-check-input custom-control-input"
|
||||||
|
type="checkbox"
|
||||||
id="use_specific_stock_entry"
|
id="use_specific_stock_entry"
|
||||||
name="use_specific_stock_entry"> {{ $__t('Use a specific stock item') }}
|
name="use_specific_stock_entry"
|
||||||
<span class="small text-muted">{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}</span>
|
value="1">
|
||||||
</label>
|
<label class="form-check-label custom-control-label"
|
||||||
|
for="use_specific_stock_entry">{{ $__t('Use a specific stock item') }}
|
||||||
|
<i class="fas fa-question-circle"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<select disabled
|
<select disabled
|
||||||
class="form-control"
|
class="form-control mt-2"
|
||||||
id="specific_stock_entry"
|
id="specific_stock_entry"
|
||||||
name="specific_stock_entry">
|
name="specific_stock_entry">
|
||||||
<option></option>
|
<option></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="checkbox">
|
<div class="form-group">
|
||||||
<label for="spoiled">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox"
|
<input type="hidden"
|
||||||
|
name="spoiled"
|
||||||
|
value="0">
|
||||||
|
<input class="form-check-input custom-control-input"
|
||||||
|
type="checkbox"
|
||||||
id="spoiled"
|
id="spoiled"
|
||||||
name="spoiled"> {{ $__t('Spoiled') }}
|
name="spoiled"
|
||||||
</label>
|
value="1">
|
||||||
|
<label class="form-check-label custom-control-label"
|
||||||
|
for="spoiled">{{ $__t('Spoiled') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (GROCY_FEATURE_FLAG_RECIPES)
|
@if (GROCY_FEATURE_FLAG_RECIPES)
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
<script>
|
||||||
|
Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!};
|
||||||
|
Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!};
|
||||||
|
</script>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-md-6 col-xl-4">
|
<div class="col-xs-12 col-md-6 col-xl-4">
|
||||||
<div class="title-related-links">
|
<div class="title-related-links">
|
||||||
@ -48,16 +53,11 @@
|
|||||||
@include('components.productpicker', array(
|
@include('components.productpicker', array(
|
||||||
'products' => $products,
|
'products' => $products,
|
||||||
'barcodes' => $barcodes,
|
'barcodes' => $barcodes,
|
||||||
'nextInputSelector' => '#amount'
|
'nextInputSelector' => '#display_amount'
|
||||||
))
|
))
|
||||||
|
|
||||||
@include('components.numberpicker', array(
|
@include('components.productamountpicker', array(
|
||||||
'id' => 'amount',
|
'value' => 1,
|
||||||
'label' => 'Amount',
|
|
||||||
'hintId' => 'amount_qu_unit',
|
|
||||||
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1',
|
|
||||||
'decimals' => $userSettings['stock_decimal_places_amounts'],
|
|
||||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
|
|
||||||
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
|
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
|
||||||
class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
|
class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
|
||||||
))
|
))
|
||||||
@ -139,18 +139,6 @@
|
|||||||
value="0">
|
value="0">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@include('components.numberpicker', array(
|
|
||||||
'id' => 'qu_factor_purchase_to_stock',
|
|
||||||
'label' => 'Factor purchase to stock quantity unit',
|
|
||||||
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1',
|
|
||||||
'decimals' => $userSettings['stock_decimal_places_amounts'],
|
|
||||||
'additionalGroupCssClasses' => 'd-none',
|
|
||||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
|
|
||||||
'additionalCssClasses' => 'input-group-qu',
|
|
||||||
'additionalHtmlElements' => '<p id="qu-conversion-info"
|
|
||||||
class="form-text text-muted small d-none"></p>'
|
|
||||||
))
|
|
||||||
|
|
||||||
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||||
@include('components.locationpicker', array(
|
@include('components.locationpicker', array(
|
||||||
'locations' => $locations,
|
'locations' => $locations,
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
@section('viewJsName', 'transfer')
|
@section('viewJsName', 'transfer')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
<script>
|
||||||
|
Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!};
|
||||||
|
Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!};
|
||||||
|
</script>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-md-6 col-xl-4 pb-3">
|
<div class="col-xs-12 col-md-6 col-xl-4 pb-3">
|
||||||
<h2 class="title">@yield('title')</h2>
|
<h2 class="title">@yield('title')</h2>
|
||||||
@ -21,13 +26,6 @@
|
|||||||
'disallowAddProductWorkflows' => true
|
'disallowAddProductWorkflows' => true
|
||||||
))
|
))
|
||||||
|
|
||||||
@php /*@include('components.locationpicker', array(
|
|
||||||
'id' => 'location_from',
|
|
||||||
'locations' => $locations,
|
|
||||||
'isRequired' => true,
|
|
||||||
'label' => 'Transfer From Location'
|
|
||||||
))*/ @endphp
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="location_id_from">{{ $__t('From location') }}</label>
|
<label for="location_id_from">{{ $__t('From location') }}</label>
|
||||||
<select required
|
<select required
|
||||||
@ -43,39 +41,37 @@
|
|||||||
<div class="invalid-feedback">{{ $__t('A location is required') }}</div>
|
<div class="invalid-feedback">{{ $__t('A location is required') }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@include('components.numberpicker', array(
|
@include('components.productamountpicker', array(
|
||||||
'id' => 'amount',
|
|
||||||
'label' => 'Amount',
|
|
||||||
'hintId' => 'amount_qu_unit',
|
|
||||||
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1',
|
|
||||||
'decimals' => $userSettings['stock_decimal_places_amounts'],
|
|
||||||
'value' => 1,
|
'value' => 1,
|
||||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
|
|
||||||
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
|
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
|
||||||
class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
|
class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
|
||||||
))
|
))
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="use_specific_stock_entry">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox"
|
<input type="hidden"
|
||||||
|
name="use_specific_stock_entry"
|
||||||
|
value="0">
|
||||||
|
<input class="form-check-input custom-control-input"
|
||||||
|
type="checkbox"
|
||||||
id="use_specific_stock_entry"
|
id="use_specific_stock_entry"
|
||||||
name="use_specific_stock_entry"> {{ $__t('Use a specific stock item') }}
|
name="use_specific_stock_entry"
|
||||||
<span class="small text-muted">{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}</span>
|
value="1">
|
||||||
</label>
|
<label class="form-check-label custom-control-label"
|
||||||
|
for="use_specific_stock_entry">{{ $__t('Use a specific stock item') }}
|
||||||
|
<i class="fas fa-question-circle"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<select disabled
|
<select disabled
|
||||||
class="form-control"
|
class="form-control mt-2"
|
||||||
id="specific_stock_entry"
|
id="specific_stock_entry"
|
||||||
name="specific_stock_entry">
|
name="specific_stock_entry">
|
||||||
<option></option>
|
<option></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@php /*@include('components.locationpicker', array(
|
|
||||||
'locations' => $locations,
|
|
||||||
'isRequired' => true,
|
|
||||||
'label' => 'Transfer to Location'
|
|
||||||
))*/ @endphp
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="location_id_to">{{ $__t('To location') }}</label>
|
<label for="location_id_to">{{ $__t('To location') }}</label>
|
||||||
<select required
|
<select required
|
||||||
|
Loading…
x
Reference in New Issue
Block a user