mirror of
https://github.com/grocy/grocy.git
synced 2026-04-08 05:36:15 +02:00
views consume.blade: add LocationPicker
This commit is contained in:
parent
9258f4eecd
commit
5aacf319a0
|
|
@ -50,7 +50,8 @@ class StockController extends BaseController
|
||||||
{
|
{
|
||||||
return $this->AppContainer->view->render($response, 'consume', [
|
return $this->AppContainer->view->render($response, 'consume', [
|
||||||
'products' => $this->Database->products()->orderBy('name'),
|
'products' => $this->Database->products()->orderBy('name'),
|
||||||
'recipes' => $this->Database->recipes()->orderBy('name')
|
'recipes' => $this->Database->recipes()->orderBy('name'),
|
||||||
|
'locations' => $this->Database->locations()->orderBy('name')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,15 @@
|
||||||
jsonData.stock_entry_id = jsonForm.specific_stock_entry;
|
jsonData.stock_entry_id = jsonForm.specific_stock_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||||
|
{
|
||||||
|
jsonData.location_id = Grocy.Components.LocationPicker.GetValue();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jsonData.location_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_RECIPES && Grocy.Components.RecipePicker.GetValue().toString().length > 0)
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_RECIPES && Grocy.Components.RecipePicker.GetValue().toString().length > 0)
|
||||||
{
|
{
|
||||||
jsonData.recipe_id = Grocy.Components.RecipePicker.GetValue();
|
jsonData.recipe_id = Grocy.Components.RecipePicker.GetValue();
|
||||||
|
|
@ -102,6 +111,10 @@
|
||||||
{
|
{
|
||||||
Grocy.Components.RecipePicker.Clear();
|
Grocy.Components.RecipePicker.Clear();
|
||||||
}
|
}
|
||||||
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||||
|
{
|
||||||
|
Grocy.Components.LocationPicker.Clear();
|
||||||
|
}
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
}
|
}
|
||||||
|
|
@ -197,6 +210,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
$('#amount').attr('max', productDetails.stock_amount);
|
$('#amount').attr('max', productDetails.stock_amount);
|
||||||
$('#amount_qu_unit').text(productDetails.quantity_unit_stock.name);
|
$('#amount_qu_unit').text(productDetails.quantity_unit_stock.name);
|
||||||
|
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||||
|
{
|
||||||
|
Grocy.Components.LocationPicker.SetId(productDetails.location.id);
|
||||||
|
}
|
||||||
|
|
||||||
if (productDetails.product.allow_partial_units_in_stock == 1)
|
if (productDetails.product.allow_partial_units_in_stock == 1)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,15 @@
|
||||||
'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>'
|
'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>'
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||||
|
@include('components.locationpicker', array(
|
||||||
|
'locations' => $locations,
|
||||||
|
'isRequired' => false
|
||||||
|
))
|
||||||
|
@else
|
||||||
|
<input type="hidden" name="location_id" id="location_id" value="1">
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="use_specific_stock_entry">
|
<label for="use_specific_stock_entry">
|
||||||
<input type="checkbox" id="use_specific_stock_entry" name="use_specific_stock_entry"> {{ $__t('Use a specific stock item') }}
|
<input type="checkbox" id="use_specific_stock_entry" name="use_specific_stock_entry"> {{ $__t('Use a specific stock item') }}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user