mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 12:26:15 +02:00
viewjs: remove global component usage
This commit is contained in:
parent
e744aa8dc7
commit
f2f89830fd
|
|
@ -6,7 +6,7 @@
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("batterycard", scope);
|
||||
var batterycard = Grocy.Use("batterycard");
|
||||
|
||||
var batteriesOverviewTable = $scope('#batteries-overview-table').DataTable({
|
||||
'order': [[4, 'asc']],
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
|
||||
top.on("click", ".battery-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.BatteryCard.Refresh($scope(e.currentTarget).attr("data-battery-id"));
|
||||
batterycard.Refresh($scope(e.currentTarget).attr("data-battery-id"));
|
||||
$scope("#batteriesoverview-batterycard-modal").modal("show");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ function batteryformView(Grocy, scope = null)
|
|||
}
|
||||
|
||||
Grocy.Use("numberpicker");
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfieldsform = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('#save-battery-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -29,7 +29,7 @@ function batteryformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfieldsform.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -53,7 +53,7 @@ function batteryformView(Grocy, scope = null)
|
|||
Grocy.Api.Put('objects/batteries/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfieldsform.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -96,7 +96,7 @@ function batteryformView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfieldsform.UserfieldsForm.Load();
|
||||
$scope('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('battery-form');
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("batterycard");
|
||||
Grocy.Use("datetimepicker");
|
||||
var batterycard = Grocy.Use("batterycard");
|
||||
var datetimepicker = Grocy.Use("datetimepicker");
|
||||
|
||||
$scope('#save-batterytracking-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("batterytracking-form");
|
||||
toastr.success(__t('Tracked charge cycle of battery %1$s on %2$s', batteryDetails.battery.name, $scope('#tracked_time').find('input').val()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="Grocy.UndoChargeCycle(' + result.id + ')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||
Grocy.Components.BatteryCard.Refresh($('#battery_id').val());
|
||||
batterycard.Refresh($('#battery_id').val());
|
||||
|
||||
$scope('#battery_id').val('');
|
||||
$scope('#battery_id_text_input').focus();
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
var batteryId = $scope(e.target).val();
|
||||
if (batteryId)
|
||||
{
|
||||
Grocy.Components.BatteryCard.Refresh(batteryId);
|
||||
batterycard.Refresh(batteryId);
|
||||
$scope('#tracked_time').find('input').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
$scope('#battery_id_text_input').focus();
|
||||
$scope('#battery_id_text_input').val('');
|
||||
$scope('#battery_id_text_input').trigger('change');
|
||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||
datetimepicker.GetInputElement().trigger('input');
|
||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||
|
||||
$scope('#batterytracking-form input').keyup(function(event)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
}
|
||||
|
||||
Grocy.Use("numberpicker");
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfieldsform = Grocy.Use("userfieldsform");
|
||||
var productPicker = Grocy.Use("productpicker");
|
||||
|
||||
$scope('#save-chore-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -32,7 +33,7 @@
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfieldsform.Save(function()
|
||||
{
|
||||
Grocy.Api.Post('chores/executions/calculate-next-assignments', { "chore_id": Grocy.EditObjectId },
|
||||
function(result)
|
||||
|
|
@ -59,7 +60,7 @@
|
|||
Grocy.Api.Put('objects/chores/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfieldsform.Save(function()
|
||||
{
|
||||
Grocy.Api.Post('chores/executions/calculate-next-assignments', { "chore_id": Grocy.EditObjectId },
|
||||
function(result)
|
||||
|
|
@ -114,7 +115,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfieldsform.Load();
|
||||
$scope('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
||||
|
||||
|
|
@ -127,7 +128,7 @@
|
|||
$scope("#consume_product_on_execution").click();
|
||||
$scope("#consume_product_on_execution").click();
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
productPicker.GetPicker().trigger('change');
|
||||
}, 100);
|
||||
|
||||
$scope('.input-group-chore-period-type').on('change', function(e)
|
||||
|
|
@ -218,19 +219,19 @@
|
|||
{
|
||||
if (this.checked)
|
||||
{
|
||||
Grocy.Components.ProductPicker.Enable();
|
||||
productPicker.Enable();
|
||||
$scope("#product_amount").removeAttr("disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.ProductPicker.Disable();
|
||||
productPicker.Disable();
|
||||
$scope("#product_amount").attr("disabled", "");
|
||||
}
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm("chore-form");
|
||||
});
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
productPicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
var productId = $scope(e.target).val();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("chorecard");
|
||||
var chorecard = Grocy.Use("chorecard");
|
||||
|
||||
var choresOverviewTable = $scope('#chores-overview-table').DataTable({
|
||||
'order': [[2, 'asc']],
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
|
||||
top.on("click", ".chore-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.ChoreCard.Refresh($scope(e.currentTarget).attr("data-chore-id"));
|
||||
chorecard.Refresh($scope(e.currentTarget).attr("data-chore-id"));
|
||||
$scope("#choresoverview-chorecard-modal").modal("show");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("chorecard");
|
||||
Grocy.Use("datetimepicker");
|
||||
var chorecard = Grocy.Use("chorecard");
|
||||
var datetimepicker = Grocy.Use("datetimepicker");
|
||||
Grocy.Use("userpicker");
|
||||
|
||||
$scope('#save-choretracking-button').on('click', function(e)
|
||||
|
|
@ -25,17 +25,17 @@
|
|||
Grocy.Api.Get('chores/' + jsonForm.chore_id,
|
||||
function(choreDetails)
|
||||
{
|
||||
Grocy.Api.Post('chores/' + jsonForm.chore_id + '/execute', { 'tracked_time': Grocy.Components.DateTimePicker.GetValue(), 'done_by': $scope("#user_id").val() },
|
||||
Grocy.Api.Post('chores/' + jsonForm.chore_id + '/execute', { 'tracked_time': datetimepicker.GetValue(), 'done_by': $scope("#user_id").val() },
|
||||
function(result)
|
||||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("choretracking-form");
|
||||
toastr.success(__t('Tracked execution of chore %1$s on %2$s', choreDetails.chore.name, Grocy.Components.DateTimePicker.GetValue()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="Grocy.UndoChoreExecution(' + result.id + ')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||
Grocy.Components.ChoreCard.Refresh($scope('#chore_id').val());
|
||||
toastr.success(__t('Tracked execution of chore %1$s on %2$s', choreDetails.chore.name, datetimepicker.GetValue()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="Grocy.UndoChoreExecution(' + result.id + ')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||
chorecard.Refresh($scope('#chore_id').val());
|
||||
|
||||
$scope('#chore_id').val('');
|
||||
$scope('#chore_id_text_input').focus();
|
||||
$scope('#chore_id_text_input').val('');
|
||||
Grocy.Components.DateTimePicker.SetValue(moment().format('YYYY-MM-DD HH:mm:ss'));
|
||||
datetimepicker.SetValue(moment().format('YYYY-MM-DD HH:mm:ss'));
|
||||
$scope('#chore_id_text_input').trigger('change');
|
||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||
},
|
||||
|
|
@ -68,13 +68,13 @@
|
|||
{
|
||||
if (chore.track_date_only == 1)
|
||||
{
|
||||
Grocy.Components.DateTimePicker.ChangeFormat("YYYY-MM-DD");
|
||||
Grocy.Components.DateTimePicker.SetValue(moment().format("YYYY-MM-DD"));
|
||||
datetimepicker.ChangeFormat("YYYY-MM-DD");
|
||||
datetimepicker.SetValue(moment().format("YYYY-MM-DD"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.DateTimePicker.ChangeFormat("YYYY-MM-DD HH:mm:ss");
|
||||
Grocy.Components.DateTimePicker.SetValue(moment().format("YYYY-MM-DD HH:mm:ss"));
|
||||
datetimepicker.ChangeFormat("YYYY-MM-DD HH:mm:ss");
|
||||
datetimepicker.SetValue(moment().format("YYYY-MM-DD HH:mm:ss"));
|
||||
}
|
||||
},
|
||||
function(xhr)
|
||||
|
|
@ -83,8 +83,8 @@
|
|||
}
|
||||
);
|
||||
|
||||
Grocy.Components.ChoreCard.Refresh(choreId);
|
||||
Grocy.Components.DateTimePicker.GetInputElement().focus();
|
||||
chorecard.Refresh(choreId);
|
||||
datetimepicker.GetInputElement().focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||
}
|
||||
});
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
|
||||
$scope('#chore_id_text_input').focus();
|
||||
$scope('#chore_id_text_input').trigger('change');
|
||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||
datetimepicker.GetInputElement().trigger('input');
|
||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||
|
||||
$scope('#choretracking-form input').keyup(function(event)
|
||||
|
|
@ -121,7 +121,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||
datetimepicker.GetInputElement().on('keypress', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ function consumeView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("productamountpicker");
|
||||
Grocy.Use("productcard");
|
||||
Grocy.Use("productpicker");
|
||||
Grocy.Use("recipepicker");
|
||||
var productamountpicker = Grocy.Use("productamountpicker");
|
||||
var productcard = Grocy.Use("productcard");
|
||||
var productpicker = Grocy.Use("productpicker");
|
||||
var recipepicker = Grocy.Use("recipepicker");
|
||||
|
||||
$scope('#save-consume-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -46,9 +46,9 @@ function consumeView(Grocy, scope = null)
|
|||
jsonData.location_id = $scope("#location_id").val();
|
||||
}
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_RECIPES && Grocy.Components.RecipePicker.GetValue().toString().length > 0)
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_RECIPES && recipepicker.GetValue().toString().length > 0)
|
||||
{
|
||||
jsonData.recipe_id = Grocy.Components.RecipePicker.GetValue();
|
||||
jsonData.recipe_id = recipepicker.GetValue();
|
||||
}
|
||||
|
||||
var bookingResponse = null;
|
||||
|
|
@ -113,9 +113,9 @@ function consumeView(Grocy, scope = null)
|
|||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||
toastr.success(successMessage);
|
||||
Grocy.Components.ProductPicker.FinishFlow();
|
||||
productpicker.FinishFlow();
|
||||
|
||||
Grocy.Components.ProductAmountPicker.Reset();
|
||||
productamountpicker.Reset();
|
||||
$scope("#display_amount").attr("min", Grocy.DefaultMinAmount);
|
||||
$scope("#display_amount").removeAttr("max");
|
||||
if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount))
|
||||
|
|
@ -129,17 +129,17 @@ function consumeView(Grocy, scope = null)
|
|||
RefreshLocaleNumberInput();
|
||||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
$scope("#tare-weight-handling-info").addClass("d-none");
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
productpicker.Clear();
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_RECIPES)
|
||||
{
|
||||
Grocy.Components.RecipePicker.Clear();
|
||||
recipepicker.Clear();
|
||||
}
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
{
|
||||
$scope("#location_id").find("option").remove().end().append("<option></option>");
|
||||
}
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
Grocy.Components.ProductCard.Refresh(jsonForm.product_id);
|
||||
productpicker.GetInputElement().focus();
|
||||
productcard.Refresh(jsonForm.product_id);
|
||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||
$scope("#consume-exact-amount-group").addClass("d-none");
|
||||
}
|
||||
|
|
@ -207,8 +207,8 @@ function consumeView(Grocy, scope = null)
|
|||
}
|
||||
RefreshLocaleNumberInput();
|
||||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.Clear();
|
||||
productpicker.GetInputElement().focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||
},
|
||||
function(xhr)
|
||||
|
|
@ -257,7 +257,7 @@ function consumeView(Grocy, scope = null)
|
|||
|
||||
if (locationId)
|
||||
{
|
||||
Grocy.Api.Get("stock/products/" + Grocy.Components.ProductPicker.GetValue() + '/entries?include_sub_products=true',
|
||||
Grocy.Api.Get("stock/products/" + productpicker.GetValue() + '/entries?include_sub_products=true',
|
||||
function(stockEntries)
|
||||
{
|
||||
stockEntries.forEach(stockEntry =>
|
||||
|
|
@ -286,7 +286,7 @@ function consumeView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Api.Get('stock/products/' + Grocy.Components.ProductPicker.GetValue(),
|
||||
Grocy.Api.Get('stock/products/' + productpicker.GetValue(),
|
||||
function(productDetails)
|
||||
{
|
||||
current_productDetails = productDetails;
|
||||
|
|
@ -311,7 +311,7 @@ function consumeView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
productpicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
if (BoolVal(Grocy.UserSettings.scan_mode_consume_enabled))
|
||||
{
|
||||
|
|
@ -329,15 +329,16 @@ function consumeView(Grocy, scope = null)
|
|||
|
||||
if (productId)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh(productId);
|
||||
productcard.Refresh(productId);
|
||||
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function(productDetails)
|
||||
{
|
||||
current_productDetails = productDetails;
|
||||
|
||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||
|
||||
if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount))
|
||||
{
|
||||
$scope('#display_amount').val(productDetails.product.quick_consume_amount);
|
||||
|
|
@ -400,7 +401,7 @@ function consumeView(Grocy, scope = null)
|
|||
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
productamountpicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
||||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
|
|
@ -437,15 +438,15 @@ function consumeView(Grocy, scope = null)
|
|||
|
||||
if ((parseFloat(productDetails.stock_amount_aggregated) || 0) === 0)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.Reset();
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
productamountpicker.Reset();
|
||||
productpicker.Clear();
|
||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||
Grocy.Components.ProductPicker.ShowCustomError(__t('This product is not in stock'));
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.ShowCustomError(__t('This product is not in stock'));
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.ProductPicker.HideCustomError();
|
||||
productpicker.HideCustomError();
|
||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||
$scope('#display_amount').focus();
|
||||
}
|
||||
|
|
@ -514,7 +515,7 @@ function consumeView(Grocy, scope = null)
|
|||
if ($(e.target).val() == "")
|
||||
{
|
||||
sumValue = 0;
|
||||
Grocy.Api.Get("stock/products/" + Grocy.Components.ProductPicker.GetValue() + '/entries?include_sub_products=true',
|
||||
Grocy.Api.Get("stock/products/" + productpicker.GetValue() + '/entries?include_sub_products=true',
|
||||
function(stockEntries)
|
||||
{
|
||||
stockEntries.forEach(stockEntry =>
|
||||
|
|
@ -574,8 +575,8 @@ function consumeView(Grocy, scope = null)
|
|||
|
||||
if (typeof locationId === 'undefined')
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetPicker().trigger('change');
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -587,7 +588,7 @@ function consumeView(Grocy, scope = null)
|
|||
}
|
||||
|
||||
// Default input field
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
|
||||
top.on("change", "#scan-mode", function(e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ function equipmentformView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('#save-equipment-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ function equipmentformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
// https://eslint.org/docs/rules/no-prototype-builtins
|
||||
if (Object.prototype.hasOwnProperty.call(jsonData, "instruction_manual_file_name") && !Grocy.DeleteInstructionManualOnSave)
|
||||
|
|
@ -90,7 +90,7 @@ function equipmentformView(Grocy, scope = null)
|
|||
Grocy.Api.Put('objects/equipment/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Object.prototype.hasOwnProperty.call(jsonData, "instruction_manual_file_name") && !Grocy.DeleteInstructionManualOnSave)
|
||||
{
|
||||
|
|
@ -155,7 +155,7 @@ function equipmentformView(Grocy, scope = null)
|
|||
});
|
||||
ResizeResponsiveEmbeds();
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
$scope('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('equipment-form');
|
||||
|
||||
|
|
|
|||
|
|
@ -8,17 +8,18 @@ function inventoryView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("datetimepicker");
|
||||
var dt1 = Grocy.Use("datetimepicker");
|
||||
var dt2 = null;
|
||||
if (Grocy.UserSettings.show_purchased_date_on_purchase)
|
||||
{
|
||||
Grocy.Use("datetimepicker2");
|
||||
dt2 = Grocy.Use("datetimepicker2");
|
||||
}
|
||||
Grocy.Use("locationpicker");
|
||||
var locationpicker = Grocy.Use("locationpicker");
|
||||
Grocy.Use("numberpicker");
|
||||
Grocy.Use("productpicker");
|
||||
Grocy.Use("productamountpicker");
|
||||
Grocy.Use("productcard");
|
||||
Grocy.Use("shoppinglocationpicker");
|
||||
var productpicker = Grocy.Use("productpicker");
|
||||
var productamountpicker = Grocy.Use("productamountpicker");
|
||||
var productcard = Grocy.Use("productcard");
|
||||
var shoppinglocationpicker = Grocy.Use("shoppinglocationpicker");
|
||||
|
||||
$scope('#save-inventory-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -43,18 +44,18 @@ function inventoryView(Grocy, scope = null)
|
|||
|
||||
var jsonData = {};
|
||||
jsonData.new_amount = jsonForm.amount;
|
||||
jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue();
|
||||
jsonData.best_before_date = dt1.GetValue();
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
jsonData.shopping_location_id = Grocy.Components.ShoppingLocationPicker.GetValue();
|
||||
jsonData.shopping_location_id = shoppinglocationpicker.GetValue();
|
||||
}
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
{
|
||||
jsonData.location_id = Grocy.Components.LocationPicker.GetValue();
|
||||
jsonData.location_id = locationpicker.GetValue();
|
||||
}
|
||||
if (Grocy.UserSettings.show_purchased_date_on_purchase)
|
||||
{
|
||||
jsonData.purchased_date = Grocy.Components.DateTimePicker2.GetValue();
|
||||
jsonData.purchased_date = dt2.GetValue();
|
||||
}
|
||||
|
||||
jsonData.price = price;
|
||||
|
|
@ -104,9 +105,9 @@ function inventoryView(Grocy, scope = null)
|
|||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("inventory-form");
|
||||
toastr.success(successMessage);
|
||||
Grocy.Components.ProductPicker.FinishFlow();
|
||||
productpicker.FinishFlow();
|
||||
|
||||
Grocy.Components.ProductAmountPicker.Reset();
|
||||
productamountpicker.Reset();
|
||||
$scope('#inventory-change-info').addClass('d-none');
|
||||
$scope("#tare-weight-handling-info").addClass("d-none");
|
||||
$scope("#display_amount").attr("min", "0");
|
||||
|
|
@ -114,14 +115,14 @@ function inventoryView(Grocy, scope = null)
|
|||
$scope('#display_amount').removeAttr("data-not-equal");
|
||||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
$scope('#price').val('');
|
||||
Grocy.Components.DateTimePicker.Clear();
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
dt1.Clear();
|
||||
productpicker.SetValue('');
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetValue('');
|
||||
shoppinglocationpicker.SetValue('');
|
||||
}
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
Grocy.Components.ProductCard.Refresh(jsonForm.product_id);
|
||||
productpicker.GetInputElement().focus();
|
||||
productcard.Refresh(jsonForm.product_id);
|
||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||
}
|
||||
},
|
||||
|
|
@ -147,19 +148,19 @@ function inventoryView(Grocy, scope = null)
|
|||
);
|
||||
});
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
productpicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
var productId = $scope(e.target).val();
|
||||
|
||||
if (productId)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh(productId);
|
||||
productcard.Refresh(productId);
|
||||
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function(productDetails)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||
|
||||
$scope('#display_amount').attr("data-stock-amount", productDetails.stock_amount)
|
||||
$scope('#display_amount').attr('data-not-equal', productDetails.stock_amount * $scope("#qu_id option:selected").attr("data-qu-factor"));
|
||||
|
|
@ -179,11 +180,11 @@ function inventoryView(Grocy, scope = null)
|
|||
RefreshLocaleNumberInput();
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetId(productDetails.last_shopping_location_id);
|
||||
shoppinglocationpicker.SetId(productDetails.last_shopping_location_id);
|
||||
}
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
{
|
||||
Grocy.Components.LocationPicker.SetId(productDetails.location.id);
|
||||
locationpicker.SetId(productDetails.location.id);
|
||||
}
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
|
||||
|
|
@ -199,7 +200,7 @@ function inventoryView(Grocy, scope = null)
|
|||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.DateTimePicker.SetValue(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD'));
|
||||
dt1.SetValue(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -223,7 +224,7 @@ function inventoryView(Grocy, scope = null)
|
|||
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
productamountpicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
||||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
|
|
@ -257,25 +258,25 @@ function inventoryView(Grocy, scope = null)
|
|||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||
|
||||
if (Grocy.Components.ProductPicker.InAnyFlow() === false && Grocy.GetUriParam("embedded") === undefined)
|
||||
if (productpicker.InAnyFlow() === false && Grocy.GetUriParam("embedded") === undefined)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
productpicker.GetPicker().trigger('change');
|
||||
|
||||
if (Grocy.Components.ProductPicker.InProductModifyWorkflow())
|
||||
if (productpicker.InProductModifyWorkflow())
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
}
|
||||
|
||||
$scope('#display_amount').on('focus', function(e)
|
||||
{
|
||||
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
||||
if (productpicker.GetValue().length === 0)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -312,19 +313,19 @@ function inventoryView(Grocy, scope = null)
|
|||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
||||
dt1.GetInputElement().on('change', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||
dt1.GetInputElement().on('keypress', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||
});
|
||||
|
||||
$scope('#display_amount').on('keyup', function(e)
|
||||
{
|
||||
var productId = Grocy.Components.ProductPicker.GetValue();
|
||||
var productId = productpicker.GetValue();
|
||||
var newAmount = parseInt($scope('#amount').val());
|
||||
|
||||
if (productId)
|
||||
|
|
@ -350,25 +351,25 @@ function inventoryView(Grocy, scope = null)
|
|||
else if (newAmount > productStockAmount + containerWeight)
|
||||
{
|
||||
$scope('#inventory-change-info').text(__t('This means %s will be added to stock', estimatedBookingAmount.toLocaleString() + ' ' + __n(estimatedBookingAmount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural)));
|
||||
Grocy.Components.DateTimePicker.GetInputElement().attr('required', '');
|
||||
dt1.GetInputElement().attr('required', '');
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
{
|
||||
Grocy.Components.LocationPicker.GetInputElement().attr('required', '');
|
||||
locationpicker.GetInputElement().attr('required', '');
|
||||
}
|
||||
}
|
||||
else if (newAmount < productStockAmount + containerWeight)
|
||||
{
|
||||
$scope('#inventory-change-info').text(__t('This means %s will be removed from stock', estimatedBookingAmount.toLocaleString() + ' ' + __n(estimatedBookingAmount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural)));
|
||||
Grocy.Components.DateTimePicker.GetInputElement().removeAttr('required');
|
||||
dt1.GetInputElement().removeAttr('required');
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
{
|
||||
Grocy.Components.LocationPicker.GetInputElement().removeAttr('required');
|
||||
locationpicker.GetInputElement().removeAttr('required');
|
||||
}
|
||||
}
|
||||
|
||||
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
|
||||
{
|
||||
Grocy.Components.DateTimePicker.GetInputElement().removeAttr('required');
|
||||
dt1.GetInputElement().removeAttr('required');
|
||||
}
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function locationformView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('#save-location-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@ function locationformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -52,7 +52,7 @@ function locationformView(Grocy, scope = null)
|
|||
Grocy.Api.Put('objects/locations/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -95,7 +95,7 @@ function locationformView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
Grocy.FrontendHelpers.ValidateForm('location-form');
|
||||
$scope('#name').focus();
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ function mealplanView(Grocy, scope = null)
|
|||
}
|
||||
|
||||
Grocy.Use("numberpicker");
|
||||
Grocy.Use("productamountpicker");
|
||||
Grocy.Use("recipepicker");
|
||||
var productamountpicker = Grocy.Use("productamountpicker");
|
||||
var recipepicker = Grocy.Use("recipepicker");
|
||||
|
||||
var setLocale = false;
|
||||
if (__t('fullcalendar_locale').replace(" ", "") !== "" && __t('fullcalendar_locale') != 'x')
|
||||
|
|
@ -329,7 +329,7 @@ function mealplanView(Grocy, scope = null)
|
|||
|
||||
$scope("#add-recipe-modal-title").text(__t("Add recipe on %s", day.toString()));
|
||||
$scope("#day").val(day.toString());
|
||||
Grocy.Components.RecipePicker.Clear();
|
||||
recipepicker.Clear();
|
||||
$scope("#add-recipe-modal").modal("show");
|
||||
Grocy.FrontendHelpers.ValidateForm("add-recipe-form");
|
||||
Grocy.IsMealPlanEntryEditAction = false;
|
||||
|
|
@ -353,7 +353,7 @@ function mealplanView(Grocy, scope = null)
|
|||
|
||||
$scope("#add-product-modal-title").text(__t("Add product on %s", day.toString()));
|
||||
$scope("#day").val(day.toString());
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
productpicker.Clear();
|
||||
$scope("#add-product-modal").modal("show");
|
||||
Grocy.FrontendHelpers.ValidateForm("add-product-form");
|
||||
Grocy.IsMealPlanEntryEditAction = false;
|
||||
|
|
@ -368,7 +368,7 @@ function mealplanView(Grocy, scope = null)
|
|||
$scope("#add-recipe-modal-title").text(__t("Edit recipe on %s", mealPlanEntry.day.toString()));
|
||||
$scope("#day").val(mealPlanEntry.day.toString());
|
||||
$scope("#recipe_servings").val(mealPlanEntry.recipe_servings);
|
||||
Grocy.Components.RecipePicker.SetId(mealPlanEntry.recipe_id);
|
||||
recipepicker.SetId(mealPlanEntry.recipe_id);
|
||||
$scope("#add-recipe-modal").modal("show");
|
||||
Grocy.FrontendHelpers.ValidateForm("add-recipe-form");
|
||||
}
|
||||
|
|
@ -376,10 +376,10 @@ function mealplanView(Grocy, scope = null)
|
|||
{
|
||||
$scope("#add-product-modal-title").text(__t("Edit product on %s", mealPlanEntry.day.toString()));
|
||||
$scope("#day").val(mealPlanEntry.day.toString());
|
||||
Grocy.Components.ProductPicker.SetId(mealPlanEntry.product_id);
|
||||
productpicker.SetId(mealPlanEntry.product_id);
|
||||
$scope("#add-product-modal").modal("show");
|
||||
Grocy.FrontendHelpers.ValidateForm("add-product-form");
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger("change");
|
||||
productpicker.GetPicker().trigger("change");
|
||||
}
|
||||
else if (mealPlanEntry.type == "note")
|
||||
{
|
||||
|
|
@ -395,7 +395,7 @@ function mealplanView(Grocy, scope = null)
|
|||
|
||||
$scope("#add-recipe-modal").on("shown.bs.modal", function(e)
|
||||
{
|
||||
Grocy.Components.RecipePicker.GetInputElement().focus();
|
||||
recipepicker.GetInputElement().focus();
|
||||
})
|
||||
|
||||
$scope("#add-note-modal").on("shown.bs.modal", function(e)
|
||||
|
|
@ -405,7 +405,7 @@ function mealplanView(Grocy, scope = null)
|
|||
|
||||
$scope("#add-product-modal").on("shown.bs.modal", function(e)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
})
|
||||
|
||||
top.on("click", ".remove-recipe-button, .remove-note-button, .remove-product-button", function(e)
|
||||
|
|
@ -826,7 +826,7 @@ function mealplanView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
productpicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
var productId = $scope(e.target).val();
|
||||
|
||||
|
|
@ -835,7 +835,7 @@ function mealplanView(Grocy, scope = null)
|
|||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function(productDetails)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
|
||||
$scope('#display_amount').val(1);
|
||||
RefreshLocaleNumberInput();
|
||||
|
|
@ -853,7 +853,7 @@ function mealplanView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.RecipePicker.GetPicker().on('change', function(e)
|
||||
recipepicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
var recipeId = $scope(e.target).val();
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ function productbarcodeformView(Grocy, scope = null)
|
|||
}
|
||||
|
||||
Grocy.Use('barcodescanner');
|
||||
Grocy.Use("productamountpicker");
|
||||
Grocy.Use("userfieldsform");
|
||||
var productamountpicker = Grocy.Use("productamountpicker");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('#save-barcode-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -35,7 +35,7 @@ function productbarcodeformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save()
|
||||
userfields.Save()
|
||||
|
||||
window.parent.postMessage(WindowMessageBag("ProductBarcodesChanged"), U("/product/" + Grocy.GetUriParam("product")));
|
||||
window.parent.postMessage(WindowMessageBag("CloseAllModals"), U("/product/" + Grocy.GetUriParam("product")));
|
||||
|
|
@ -49,7 +49,7 @@ function productbarcodeformView(Grocy, scope = null)
|
|||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save();
|
||||
userfields.Save();
|
||||
Grocy.Api.Put('objects/product_barcodes/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
|
|
@ -97,18 +97,18 @@ function productbarcodeformView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.ProductAmountPicker.Reload(Grocy.EditObjectProduct.id, Grocy.EditObjectProduct.qu_id_purchase);
|
||||
productamountpicker.Reload(Grocy.EditObjectProduct.id, Grocy.EditObjectProduct.qu_id_purchase);
|
||||
if (Grocy.EditMode == "edit")
|
||||
{
|
||||
$scope("#display_amount").val(Grocy.EditObject.amount);
|
||||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(Grocy.EditObject.qu_id);
|
||||
productamountpicker.SetQuantityUnit(Grocy.EditObject.qu_id);
|
||||
}
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('barcode-form');
|
||||
$scope('#barcode').focus();
|
||||
RefreshLocaleNumberInput();
|
||||
Grocy.Components.UserfieldsForm.Load()
|
||||
userfields.Load()
|
||||
|
||||
top.on("Grocy.BarcodeScanned", function(e, barcode, target)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,14 +11,15 @@ function productformView(Grocy, scope = null)
|
|||
}
|
||||
|
||||
Grocy.Use("numberpicker");
|
||||
Grocy.Use("shoppinglocationpicker");
|
||||
Grocy.Use("userfieldsform");
|
||||
var shoppinglocationpicker = Grocy.Use("shoppinglocationpicker");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
var productpicker = Grocy.Use("productpicker");
|
||||
|
||||
function saveProductPicture(result, location, jsonData)
|
||||
{
|
||||
var productId = Grocy.EditObjectId || result.created_object_id;
|
||||
|
||||
Grocy.Components.UserfieldsForm.Save(() =>
|
||||
userfields.Save(() =>
|
||||
{
|
||||
if (Object.prototype.hasOwnProperty.call(jsonData, "picture_file_name") && !Grocy.DeleteProductPictureOnSave)
|
||||
{
|
||||
|
|
@ -311,7 +312,7 @@ function productformView(Grocy, scope = null)
|
|||
$scope('#barcode-table tbody').removeClass("d-none");
|
||||
barcodeTable.columns.adjust().draw();
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
$scope("#name").trigger("keyup");
|
||||
$scope('#name').focus();
|
||||
$scope('.input-group-qu').trigger('change');
|
||||
|
|
@ -404,7 +405,7 @@ function productformView(Grocy, scope = null)
|
|||
{
|
||||
if (sourceProduct.parent_product_id != null)
|
||||
{
|
||||
Grocy.Components.ProductPicker.SetId(sourceProduct.parent_product_id);
|
||||
productpicker.SetId(sourceProduct.parent_product_id);
|
||||
}
|
||||
if (sourceProduct.description != null)
|
||||
{
|
||||
|
|
@ -413,7 +414,7 @@ function productformView(Grocy, scope = null)
|
|||
$scope("#location_id").val(sourceProduct.location_id);
|
||||
if (sourceProduct.shopping_location_id != null)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetId(sourceProduct.shopping_location_id);
|
||||
shoppinglocationpicker.SetId(sourceProduct.shopping_location_id);
|
||||
}
|
||||
$scope("#min_stock_amount").val(sourceProduct.min_stock_amount);
|
||||
if (BoolVal(sourceProduct.cumulate_min_stock_amount_of_sub_products))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function productgroupformView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('#save-product-group-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@ function productgroupformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
window.parent.postMessage(WindowMessageBag("CloseAllModals"), U("/productgroups"));
|
||||
});
|
||||
|
|
@ -45,7 +45,7 @@ function productgroupformView(Grocy, scope = null)
|
|||
Grocy.Api.Put('objects/product_groups/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
window.parent.postMessage(WindowMessageBag("CloseAllModals"), U("/productgroups"));
|
||||
});
|
||||
|
|
@ -81,7 +81,7 @@ function productgroupformView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
$scope('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('product-group-form');
|
||||
|
||||
|
|
|
|||
|
|
@ -9,16 +9,17 @@ function purchaseView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("datetimepicker");
|
||||
var datetimepicker = Grocy.Use("datetimepicker");
|
||||
if (Grocy.UserSettings.show_purchased_date_on_purchase)
|
||||
{
|
||||
Grocy.Use("datetimepicker2");
|
||||
var datetimepicker2 = Grocy.Use("datetimepicker2");
|
||||
}
|
||||
Grocy.Use("locationpicker");
|
||||
var locationpicker = Grocy.Use("locationpicker");
|
||||
Grocy.Use("numberpicker");
|
||||
Grocy.Use("productamountpicker");
|
||||
Grocy.Use("productcard");
|
||||
Grocy.Use("shoppinglocationpicker");
|
||||
var productamountpicker = Grocy.Use("productamountpicker");
|
||||
var productcard = Grocy.Use("productcard");
|
||||
var shoppinglocationpicker = Grocy.Use("shoppinglocationpicker");
|
||||
var productpicker = Grocy.Use("productpicker");
|
||||
|
||||
var CurrentProductDetails;
|
||||
|
||||
|
|
@ -70,12 +71,12 @@ function purchaseView(Grocy, scope = null)
|
|||
|
||||
if (BoolVal(Grocy.UserSettings.show_purchased_date_on_purchase))
|
||||
{
|
||||
jsonData.purchased_date = Grocy.Components.DateTimePicker2.GetValue();
|
||||
jsonData.purchased_date = datetimepicker2.GetValue();
|
||||
}
|
||||
|
||||
if (Grocy.Components.DateTimePicker)
|
||||
if (datetimepicker)
|
||||
{
|
||||
jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue();
|
||||
jsonData.best_before_date = datetimepicker.GetValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -84,11 +85,11 @@ function purchaseView(Grocy, scope = null)
|
|||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
jsonData.shopping_location_id = Grocy.Components.ShoppingLocationPicker.GetValue();
|
||||
jsonData.shopping_location_id = shoppinglocationpicker.GetValue();
|
||||
}
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
{
|
||||
jsonData.location_id = Grocy.Components.LocationPicker.GetValue();
|
||||
jsonData.location_id = locationpicker.GetValue();
|
||||
}
|
||||
|
||||
Grocy.Api.Post('stock/products/' + jsonForm.product_id + '/add', jsonData,
|
||||
|
|
@ -175,7 +176,7 @@ function purchaseView(Grocy, scope = null)
|
|||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
||||
toastr.success(successMessage);
|
||||
Grocy.Components.ProductPicker.FinishFlow();
|
||||
productpicker.FinishFlow();
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && BoolVal(Grocy.UserSettings.show_warning_on_purchase_when_due_date_is_earlier_than_next))
|
||||
{
|
||||
|
|
@ -185,7 +186,7 @@ function purchaseView(Grocy, scope = null)
|
|||
}
|
||||
}
|
||||
|
||||
Grocy.Components.ProductAmountPicker.Reset();
|
||||
productamountpicker.Reset();
|
||||
$scope("#purchase-form").removeAttr("data-used-barcode");
|
||||
$scope("#display_amount").attr("min", Grocy.DefaultMinAmount);
|
||||
$scope('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount));
|
||||
|
|
@ -194,19 +195,19 @@ function purchaseView(Grocy, scope = null)
|
|||
$scope("#tare-weight-handling-info").addClass("d-none");
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
{
|
||||
Grocy.Components.LocationPicker.Clear();
|
||||
locationpicker.Clear();
|
||||
}
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
|
||||
{
|
||||
Grocy.Components.DateTimePicker.Clear();
|
||||
datetimepicker.Clear();
|
||||
}
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
productpicker.SetValue('');
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetValue('');
|
||||
shoppinglocationpicker.SetValue('');
|
||||
}
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
Grocy.Components.ProductCard.Refresh(jsonForm.product_id);
|
||||
productpicker.GetInputElement().focus();
|
||||
productcard.Refresh(jsonForm.product_id);
|
||||
|
||||
$scope('#price-hint').text("");
|
||||
var priceTypeUnitPrice = $scope("#price-type-unit-price");
|
||||
|
|
@ -231,9 +232,9 @@ function purchaseView(Grocy, scope = null)
|
|||
);
|
||||
});
|
||||
|
||||
if (Grocy.Components.ProductPicker !== undefined)
|
||||
if (productpicker !== undefined)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
productpicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
|
||||
{
|
||||
|
|
@ -244,21 +245,21 @@ function purchaseView(Grocy, scope = null)
|
|||
|
||||
if (productId)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh(productId);
|
||||
productcard.Refresh(productId);
|
||||
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function(productDetails)
|
||||
{
|
||||
CurrentProductDetails = productDetails;
|
||||
|
||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.default_quantity_unit_purchase.id);
|
||||
productamountpicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.SetQuantityUnit(productDetails.default_quantity_unit_purchase.id);
|
||||
$scope('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount));
|
||||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
|
||||
if (Grocy.GetUriParam("flow") === "shoppinglistitemtostock")
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(Grocy.GetUriParam("quId"));
|
||||
productamountpicker.SetQuantityUnit(Grocy.GetUriParam("quId"));
|
||||
$scope('#display_amount').val(parseFloat(Grocy.GetUriParam("amount") * $scope("#qu_id option:selected").attr("data-qu-factor")));
|
||||
}
|
||||
|
||||
|
|
@ -268,17 +269,17 @@ function purchaseView(Grocy, scope = null)
|
|||
{
|
||||
if (productDetails.last_shopping_location_id != null)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetId(productDetails.last_shopping_location_id);
|
||||
shoppinglocationpicker.SetId(productDetails.last_shopping_location_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetId(productDetails.default_shopping_location_id);
|
||||
shoppinglocationpicker.SetId(productDetails.default_shopping_location_id);
|
||||
}
|
||||
}
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
{
|
||||
Grocy.Components.LocationPicker.SetId(productDetails.location.id);
|
||||
locationpicker.SetId(productDetails.location.id);
|
||||
}
|
||||
|
||||
if (productDetails.last_price == null || productDetails.last_price == 0)
|
||||
|
|
@ -321,7 +322,7 @@ function purchaseView(Grocy, scope = null)
|
|||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.DateTimePicker.SetValue(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD'));
|
||||
datetimepicker.SetValue(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -373,12 +374,12 @@ function purchaseView(Grocy, scope = null)
|
|||
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
productamountpicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING && barcode.shopping_location_id != null)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetId(barcode.shopping_location_id);
|
||||
shoppinglocationpicker.SetId(barcode.shopping_location_id);
|
||||
}
|
||||
|
||||
if (barcode.last_price != null && !barcode.last_price.isEmpty())
|
||||
|
|
@ -423,28 +424,28 @@ function purchaseView(Grocy, scope = null)
|
|||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
|
||||
if (Grocy.Components.ProductPicker)
|
||||
if (productpicker)
|
||||
{
|
||||
if (Grocy.Components.ProductPicker.InAnyFlow() === false && Grocy.GetUriParam("embedded") === undefined)
|
||||
if (productpicker.InAnyFlow() === false && Grocy.GetUriParam("embedded") === undefined)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
productpicker.GetPicker().trigger('change');
|
||||
|
||||
if (Grocy.Components.ProductPicker.InProductModifyWorkflow())
|
||||
if (productpicker.InProductModifyWorkflow())
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$scope('#display_amount').on('focus', function(e)
|
||||
{
|
||||
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
||||
if (productpicker.GetValue().length === 0)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -479,32 +480,32 @@ function purchaseView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
if (Grocy.Components.DateTimePicker)
|
||||
if (datetimepicker)
|
||||
{
|
||||
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
||||
datetimepicker.GetInputElement().on('change', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||
datetimepicker.GetInputElement().on('keypress', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
});
|
||||
}
|
||||
|
||||
if (Grocy.Components.DateTimePicker2)
|
||||
if (datetimepicker2)
|
||||
{
|
||||
Grocy.Components.DateTimePicker2.GetInputElement().on('change', function(e)
|
||||
datetimepicker2.GetInputElement().on('change', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker2.GetInputElement().on('keypress', function(e)
|
||||
datetimepicker2.GetInputElement().on('keypress', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker2.GetInputElement().trigger("input");
|
||||
datetimepicker2.GetInputElement().trigger("input");
|
||||
}
|
||||
|
||||
$scope('#price').on('keyup', function(e)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ function quantityunitconversionformView(Grocy, scope = null)
|
|||
}
|
||||
|
||||
Grocy.Use("numberpicker");
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('#save-quconversion-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -35,7 +35,7 @@ function quantityunitconversionformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if ($scope("#create_inverse").is(":checked"))
|
||||
{
|
||||
|
|
@ -48,7 +48,7 @@ function quantityunitconversionformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (typeof Grocy.GetUriParam("qu-unit") !== "undefined")
|
||||
{
|
||||
|
|
@ -108,7 +108,7 @@ function quantityunitconversionformView(Grocy, scope = null)
|
|||
Grocy.Api.Put('objects/quantity_unit_conversions/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (typeof Grocy.GetUriParam("qu-unit") !== "undefined")
|
||||
{
|
||||
|
|
@ -210,7 +210,7 @@ function quantityunitconversionformView(Grocy, scope = null)
|
|||
Grocy.FrontendHelpers.ValidateForm('quconversion-form');
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
$scope('.input-group-qu').trigger('change');
|
||||
$scope('#from_qu_id').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('quconversion-form');
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { WindowMessageBag } from '../helpers/messagebag';
|
||||
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('.save-quantityunit-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
Grocy.Api.Put('objects/quantity_units/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -153,7 +153,7 @@
|
|||
$scope('#qu-conversions-table tbody').removeClass("d-none");
|
||||
quConversionsTable.columns.adjust().draw();
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
$scope("#name").trigger("keyup");
|
||||
$scope('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('quantityunit-form');
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ function recipeformView(Grocy, scope = null)
|
|||
}
|
||||
|
||||
Grocy.Use("numberpicker");
|
||||
Grocy.Use("recipepicker");
|
||||
Grocy.Use("userfieldsform");
|
||||
var recipepicker = Grocy.Use("recipepicker");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
function saveRecipePicture(result, location, jsonData)
|
||||
{
|
||||
var recipeId = Grocy.EditObjectId || result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(() =>
|
||||
userfields.Save(() =>
|
||||
{
|
||||
if (Object.prototype.hasOwnProperty.call(jsonData, "picture_file_name") && !Grocy.DeleteRecipePictureOnSave)
|
||||
{
|
||||
|
|
@ -202,7 +202,7 @@ function recipeformView(Grocy, scope = null)
|
|||
$scope("#recipe-include-editform-title").text(__t("Edit included recipe"));
|
||||
$scope("#recipe-include-form").data("edit-mode", "edit");
|
||||
$scope("#recipe-include-form").data("recipe-nesting-id", id);
|
||||
Grocy.Components.RecipePicker.SetId(recipeId);
|
||||
recipepicker.SetId(recipeId);
|
||||
$scope("#includes_servings").val(recipeServings);
|
||||
$scope("#recipe-include-editform-modal").modal("show");
|
||||
Grocy.FrontendHelpers.ValidateForm("recipe-include-form");
|
||||
|
|
@ -243,8 +243,8 @@ function recipeformView(Grocy, scope = null)
|
|||
{
|
||||
$scope("#recipe-include-editform-title").text(__t("Add included recipe"));
|
||||
$scope("#recipe-include-form").data("edit-mode", "create");
|
||||
Grocy.Components.RecipePicker.Clear();
|
||||
Grocy.Components.RecipePicker.GetInputElement().focus();
|
||||
recipepicker.Clear();
|
||||
recipepicker.GetInputElement().focus();
|
||||
$scope("#recipe-include-editform-modal").modal("show");
|
||||
Grocy.FrontendHelpers.ValidateForm("recipe-include-form");
|
||||
},
|
||||
|
|
@ -273,7 +273,7 @@ function recipeformView(Grocy, scope = null)
|
|||
var editMode = $scope("#recipe-include-form").data("edit-mode");
|
||||
|
||||
var jsonData = {};
|
||||
jsonData.includes_recipe_id = Grocy.Components.RecipePicker.GetValue();
|
||||
jsonData.includes_recipe_id = recipepicker.GetValue();
|
||||
jsonData.servings = $scope("#includes_servings").val();
|
||||
jsonData.recipe_id = Grocy.EditObjectId;
|
||||
|
||||
|
|
@ -324,7 +324,7 @@ function recipeformView(Grocy, scope = null)
|
|||
$scope("#recipe-picture-label-none").removeClass("d-none");
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
|
||||
$(window).on("message", function(e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ function recipeposformView(Grocy, scope = null)
|
|||
}
|
||||
|
||||
Grocy.Use("numberpicker");
|
||||
Grocy.Use("productamountpicker");
|
||||
Grocy.Use("productcard");
|
||||
var productamountpicker = Grocy.Use("productamountpicker");
|
||||
var productcard = Grocy.Use("productcard");
|
||||
|
||||
Grocy.RecipePosFormInitialLoadDone = false;
|
||||
|
||||
|
|
@ -61,24 +61,24 @@ function recipeposformView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
productpicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
var productId = $scope(e.target).val();
|
||||
|
||||
if (productId)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh(productId);
|
||||
productcard.Refresh(productId);
|
||||
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function(productDetails)
|
||||
{
|
||||
if (!Grocy.RecipePosFormInitialLoadDone)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id, true);
|
||||
productamountpicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
}
|
||||
|
||||
if (Grocy.Mode == "create")
|
||||
|
|
@ -88,7 +88,7 @@ function recipeposformView(Grocy, scope = null)
|
|||
|
||||
if (!$scope("#only_check_single_unit_in_stock").prop("checked") && Grocy.RecipePosFormInitialLoadDone)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||
}
|
||||
|
||||
$scope('#display_amount').focus();
|
||||
|
|
@ -105,11 +105,11 @@ function recipeposformView(Grocy, scope = null)
|
|||
|
||||
Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');
|
||||
|
||||
if (Grocy.Components.ProductPicker.InProductAddWorkflow() === false)
|
||||
if (productpicker.InProductAddWorkflow() === false)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
productpicker.GetPicker().trigger('change');
|
||||
|
||||
if (Grocy.EditMode == "create")
|
||||
{
|
||||
|
|
@ -118,9 +118,9 @@ function recipeposformView(Grocy, scope = null)
|
|||
|
||||
$scope('#display_amount').on('focus', function(e)
|
||||
{
|
||||
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
||||
if (productpicker.GetValue().length === 0)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -160,21 +160,21 @@ function recipeposformView(Grocy, scope = null)
|
|||
if (this.checked)
|
||||
{
|
||||
$scope("#display_amount").attr("min", Grocy.DefaultMinAmount);
|
||||
Grocy.Components.ProductAmountPicker.AllowAnyQu(true);
|
||||
productamountpicker.AllowAnyQu(true);
|
||||
Grocy.FrontendHelpers.ValidateForm("recipe-pos-form");
|
||||
}
|
||||
else
|
||||
{
|
||||
$scope("#display_amount").attr("min", "0");
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger("change"); // Selects the default quantity unit of the selected product
|
||||
Grocy.Components.ProductAmountPicker.AllowAnyQuEnabled = false;
|
||||
productpicker.GetPicker().trigger("change"); // Selects the default quantity unit of the selected product
|
||||
productamountpicker.AllowAnyQuEnabled = false;
|
||||
Grocy.FrontendHelpers.ValidateForm("recipe-pos-form");
|
||||
}
|
||||
});
|
||||
|
||||
if ($scope("#only_check_single_unit_in_stock").prop("checked"))
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.AllowAnyQu(true);
|
||||
productamountpicker.AllowAnyQu(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ function shoppinglistView(Grocy, scope = null)
|
|||
}
|
||||
|
||||
Grocy.Use("calendarcard");
|
||||
Grocy.Use("productcard");
|
||||
var productcard = Grocy.Use("productcard");
|
||||
|
||||
var shoppingListTable = $scope('#shoppinglist-table').DataTable({
|
||||
'order': [[1, 'asc']],
|
||||
|
|
@ -105,7 +105,7 @@ function shoppinglistView(Grocy, scope = null)
|
|||
{
|
||||
if ($(e.currentTarget).attr("data-product-id") != "")
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
productcard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
$scope("#shoppinglist-productcard-modal").modal("show");
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { WindowMessageBag } from '../helpers/messagebag';
|
||||
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('#save-shopping-list-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
window.parent.postMessage(WindowMessageBag("ShoppingListChanged", result.created_object_id), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl);
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
Grocy.Api.Put('objects/shopping_lists/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
$scope('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('shopping-list-form');
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ function shoppinglistitemformView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("productamountpicker");
|
||||
Grocy.Use("userfieldsform");
|
||||
var productamountpicker = Grocy.Use("productamountpicker");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
Grocy.ShoppingListItemFormInitialLoadDone = false;
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ function shoppinglistitemformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save();
|
||||
userfields.Save();
|
||||
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -75,7 +75,7 @@ function shoppinglistitemformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save();
|
||||
userfields.Save();
|
||||
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -117,7 +117,7 @@ function shoppinglistitemformView(Grocy, scope = null)
|
|||
Grocy.Api.Put('objects/shopping_list/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save();
|
||||
userfields.Save();
|
||||
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -156,7 +156,7 @@ function shoppinglistitemformView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
productpicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
var productId = $scope(e.target).val();
|
||||
|
||||
|
|
@ -167,12 +167,12 @@ function shoppinglistitemformView(Grocy, scope = null)
|
|||
{
|
||||
if (!Grocy.ShoppingListItemFormInitialLoadDone)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id, true);
|
||||
productamountpicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.default_quantity_unit_purchase.id);
|
||||
productamountpicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.SetQuantityUnit(productDetails.default_quantity_unit_purchase.id);
|
||||
}
|
||||
|
||||
if ($scope("#display_amount").val().toString().isEmpty())
|
||||
|
|
@ -197,11 +197,11 @@ function shoppinglistitemformView(Grocy, scope = null)
|
|||
});
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
|
||||
if (Grocy.EditMode === "edit")
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
productpicker.GetPicker().trigger('change');
|
||||
}
|
||||
|
||||
if (Grocy.EditMode == "create")
|
||||
|
|
@ -253,12 +253,12 @@ function shoppinglistitemformView(Grocy, scope = null)
|
|||
{
|
||||
if (Grocy.GetUriParam("product") !== undefined)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
productpicker.GetPicker().trigger('change');
|
||||
$scope("#display_amount").focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -273,10 +273,10 @@ function shoppinglistitemformView(Grocy, scope = null)
|
|||
|
||||
if (Grocy.GetUriParam("product-name") != null)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
productpicker.GetPicker().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function shoppinglocationformView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('#save-shopping-location-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@ function shoppinglocationformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -52,7 +52,7 @@ function shoppinglocationformView(Grocy, scope = null)
|
|||
Grocy.Api.Put('objects/shopping_locations/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -95,7 +95,7 @@ function shoppinglocationformView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
$scope('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form');
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("productcard");
|
||||
Grocy.Use("productpicker");
|
||||
var productcard = Grocy.Use("productcard");
|
||||
var productpicker = Grocy.Use("productpicker");
|
||||
|
||||
var stockEntriesTable = $scope('#stockentries-table').DataTable({
|
||||
'order': [[2, 'asc']],
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
|
||||
{
|
||||
var productId = Grocy.Components.ProductPicker.GetValue();
|
||||
var productId = productpicker.GetValue();
|
||||
|
||||
if ((isNaN(productId) || productId == "" || productId == data[1]))
|
||||
{
|
||||
|
|
@ -35,16 +35,16 @@
|
|||
|
||||
$scope("#clear-filter-button").on("click", function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
productpicker.Clear();
|
||||
stockEntriesTable.draw();
|
||||
});
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
productpicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
stockEntriesTable.draw();
|
||||
});
|
||||
|
||||
Grocy.Components.ProductPicker.GetInputElement().on('keyup', function(e)
|
||||
productpicker.GetInputElement().on('keyup', function(e)
|
||||
{
|
||||
stockEntriesTable.draw();
|
||||
});
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
|
||||
top.on("click", ".stock-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-stock-id"));
|
||||
productcard.Refresh($(e.currentTarget).attr("data-stock-id"));
|
||||
$scope("#stockentry-productcard-modal").modal("show");
|
||||
});
|
||||
|
||||
|
|
@ -280,11 +280,11 @@
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
productpicker.GetPicker().trigger('change');
|
||||
|
||||
top.on("click", ".product-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
productcard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
$scope("#productcard-modal").modal("show");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ function stockentryformView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("datetimepicker");
|
||||
Grocy.Use("datetimepicker2");
|
||||
Grocy.Use("locationpicker");
|
||||
var datetimepicker = Grocy.Use("datetimepicker");
|
||||
var datetimepicker2 = Grocy.Use("datetimepicker2");
|
||||
var locationpicker = Grocy.Use("locationpicker");
|
||||
Grocy.Use("numberpicker");
|
||||
Grocy.Use("shoppinglocationpicker");
|
||||
var shoppinglocationpicker = Grocy.Use("shoppinglocationpicker");
|
||||
|
||||
$scope('#save-stockentry-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -33,15 +33,15 @@ function stockentryformView(Grocy, scope = null)
|
|||
|
||||
var jsonData = {};
|
||||
jsonData.amount = jsonForm.amount;
|
||||
jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue();
|
||||
jsonData.purchased_date = Grocy.Components.DateTimePicker2.GetValue();
|
||||
jsonData.best_before_date = datetimepicker.GetValue();
|
||||
jsonData.purchased_date = datetimepicker2.GetValue();
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
jsonData.shopping_location_id = Grocy.Components.ShoppingLocationPicker.GetValue();
|
||||
jsonData.shopping_location_id = shoppinglocationpicker.GetValue();
|
||||
}
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
{
|
||||
jsonData.location_id = Grocy.Components.LocationPicker.GetValue();
|
||||
jsonData.location_id = locationpicker.GetValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -92,22 +92,22 @@ function stockentryformView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
||||
datetimepicker.GetInputElement().on('change', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||
datetimepicker.GetInputElement().on('keypress', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker2.GetInputElement().on('change', function(e)
|
||||
datetimepicker2.GetInputElement().on('change', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||
});
|
||||
|
||||
Grocy.Components.DateTimePicker2.GetInputElement().on('keypress', function(e)
|
||||
datetimepicker2.GetInputElement().on('keypress', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("productcard");
|
||||
var productcard = Grocy.Use("productcard");
|
||||
|
||||
var stockOverviewTable = $scope('#stock-overview-table').DataTable({
|
||||
'order': [[5, 'asc']],
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
|
||||
top.on("click", ".product-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
productcard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
$("#stockoverview-productcard-modal").modal("show");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
Grocy.Api.Put('objects/task_categories/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
$scope('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('task-category-form');
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
import { WindowMessageBag } from '../helpers/messagebag';
|
||||
|
||||
Grocy.Use("datetimepicker");
|
||||
Grocy.Use("userfieldsform");
|
||||
var datetimepicker = Grocy.Use("datetimepicker");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('#save-task-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
var jsonData = $scope('#task-form').serializeJSON();
|
||||
jsonData.assigned_to_user_id = jsonData.user_id;
|
||||
delete jsonData.user_id;
|
||||
jsonData.due_date = Grocy.Components.DateTimePicker.GetValue();
|
||||
jsonData.due_date = datetimepicker.GetValue();
|
||||
|
||||
Grocy.FrontendHelpers.BeginUiBusy("task-form");
|
||||
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
Grocy.Api.Put('objects/tasks/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -100,9 +100,9 @@
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
$scope('#name').focus();
|
||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||
datetimepicker.GetInputElement().trigger('input');
|
||||
Grocy.FrontendHelpers.ValidateForm('task-form');
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ function transferView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("productpicker");
|
||||
Grocy.Use("productamountpicker");
|
||||
Grocy.Use("productcard");
|
||||
var productpicker = Grocy.Use("productpicker");
|
||||
var productamountpicker = Grocy.Use("productamountpicker");
|
||||
var productcard = Grocy.Use("productcard");
|
||||
|
||||
$scope('#save-transfer-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -101,7 +101,7 @@ function transferView(Grocy, scope = null)
|
|||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("transfer-form");
|
||||
toastr.success(successMessage);
|
||||
Grocy.Components.ProductPicker.FinishFlow();
|
||||
productpicker.FinishFlow();
|
||||
|
||||
if (parseInt($scope("#location_id_from option:selected").attr("data-is-freezer")) === 0 && parseInt($scope("#location_id_to option:selected").attr("data-is-freezer")) === 1) // Frozen
|
||||
{
|
||||
|
|
@ -120,7 +120,7 @@ function transferView(Grocy, scope = null)
|
|||
$scope("#use_specific_stock_entry").click();
|
||||
}
|
||||
|
||||
Grocy.Components.ProductAmountPicker.Reset();
|
||||
productamountpicker.Reset();
|
||||
$scope("#location_id_from").find("option").remove().end().append("<option></option>");
|
||||
$scope("#display_amount").attr("min", Grocy.DefaultMinAmount);
|
||||
$scope("#display_amount").removeAttr("max");
|
||||
|
|
@ -128,11 +128,11 @@ function transferView(Grocy, scope = null)
|
|||
RefreshLocaleNumberInput();
|
||||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
$scope("#tare-weight-handling-info").addClass("d-none");
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
productpicker.Clear();
|
||||
$scope("#location_id_to").val("");
|
||||
$scope("#location_id_from").val("");
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
Grocy.Components.ProductCard.Refresh(jsonForm.product_id);
|
||||
productpicker.GetInputElement().focus();
|
||||
productcard.Refresh(jsonForm.product_id);
|
||||
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
||||
}
|
||||
},
|
||||
|
|
@ -151,7 +151,7 @@ function transferView(Grocy, scope = null)
|
|||
);
|
||||
});
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
productpicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
$scope("#specific_stock_entry").find("option").remove().end().append("<option></option>");
|
||||
if ($scope("#use_specific_stock_entry").is(":checked") && Grocy.GetUriParam("stockId") == null)
|
||||
|
|
@ -168,18 +168,18 @@ function transferView(Grocy, scope = null)
|
|||
|
||||
if (productId)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh(productId);
|
||||
productcard.Refresh(productId);
|
||||
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function(productDetails)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.Reload(productDetails.product.id, productDetails.quantity_unit_stock.id);
|
||||
productamountpicker.SetQuantityUnit(productDetails.quantity_unit_stock.id);
|
||||
|
||||
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'));
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
productpicker.GetPicker().parent().find(".invalid-feedback").text(__t('Products with tare weight enabled are currently not supported for transfer'));
|
||||
productpicker.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ function transferView(Grocy, scope = null)
|
|||
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
productamountpicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
||||
$scope(".input-group-productamountpicker").trigger("change");
|
||||
|
|
@ -279,14 +279,14 @@ function transferView(Grocy, scope = null)
|
|||
|
||||
if ((parseFloat(productDetails.stock_amount) || 0) === 0)
|
||||
{
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
productpicker.Clear();
|
||||
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
||||
Grocy.Components.ProductPicker.ShowCustomError(__t('This product is not in stock'));
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.ShowCustomError(__t('This product is not in stock'));
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.ProductPicker.HideCustomError();
|
||||
productpicker.HideCustomError();
|
||||
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
||||
$scope('#display_amount').focus();
|
||||
}
|
||||
|
|
@ -328,7 +328,7 @@ function transferView(Grocy, scope = null)
|
|||
|
||||
if (locationId)
|
||||
{
|
||||
Grocy.Api.Get("stock/products/" + Grocy.Components.ProductPicker.GetValue() + '/entries',
|
||||
Grocy.Api.Get("stock/products/" + productpicker.GetValue() + '/entries',
|
||||
function(stockEntries)
|
||||
{
|
||||
stockEntries.forEach(stockEntry =>
|
||||
|
|
@ -420,7 +420,7 @@ function transferView(Grocy, scope = null)
|
|||
if ($(e.target).val() == "")
|
||||
{
|
||||
var sumValue = 0;
|
||||
Grocy.Api.Get("stock/products/" + Grocy.Components.ProductPicker.GetValue() + '/entries',
|
||||
Grocy.Api.Get("stock/products/" + productpicker.GetValue() + '/entries',
|
||||
function(stockEntries)
|
||||
{
|
||||
stockEntries.forEach(stockEntry =>
|
||||
|
|
@ -475,8 +475,8 @@ function transferView(Grocy, scope = null)
|
|||
|
||||
if (typeof locationId === 'undefined')
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetPicker().trigger('change');
|
||||
productpicker.GetInputElement().focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -485,12 +485,12 @@ function transferView(Grocy, scope = null)
|
|||
$scope("#location_id_from").trigger('change');
|
||||
$scope("#use_specific_stock_entry").click();
|
||||
$scope("#use_specific_stock_entry").trigger('change');
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
productpicker.GetPicker().trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
// Default input field
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
productpicker.GetInputElement().focus();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
function SaveUserPicture(result, jsonData)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(() =>
|
||||
userfields.Save(() =>
|
||||
{
|
||||
if (Object.prototype.hasOwnProperty.call(jsonData, "picture_file_name") && !Grocy.DeleteUserPictureOnSave)
|
||||
{
|
||||
|
|
@ -152,7 +152,7 @@
|
|||
$scope("#user-picture-label-none").removeClass("d-none");
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
Grocy.FrontendHelpers.ValidateForm('user-form');
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function userobjectformView(Grocy, scope = null)
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("userfieldsform");
|
||||
var userfields = Grocy.Use("userfieldsform");
|
||||
|
||||
$scope('#save-userobject-button').on('click', function(e)
|
||||
{
|
||||
|
|
@ -30,7 +30,7 @@ function userobjectformView(Grocy, scope = null)
|
|||
function(result)
|
||||
{
|
||||
Grocy.EditObjectId = result.created_object_id;
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -54,7 +54,7 @@ function userobjectformView(Grocy, scope = null)
|
|||
Grocy.Api.Put('objects/userobjects/' + Grocy.EditObjectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
userfields.Save(function()
|
||||
{
|
||||
if (Grocy.GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
|
|
@ -75,7 +75,7 @@ function userobjectformView(Grocy, scope = null)
|
|||
}
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
userfields.Load();
|
||||
$scope("#userfields-form").removeClass("border").removeClass("border-info").removeClass("p-2").find("h2").addClass("d-none");
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user