mirror of
https://github.com/grocy/grocy.git
synced 2025-08-15 02:04:38 +00:00
Applied VSCode JS formatting settings
This commit is contained in:
@@ -41,7 +41,7 @@ UpdateUriParam = function(key, value)
|
||||
{
|
||||
var queryParameters = new URLSearchParams(location.search);
|
||||
queryParameters.set(key, value);
|
||||
window.history.replaceState({ }, "", decodeURIComponent(`${location.pathname}?${queryParameters}`));
|
||||
window.history.replaceState({}, "", decodeURIComponent(`${location.pathname}?${queryParameters}`));
|
||||
};
|
||||
|
||||
IsTouchInputDevice = function()
|
||||
@@ -78,12 +78,12 @@ GetFileExtension = function(pathOrFileName)
|
||||
}
|
||||
|
||||
$.extend($.expr[":"],
|
||||
{
|
||||
{
|
||||
"contains_case_insensitive": function(elem, i, match, array)
|
||||
{
|
||||
return (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
FindObjectInArrayByPropertyValue = function(array, propertyName, propertyValue)
|
||||
{
|
||||
@@ -123,7 +123,7 @@ function IsJsonString(text)
|
||||
try
|
||||
{
|
||||
JSON.parse(text);
|
||||
} catch(e)
|
||||
} catch (e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Api = { };
|
||||
Grocy.Api = {};
|
||||
Grocy.Api.Get = function(apiFunction, success, error)
|
||||
{
|
||||
var xhr = new XMLHttpRequest();
|
||||
@@ -18,7 +18,7 @@ Grocy.Api.Get = function(apiFunction, success, error)
|
||||
}
|
||||
else
|
||||
{
|
||||
success({ });
|
||||
success({});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ Grocy.Api.Post = function(apiFunction, jsonData, success, error)
|
||||
}
|
||||
else
|
||||
{
|
||||
success({ });
|
||||
success({});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ Grocy.Api.Put = function(apiFunction, jsonData, success, error)
|
||||
}
|
||||
else
|
||||
{
|
||||
success({ });
|
||||
success({});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ Grocy.Api.Delete = function(apiFunction, jsonData, success, error)
|
||||
}
|
||||
else
|
||||
{
|
||||
success({ });
|
||||
success({});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ Grocy.Api.UploadFile = function(file, group, fileName, success, error)
|
||||
}
|
||||
else
|
||||
{
|
||||
success({ });
|
||||
success({});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ Grocy.Api.DeleteFile = function(fileName, group, success, error)
|
||||
}
|
||||
else
|
||||
{
|
||||
success({ });
|
||||
success({});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,7 @@ if (!Grocy.ActiveNav.isEmpty())
|
||||
$(parentMenuSelector).collapse("show");
|
||||
$(parentMenuSelector).prev(".nav-link-collapse").addClass("active-page");
|
||||
|
||||
$(parentMenuSelector).on("shown.bs.collapse", function (e)
|
||||
$(parentMenuSelector).on("shown.bs.collapse", function(e)
|
||||
{
|
||||
if (!menuItem.isVisibleInViewport(75))
|
||||
{
|
||||
@@ -376,7 +376,7 @@ if (IsTouchInputDevice())
|
||||
document.body.appendChild(css);
|
||||
}
|
||||
|
||||
Grocy.FrontendHelpers = { };
|
||||
Grocy.FrontendHelpers = {};
|
||||
Grocy.FrontendHelpers.ValidateForm = function(formId)
|
||||
{
|
||||
var form = document.getElementById(formId);
|
||||
@@ -465,7 +465,7 @@ $(document).on("change", ".user-setting-control", function()
|
||||
|
||||
Grocy.UserSettings[settingKey] = value;
|
||||
|
||||
jsonData = { };
|
||||
jsonData = {};
|
||||
jsonData.value = value;
|
||||
Grocy.Api.Put('user/settings/' + settingKey, jsonData,
|
||||
function(result)
|
||||
@@ -523,7 +523,7 @@ $("iframe").on("load", function()
|
||||
|
||||
function WindowMessageBag(message, payload = null)
|
||||
{
|
||||
var obj = { };
|
||||
var obj = {};
|
||||
obj.Message = message;
|
||||
obj.Payload = payload;
|
||||
return obj;
|
||||
@@ -566,7 +566,7 @@ function RefreshLocaleNumberDisplay(rootSelector = "#page-content")
|
||||
$(this).text(parseFloat($(this).text()).toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 3 }));
|
||||
});
|
||||
|
||||
$(rootSelector + " .locale-number.locale-number-generic").each(function ()
|
||||
$(rootSelector + " .locale-number.locale-number-generic").each(function()
|
||||
{
|
||||
if (isNaN(parseFloat($(this).text())))
|
||||
{
|
||||
@@ -635,7 +635,7 @@ $(document).on("click", ".show-as-dialog-link", function(e)
|
||||
cancel: {
|
||||
label: __t('Cancel'),
|
||||
className: 'btn-secondary responsive-button',
|
||||
callback: function ()
|
||||
callback: function()
|
||||
{
|
||||
bootbox.hideAll();
|
||||
}
|
||||
@@ -648,11 +648,11 @@ $(document).on("click", ".show-as-dialog-link", function(e)
|
||||
$.extend(true, $.fn.dataTable.defaults, {
|
||||
'paginate': false,
|
||||
'deferRender': true,
|
||||
'language': IsJsonString(__t('datatables_localization')) ? JSON.parse(__t('datatables_localization')) : { },
|
||||
'language': IsJsonString(__t('datatables_localization')) ? JSON.parse(__t('datatables_localization')) : {},
|
||||
'scrollY': false,
|
||||
'colReorder': true,
|
||||
'stateSave': true,
|
||||
'stateSaveParams': function (settings, data)
|
||||
'stateSaveParams': function(settings, data)
|
||||
{
|
||||
data.search.search = "";
|
||||
|
||||
@@ -663,10 +663,10 @@ $.extend(true, $.fn.dataTable.defaults, {
|
||||
}
|
||||
});
|
||||
|
||||
$(Grocy.UserPermissions).each(function (index, item)
|
||||
$(Grocy.UserPermissions).each(function(index, item)
|
||||
{
|
||||
if(item.has_permission == 0)
|
||||
if (item.has_permission == 0)
|
||||
{
|
||||
$('.permission-'+item.permission_name).addClass('disabled').addClass('not-allowed');
|
||||
$('.permission-' + item.permission_name).addClass('disabled').addClass('not-allowed');
|
||||
}
|
||||
});
|
||||
|
@@ -1,4 +1,4 @@
|
||||
$("#show-clock-in-header").on("change", function ()
|
||||
$("#show-clock-in-header").on("change", function()
|
||||
{
|
||||
CheckHeaderClockEnabled();
|
||||
});
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.UISound = { };
|
||||
Grocy.UISound = {};
|
||||
|
||||
Grocy.UISound.Play = function(url)
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.WakeLock = { };
|
||||
Grocy.WakeLock = {};
|
||||
Grocy.WakeLock.NoSleepJsIntance = null;
|
||||
Grocy.WakeLock.InitDone = false;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Grocy.BarCodeScannerTestingHitCount = 0;
|
||||
Grocy.BarCodeScannerTestingMissCount = 0;
|
||||
|
||||
$("#scanned_barcode").on("blur", function (e)
|
||||
$("#scanned_barcode").on("blur", function(e)
|
||||
{
|
||||
OnBarcodeScanned($("#scanned_barcode").val());
|
||||
});
|
||||
@@ -41,7 +41,7 @@ setTimeout(function()
|
||||
if (GetUriParam("barcode") !== undefined)
|
||||
{
|
||||
$("#expected_barcode").val(GetUriParam("barcode"));
|
||||
setTimeout(function ()
|
||||
setTimeout(function()
|
||||
{
|
||||
$("#expected_barcode").keyup();
|
||||
$("#scanned_barcode").focus();
|
||||
|
@@ -19,7 +19,7 @@ $("#search").on("keyup", Delay(function()
|
||||
batteriesTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.battery-delete-button', function (e)
|
||||
$(document).on('click', '.battery-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-battery-name');
|
||||
var objectId = $(e.currentTarget).attr('data-battery-id');
|
||||
@@ -41,7 +41,7 @@ $(document).on('click', '.battery-delete-button', function (e)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
Grocy.Api.Delete('objects/batteries/' + objectId, { },
|
||||
Grocy.Api.Delete('objects/batteries/' + objectId, {},
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/batteries');
|
||||
|
@@ -45,7 +45,7 @@ $(document).on('click', '.undo-battery-execution-button', function(e)
|
||||
var element = $(e.currentTarget);
|
||||
var chargeCycleId = $(e.currentTarget).attr('data-charge-cycle-id');
|
||||
|
||||
Grocy.Api.Post('batteries/charge-cycles/' + chargeCycleId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('batteries/charge-cycles/' + chargeCycleId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
element.closest("tr").addClass("text-muted");
|
||||
|
@@ -122,7 +122,8 @@ function RefreshStatistics()
|
||||
var overdueCount = 0;
|
||||
var now = moment();
|
||||
var nextXDaysThreshold = moment().add(nextXDays, "days");
|
||||
result.forEach(element => {
|
||||
result.forEach(element =>
|
||||
{
|
||||
var date = moment(element.next_estimated_charge_time);
|
||||
if (date.isBefore(now))
|
||||
{
|
||||
|
@@ -6,7 +6,7 @@
|
||||
Grocy.FrontendHelpers.BeginUiBusy("batterytracking-form");
|
||||
|
||||
Grocy.Api.Get('batteries/' + jsonForm.battery_id,
|
||||
function (batteryDetails)
|
||||
function(batteryDetails)
|
||||
{
|
||||
Grocy.Api.Post('batteries/' + jsonForm.battery_id + '/charge', { 'tracked_time': $('#tracked_time').find('input').val() },
|
||||
function(result)
|
||||
@@ -64,7 +64,7 @@ $('#battery_id_text_input').trigger('change');
|
||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||
|
||||
$('#batterytracking-form input').keyup(function (event)
|
||||
$('#batterytracking-form input').keyup(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||
});
|
||||
@@ -86,14 +86,14 @@ $('#batterytracking-form input').keydown(function(event)
|
||||
}
|
||||
});
|
||||
|
||||
$('#tracked_time').find('input').on('keypress', function (e)
|
||||
$('#tracked_time').find('input').on('keypress', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||
});
|
||||
|
||||
function UndoChargeCycle(chargeCycleId)
|
||||
{
|
||||
Grocy.Api.Post('batteries/charge-cycles/' + chargeCycleId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('batteries/charge-cycles/' + chargeCycleId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Charge cycle successfully undone"));
|
||||
|
@@ -17,7 +17,8 @@ var calendar = $("#calendar").fullCalendar({
|
||||
"eventLimit": false,
|
||||
"height": "auto",
|
||||
"eventSources": fullcalendarEventSources,
|
||||
eventClick: function(info) {
|
||||
eventClick: function(info)
|
||||
{
|
||||
location.href = info.link;
|
||||
}
|
||||
});
|
||||
|
@@ -19,11 +19,11 @@
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
{
|
||||
Grocy.Api.Post('chores/executions/calculate-next-assignments', { "chore_id": Grocy.EditObjectId },
|
||||
function (result)
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/chores');
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy();
|
||||
console.error(xhr);
|
||||
@@ -46,11 +46,11 @@
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
{
|
||||
Grocy.Api.Post('chores/executions/calculate-next-assignments', { "chore_id": Grocy.EditObjectId },
|
||||
function (result)
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/chores');
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy();
|
||||
console.error(xhr);
|
||||
@@ -145,7 +145,7 @@ $('.input-group-chore-period-type').on('change', function(e)
|
||||
else if (periodType === 'weekly')
|
||||
{
|
||||
$('#chore-period-type-info').text(__t('This means the next execution of this chore is scheduled 1 day after the last execution, but only for the weekdays selected below'));
|
||||
$("#period_config").val($(".period-type-weekly input:checkbox:checked").map(function () { return this.value; }).get().join(","));
|
||||
$("#period_config").val($(".period-type-weekly input:checkbox:checked").map(function() { return this.value; }).get().join(","));
|
||||
$('#chore-period-interval-info').text(__t('This means the next execution of this chore should only be scheduled every %s weeks', periodInterval.toString()));
|
||||
}
|
||||
else if (periodType === 'monthly')
|
||||
|
@@ -19,7 +19,7 @@ $("#search").on("keyup", Delay(function()
|
||||
choresTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.chore-delete-button', function (e)
|
||||
$(document).on('click', '.chore-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-chore-name');
|
||||
var objectId = $(e.currentTarget).attr('data-chore-id');
|
||||
|
@@ -45,7 +45,7 @@ $(document).on('click', '.undo-chore-execution-button', function(e)
|
||||
var element = $(e.currentTarget);
|
||||
var executionId = $(e.currentTarget).attr('data-execution-id');
|
||||
|
||||
Grocy.Api.Post('chores/executions/' + executionId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('chores/executions/' + executionId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
element.closest("tr").addClass("text-muted");
|
||||
|
@@ -182,7 +182,8 @@ function RefreshStatistics()
|
||||
var assignedToMeCount = 0;
|
||||
var now = moment();
|
||||
var nextXDaysThreshold = moment().add(nextXDays, "days");
|
||||
result.forEach(element => {
|
||||
result.forEach(element =>
|
||||
{
|
||||
var date = moment(element.next_estimated_execution_time);
|
||||
if (date.isBefore(now))
|
||||
{
|
||||
|
@@ -6,7 +6,7 @@
|
||||
Grocy.FrontendHelpers.BeginUiBusy("choretracking-form");
|
||||
|
||||
Grocy.Api.Get('chores/' + jsonForm.chore_id,
|
||||
function (choreDetails)
|
||||
function(choreDetails)
|
||||
{
|
||||
Grocy.Api.Post('chores/' + jsonForm.chore_id + '/execute', { 'tracked_time': Grocy.Components.DateTimePicker.GetValue(), 'done_by': $("#user_id").val() },
|
||||
function(result)
|
||||
@@ -110,7 +110,7 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||
|
||||
function UndoChoreExecution(executionId)
|
||||
{
|
||||
Grocy.Api.Post('chores/executions/' + executionId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('chores/executions/' + executionId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Chore execution successfully undone"));
|
||||
|
@@ -1,18 +1,20 @@
|
||||
Grocy.Components.BarcodeScanner = { };
|
||||
Grocy.Components.BarcodeScanner = {};
|
||||
|
||||
Grocy.Components.BarcodeScanner.LiveVideoSizeAdjusted = false;
|
||||
Grocy.Components.BarcodeScanner.CheckCapabilities = async function()
|
||||
{
|
||||
var track = Quagga.CameraAccess.getActiveTrack();
|
||||
var capabilities = {};
|
||||
if (typeof track.getCapabilities === 'function') {
|
||||
if (typeof track.getCapabilities === 'function')
|
||||
{
|
||||
capabilities = track.getCapabilities();
|
||||
}
|
||||
|
||||
// If there is more than 1 camera, show the camera selection
|
||||
var cameras = await Quagga.CameraAccess.enumerateVideoDevices();
|
||||
var cameraSelect = document.querySelector('.cameraSelect-wrapper');
|
||||
if (cameraSelect) {
|
||||
if (cameraSelect)
|
||||
{
|
||||
cameraSelect.style.display = cameras.length > 1 ? 'inline-block' : 'none';
|
||||
}
|
||||
|
||||
@@ -20,11 +22,13 @@ Grocy.Components.BarcodeScanner.CheckCapabilities = async function()
|
||||
var canTorch = typeof capabilities.torch === 'boolean' && capabilities.torch
|
||||
// Remove the torch button, if either the device can not torch or AutoTorchOn is set.
|
||||
var node = document.querySelector('.torch');
|
||||
if (node) {
|
||||
if (node)
|
||||
{
|
||||
node.style.display = canTorch && !Grocy.FeatureFlags.GROCY_FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA ? 'inline-block' : 'none';
|
||||
}
|
||||
// If AutoTorchOn is set, turn on the torch.
|
||||
if (canTorch && Grocy.FeatureFlags.GROCY_FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA) {
|
||||
if (canTorch && Grocy.FeatureFlags.GROCY_FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA)
|
||||
{
|
||||
Grocy.Components.BarcodeScanner.TorchOn(track);
|
||||
}
|
||||
|
||||
@@ -65,7 +69,7 @@ Grocy.Components.BarcodeScanner.StartScanning = function()
|
||||
target: document.querySelector("#barcodescanner-livestream"),
|
||||
constraints: {
|
||||
facingMode: "environment",
|
||||
...(window.localStorage.getItem('cameraId') && {deviceId : window.localStorage.getItem('cameraId')}) // If preferred cameraId is set, request to use that specific camera
|
||||
...(window.localStorage.getItem('cameraId') && { deviceId: window.localStorage.getItem('cameraId') }) // If preferred cameraId is set, request to use that specific camera
|
||||
}
|
||||
},
|
||||
locator: {
|
||||
@@ -142,7 +146,8 @@ Grocy.Components.BarcodeScanner.StopScanning = function()
|
||||
|
||||
Grocy.Components.BarcodeScanner.TorchOn = function(track)
|
||||
{
|
||||
if (track) {
|
||||
if (track)
|
||||
{
|
||||
track.applyConstraints({
|
||||
advanced: [
|
||||
{
|
||||
@@ -251,7 +256,8 @@ $(document).on("click", "#barcodescanner-start-button", async function(e)
|
||||
var cameraSelect = document.querySelector('.cameraSelect');
|
||||
|
||||
var cameras = await Quagga.CameraAccess.enumerateVideoDevices();
|
||||
cameras.forEach(camera => {
|
||||
cameras.forEach(camera =>
|
||||
{
|
||||
var option = document.createElement("option");
|
||||
option.text = camera.label ? camera.label : camera.deviceId; // Use camera label if it exists, else show device id
|
||||
option.value = camera.deviceId;
|
||||
@@ -261,7 +267,8 @@ $(document).on("click", "#barcodescanner-start-button", async function(e)
|
||||
// Set initial value to preferred camera if one exists - and if not, start out empty
|
||||
cameraSelect.value = window.localStorage.getItem('cameraId');
|
||||
|
||||
cameraSelect.onchange = function(){
|
||||
cameraSelect.onchange = function()
|
||||
{
|
||||
window.localStorage.setItem('cameraId', cameraSelect.value);
|
||||
Quagga.stop();
|
||||
Grocy.Components.BarcodeScanner.StartScanning();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.BatteryCard = { };
|
||||
Grocy.Components.BatteryCard = {};
|
||||
|
||||
Grocy.Components.BatteryCard.Refresh = function(batteryId)
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
$('#calendar').datetimepicker(
|
||||
{
|
||||
{
|
||||
format: 'L',
|
||||
buttons: {
|
||||
showToday: true,
|
||||
@@ -35,6 +35,6 @@ $('#calendar').datetimepicker(
|
||||
t: function(widget) { },
|
||||
'delete': function(widget) { }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#calendar').datetimepicker('show');
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.ChoreCard = { };
|
||||
Grocy.Components.ChoreCard = {};
|
||||
|
||||
Grocy.Components.ChoreCard.Refresh = function(choreId)
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.DateTimePicker = { };
|
||||
Grocy.Components.DateTimePicker = {};
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement = function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.DateTimePicker2 = { };
|
||||
Grocy.Components.DateTimePicker2 = {};
|
||||
|
||||
Grocy.Components.DateTimePicker2.GetInputElement = function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.LocationPicker = { };
|
||||
Grocy.Components.LocationPicker = {};
|
||||
|
||||
Grocy.Components.LocationPicker.GetPicker = function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
$(".numberpicker-down-button").unbind('click').on("click", function ()
|
||||
$(".numberpicker-down-button").unbind('click').on("click", function()
|
||||
{
|
||||
var inputElement = $(this).parent().parent().find('input[type="number"]')[0];
|
||||
inputElement.stepDown();
|
||||
|
@@ -83,7 +83,7 @@ $(".input-group-productamountpicker").on("change", function()
|
||||
$("#qu-conversion-info").text(__t("This equals %1$s %2$s in stock", destinationAmount.toLocaleString(), destinationQuName));
|
||||
}
|
||||
|
||||
$("#amount").val(destinationAmount.toFixed(4).replace(/0*$/g,''));
|
||||
$("#amount").val(destinationAmount.toFixed(4).replace(/0*$/g, ''));
|
||||
});
|
||||
|
||||
$("#display_amount").on("keyup", function()
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.ProductCard = { };
|
||||
Grocy.Components.ProductCard = {};
|
||||
|
||||
Grocy.Components.ProductCard.Refresh = function(productId)
|
||||
{
|
||||
@@ -157,14 +157,16 @@ Grocy.Components.ProductCard.Refresh = function(productId)
|
||||
key = dataPoint.shopping_location.name
|
||||
}
|
||||
|
||||
if (!datasets[key]) {
|
||||
if (!datasets[key])
|
||||
{
|
||||
datasets[key] = []
|
||||
}
|
||||
chart.labels.push(moment(dataPoint.date).toDate());
|
||||
datasets[key].push(dataPoint.price);
|
||||
|
||||
});
|
||||
Object.keys(datasets).forEach((key) => {
|
||||
Object.keys(datasets).forEach((key) =>
|
||||
{
|
||||
chart.datasets.push({
|
||||
data: datasets[key],
|
||||
fill: false,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.ProductPicker = { };
|
||||
Grocy.Components.ProductPicker = {};
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker = function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.RecipePicker = { };
|
||||
Grocy.Components.RecipePicker = {};
|
||||
|
||||
Grocy.Components.RecipePicker.GetPicker = function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.ShoppingLocationPicker = { };
|
||||
Grocy.Components.ShoppingLocationPicker = {};
|
||||
|
||||
Grocy.Components.ShoppingLocationPicker.GetPicker = function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.UserfieldsForm = { };
|
||||
Grocy.Components.UserfieldsForm = {};
|
||||
|
||||
Grocy.Components.UserfieldsForm.Save = function(success, error)
|
||||
{
|
||||
@@ -12,7 +12,7 @@ Grocy.Components.UserfieldsForm.Save = function(success, error)
|
||||
return;
|
||||
}
|
||||
|
||||
var jsonData = { };
|
||||
var jsonData = {};
|
||||
|
||||
$("#userfields-form .userfield-input").not("div").each(function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.UserPicker = { };
|
||||
Grocy.Components.UserPicker = {};
|
||||
|
||||
Grocy.Components.UserPicker.GetPicker = function()
|
||||
{
|
||||
|
@@ -54,7 +54,7 @@
|
||||
{
|
||||
$("#flow-info-addbarcodetoselection").addClass("d-none");
|
||||
$('#barcode-lookup-disabled-hint').addClass('d-none');
|
||||
window.history.replaceState({ }, document.title, U("/consume"));
|
||||
window.history.replaceState({}, document.title, U("/consume"));
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ $('#save-mark-as-open-button').on('click', function(e)
|
||||
|
||||
var apiUrl = 'stock/products/' + jsonForm.product_id + '/open';
|
||||
|
||||
jsonData = { };
|
||||
jsonData = {};
|
||||
jsonData.amount = jsonForm.amount;
|
||||
|
||||
if ($("#use_specific_stock_entry").is(":checked"))
|
||||
@@ -260,7 +260,7 @@ $("#location_id").on('change', function(e)
|
||||
}
|
||||
}
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
@@ -503,7 +503,7 @@ $("#use_specific_stock_entry").on("change", function()
|
||||
|
||||
function UndoStockBooking(bookingId)
|
||||
{
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Booking successfully undone"));
|
||||
@@ -517,12 +517,12 @@ function UndoStockBooking(bookingId)
|
||||
|
||||
function UndoStockTransaction(transactionId)
|
||||
{
|
||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', { },
|
||||
function (result)
|
||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Transaction successfully undone"));
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
|
@@ -66,7 +66,7 @@ $("#search").on("keyup", Delay(function()
|
||||
equipmentTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.equipment-delete-button', function (e)
|
||||
$(document).on('click', '.equipment-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-equipment-name');
|
||||
var objectId = $(e.currentTarget).attr('data-equipment-id');
|
||||
|
@@ -27,11 +27,11 @@
|
||||
if (jsonData.hasOwnProperty("instruction_manual_file_name") && !Grocy.DeleteInstructionManualOnSave)
|
||||
{
|
||||
Grocy.Api.UploadFile($("#instruction-manual")[0].files[0], 'equipmentmanuals', jsonData.instruction_manual_file_name,
|
||||
function (result)
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/equipment');
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("equipment-form");
|
||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||
@@ -125,7 +125,7 @@ $('#equipment-form input').keydown(function(event)
|
||||
});
|
||||
|
||||
Grocy.DeleteInstructionManualOnSave = false;
|
||||
$('#delete-current-instruction-manual-button').on('click', function (e)
|
||||
$('#delete-current-instruction-manual-button').on('click', function(e)
|
||||
{
|
||||
Grocy.DeleteInstructionManualOnSave = true;
|
||||
$("#current-equipment-instruction-manual").addClass("d-none");
|
||||
|
@@ -14,10 +14,11 @@
|
||||
price = parseFloat(jsonForm.price).toFixed(2);
|
||||
}
|
||||
|
||||
var jsonData = { };
|
||||
var jsonData = {};
|
||||
jsonData.new_amount = jsonForm.new_amount;
|
||||
jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue();
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
jsonData.shopping_location_id = Grocy.Components.ShoppingLocationPicker.GetValue();
|
||||
}
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
@@ -48,7 +49,7 @@
|
||||
{
|
||||
$("#flow-info-addbarcodetoselection").addClass("d-none");
|
||||
$('#barcode-lookup-disabled-hint').addClass('d-none');
|
||||
window.history.replaceState({ }, document.title, U("/inventory"));
|
||||
window.history.replaceState({}, document.title, U("/inventory"));
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
@@ -84,7 +85,8 @@
|
||||
$('#price').val('');
|
||||
Grocy.Components.DateTimePicker.Clear();
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetValue('');
|
||||
}
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
@@ -153,7 +155,8 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
}
|
||||
|
||||
$('#price').val(parseFloat(productDetails.last_price).toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: 2 }));
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetId(productDetails.last_shopping_location_id);
|
||||
}
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
@@ -197,7 +200,7 @@ $('#new_amount').on('focus', function(e)
|
||||
}
|
||||
});
|
||||
|
||||
$('#inventory-form input').keyup(function (event)
|
||||
$('#inventory-form input').keyup(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||
});
|
||||
@@ -295,7 +298,7 @@ $('#new_amount').on('keyup', function(e)
|
||||
|
||||
function UndoStockBooking(bookingId)
|
||||
{
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Booking successfully undone"));
|
||||
@@ -309,12 +312,12 @@ function UndoStockBooking(bookingId)
|
||||
|
||||
function UndoStockTransaction(transactionId)
|
||||
{
|
||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', { },
|
||||
function (result)
|
||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Transaction successfully undone"));
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
|
@@ -42,12 +42,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#location-form input').keyup(function (event)
|
||||
$('#location-form input').keyup(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('location-form');
|
||||
});
|
||||
|
||||
$('#location-form input').keydown(function (event)
|
||||
$('#location-form input').keydown(function(event)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
{
|
||||
|
@@ -19,7 +19,7 @@ $("#search").on("keyup", Delay(function()
|
||||
locationsTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.location-delete-button', function (e)
|
||||
$(document).on('click', '.location-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-location-name');
|
||||
var objectId = $(e.currentTarget).attr('data-location-id');
|
||||
|
@@ -25,7 +25,7 @@ $("#search").on("keyup", Delay(function()
|
||||
apiKeysTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.apikey-delete-button', function (e)
|
||||
$(document).on('click', '.apikey-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-apikey-apikey');
|
||||
var objectId = $(e.currentTarget).attr('data-apikey-id');
|
||||
|
@@ -318,7 +318,7 @@ $(document).on("click", ".add-product-button", function(e)
|
||||
Grocy.IsMealPlanEntryEditAction = false;
|
||||
});
|
||||
|
||||
$(document).on("click", ".edit-meal-plan-entry-button", function (e)
|
||||
$(document).on("click", ".edit-meal-plan-entry-button", function(e)
|
||||
{
|
||||
var mealPlanEntry = JSON.parse($(this).parents(".fc-h-event:first").attr("data-meal-plan-entry"));
|
||||
|
||||
@@ -357,12 +357,12 @@ $("#add-recipe-modal").on("shown.bs.modal", function(e)
|
||||
Grocy.Components.RecipePicker.GetInputElement().focus();
|
||||
})
|
||||
|
||||
$("#add-note-modal").on("shown.bs.modal", function (e)
|
||||
$("#add-note-modal").on("shown.bs.modal", function(e)
|
||||
{
|
||||
$("#note").focus();
|
||||
})
|
||||
|
||||
$("#add-product-modal").on("shown.bs.modal", function (e)
|
||||
$("#add-product-modal").on("shown.bs.modal", function(e)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
})
|
||||
@@ -371,7 +371,7 @@ $(document).on("click", ".remove-recipe-button, .remove-note-button, .remove-pro
|
||||
{
|
||||
var mealPlanEntry = JSON.parse($(this).parents(".fc-h-event:first").attr("data-meal-plan-entry"));
|
||||
|
||||
Grocy.Api.Delete('objects/meal_plan/' + mealPlanEntry.id.toString(), { },
|
||||
Grocy.Api.Delete('objects/meal_plan/' + mealPlanEntry.id.toString(), {},
|
||||
function(result)
|
||||
{
|
||||
window.location.reload();
|
||||
@@ -481,11 +481,11 @@ $('#save-add-product-button').on('click', function(e)
|
||||
if (Grocy.IsMealPlanEntryEditAction)
|
||||
{
|
||||
Grocy.Api.Put('objects/meal_plan/' + Grocy.MealPlanEntryEditObjectId.toString(), jsonData,
|
||||
function (result)
|
||||
function(result)
|
||||
{
|
||||
window.location.reload();
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||
}
|
||||
@@ -506,7 +506,7 @@ $('#save-add-product-button').on('click', function(e)
|
||||
}
|
||||
});
|
||||
|
||||
$('#add-recipe-form input').keydown(function (event)
|
||||
$('#add-recipe-form input').keydown(function(event)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
{
|
||||
@@ -523,7 +523,7 @@ $('#add-recipe-form input').keydown(function (event)
|
||||
}
|
||||
});
|
||||
|
||||
$('#add-product-form input').keydown(function (event)
|
||||
$('#add-product-form input').keydown(function(event)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
{
|
||||
@@ -588,10 +588,10 @@ $(document).on('click', '.recipe-order-missing-button', function(e)
|
||||
Grocy.FrontendHelpers.BeginUiBusy();
|
||||
|
||||
// Set the recipes desired_servings so that the "recipes resolved"-views resolve correctly based on the meal plan entry servings
|
||||
Grocy.Api.Put('objects/recipes/' + objectId, { "desired_servings" : servings},
|
||||
Grocy.Api.Put('objects/recipes/' + objectId, { "desired_servings": servings },
|
||||
function(result)
|
||||
{
|
||||
Grocy.Api.Post('recipes/' + objectId + '/add-not-fulfilled-products-to-shoppinglist', { },
|
||||
Grocy.Api.Post('recipes/' + objectId + '/add-not-fulfilled-products-to-shoppinglist', {},
|
||||
function(result)
|
||||
{
|
||||
if (button.attr("data-recipe-type") == "normal")
|
||||
@@ -638,7 +638,7 @@ $(document).on('click', '.product-consume-button', function(e)
|
||||
function(bookingResponse)
|
||||
{
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function (result)
|
||||
function(result)
|
||||
{
|
||||
var toastMessage = __t('Removed %1$s of %2$s from stock', consumeAmount.toString() + " " + __n(consumeAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural), result.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + bookingResponse.transaction_id + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||
|
||||
@@ -741,7 +741,7 @@ $(document).on("click", ".recipe-popup-button", function(e)
|
||||
cancel: {
|
||||
label: __t('Close'),
|
||||
className: 'btn-secondary responsive-button',
|
||||
callback: function ()
|
||||
callback: function()
|
||||
{
|
||||
bootbox.hideAll();
|
||||
}
|
||||
@@ -797,12 +797,12 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
function UndoStockTransaction(transactionId)
|
||||
{
|
||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', { },
|
||||
function (result)
|
||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Transaction successfully undone"));
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
{
|
||||
return {
|
||||
components: {
|
||||
Topbar: function () { return null }
|
||||
Topbar: function() { return null }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -82,7 +82,7 @@
|
||||
window.location.href = redirectDestination.replace("editobjectid", Grocy.EditObjectId);;
|
||||
}
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("product-form");
|
||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||
@@ -106,7 +106,7 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("product-form");
|
||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||
@@ -343,7 +343,7 @@ $("#allow_partial_units_in_stock").on("click", function()
|
||||
});
|
||||
|
||||
Grocy.DeleteProductPictureOnSave = false;
|
||||
$('#delete-current-product-picture-button').on('click', function (e)
|
||||
$('#delete-current-product-picture-button').on('click', function(e)
|
||||
{
|
||||
Grocy.DeleteProductPictureOnSave = true;
|
||||
$("#current-product-picture").addClass("d-none");
|
||||
@@ -426,7 +426,7 @@ $(document).on('click', '.qu-conversion-delete-button', function(e)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
Grocy.Api.Delete('objects/quantity_unit_conversions/' + objectId, { },
|
||||
Grocy.Api.Delete('objects/quantity_unit_conversions/' + objectId, {},
|
||||
function(result)
|
||||
{
|
||||
Grocy.ProductEditFormRedirectUri = "reload";
|
||||
@@ -466,7 +466,7 @@ $(document).on('click', '.barcode-delete-button', function(e)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
Grocy.Api.Delete('objects/product_barcodes/' + objectId, { },
|
||||
Grocy.Api.Delete('objects/product_barcodes/' + objectId, {},
|
||||
function(result)
|
||||
{
|
||||
Grocy.ProductEditFormRedirectUri = "reload";
|
||||
@@ -487,7 +487,8 @@ $('#qu_id_purchase').blur(function(e)
|
||||
// Preset the stock quantity unit with the purchase quantity unit, if the stock quantity unit is unset.
|
||||
var QuIdStock = $('#qu_id_stock');
|
||||
var QuIdPurchase = $('#qu_id_purchase');
|
||||
if (QuIdStock[0].selectedIndex === 0 && QuIdPurchase[0].selectedIndex !== 0) {
|
||||
if (QuIdStock[0].selectedIndex === 0 && QuIdPurchase[0].selectedIndex !== 0)
|
||||
{
|
||||
QuIdStock[0].selectedIndex = QuIdPurchase[0].selectedIndex;
|
||||
Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||
}
|
||||
|
@@ -42,12 +42,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#product-group-form input').keyup(function (event)
|
||||
$('#product-group-form input').keyup(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('product-group-form');
|
||||
});
|
||||
|
||||
$('#product-group-form input').keydown(function (event)
|
||||
$('#product-group-form input').keydown(function(event)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
{
|
||||
|
@@ -36,7 +36,7 @@ if (typeof GetUriParam("product-group") !== "undefined")
|
||||
$("#product-group-filter").trigger("change");
|
||||
}
|
||||
|
||||
$(document).on('click', '.product-delete-button', function (e)
|
||||
$(document).on('click', '.product-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-product-name');
|
||||
var objectId = $(e.currentTarget).attr('data-product-id');
|
||||
@@ -61,18 +61,18 @@ $(document).on('click', '.product-delete-button', function (e)
|
||||
className: 'btn-danger'
|
||||
}
|
||||
},
|
||||
callback: function (result)
|
||||
callback: function(result)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
jsonData = {};
|
||||
jsonData.active = 0;
|
||||
Grocy.Api.Put('objects/products/' + objectId, jsonData,
|
||||
function (result)
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/products');
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
|
@@ -30,7 +30,8 @@
|
||||
var jsonData = {};
|
||||
jsonData.amount = amount;
|
||||
jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue();
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
jsonData.shopping_location_id = Grocy.Components.ShoppingLocationPicker.GetValue();
|
||||
}
|
||||
jsonData.price = price;
|
||||
@@ -62,7 +63,7 @@
|
||||
{
|
||||
$("#flow-info-addbarcodetoselection").addClass("d-none");
|
||||
$('#barcode-lookup-disabled-hint').addClass('d-none');
|
||||
window.history.replaceState({ }, document.title, U("/purchase"));
|
||||
window.history.replaceState({}, document.title, U("/purchase"));
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
@@ -100,7 +101,8 @@
|
||||
}
|
||||
Grocy.Components.DateTimePicker.Clear();
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetValue('');
|
||||
}
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
@@ -192,7 +194,8 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
}
|
||||
}
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
if (barcode_shopping_location_id != null)
|
||||
{
|
||||
Grocy.Components.ShoppingLocationPicker.SetId(barcode_shopping_location_id);
|
||||
@@ -447,7 +450,7 @@ function refreshPriceHint()
|
||||
|
||||
function UndoStockBooking(bookingId)
|
||||
{
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Booking successfully undone"));
|
||||
@@ -457,7 +460,7 @@ function UndoStockBooking(bookingId)
|
||||
{
|
||||
window.postMessage(WindowMessageBag("ProductChanged", result.product_id), Grocy.BaseUrl);
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
@@ -472,7 +475,7 @@ function UndoStockBooking(bookingId)
|
||||
|
||||
function UndoStockTransaction(transactionId)
|
||||
{
|
||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Transaction successfully undone"));
|
||||
@@ -482,7 +485,7 @@ function UndoStockTransaction(transactionId)
|
||||
{
|
||||
window.postMessage(WindowMessageBag("ProductChanged", result[0].product_id), Grocy.BaseUrl);
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
|
@@ -149,7 +149,7 @@ $(document).on('click', '.qu-conversion-delete-button', function(e)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
Grocy.Api.Delete('objects/quantity_unit_conversions/' + objectId, { },
|
||||
Grocy.Api.Delete('objects/quantity_unit_conversions/' + objectId, {},
|
||||
function(result)
|
||||
{
|
||||
Grocy.QuantityUnitEditFormRedirectUri = "reload";
|
||||
@@ -165,7 +165,7 @@ $(document).on('click', '.qu-conversion-delete-button', function(e)
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.qu-conversion-edit-button', function (e)
|
||||
$(document).on('click', '.qu-conversion-edit-button', function(e)
|
||||
{
|
||||
var id = $(e.currentTarget).attr('data-qu-conversion-id');
|
||||
Grocy.QuantityUnitEditFormRedirectUri = U("/quantityunitconversion/" + id.toString() + "?qu-unit=editobjectid");
|
||||
|
@@ -19,7 +19,7 @@ $("#search").on("keyup", Delay(function()
|
||||
quantityUnitsTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.quantityunit-delete-button', function (e)
|
||||
$(document).on('click', '.quantityunit-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-quantityunit-name');
|
||||
var objectId = $(e.currentTarget).attr('data-quantityunit-id');
|
||||
|
@@ -39,7 +39,8 @@ $('.save-recipe').on('click', function(e)
|
||||
|
||||
const location = $(e.currentTarget).attr('data-location') == 'return' ? '/recipes?recipe=' : '/recipe/';
|
||||
|
||||
if(Grocy.EditMode == 'create') {
|
||||
if (Grocy.EditMode == 'create')
|
||||
{
|
||||
console.log(jsonData);
|
||||
Grocy.Api.Post('objects/recipes', jsonData,
|
||||
(result) => saveRecipePicture(result, location));
|
||||
@@ -51,11 +52,11 @@ $('.save-recipe').on('click', function(e)
|
||||
jsonData.picture_file_name = null;
|
||||
|
||||
Grocy.Api.DeleteFile(Grocy.RecipePictureFileName, 'recipepictures', {},
|
||||
function (result)
|
||||
function(result)
|
||||
{
|
||||
// Nothing to do
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("recipe-form");
|
||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||
@@ -106,7 +107,7 @@ $('#recipe-form input').keyup(function(event)
|
||||
Grocy.FrontendHelpers.ValidateForm('recipe-form');
|
||||
});
|
||||
|
||||
$('#recipe-form input').keydown(function (event)
|
||||
$('#recipe-form input').keydown(function(event)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
{
|
||||
@@ -229,7 +230,7 @@ $(document).on('click', '.recipe-pos-edit-button', function(e)
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.recipe-include-edit-button', function (e)
|
||||
$(document).on('click', '.recipe-include-edit-button', function(e)
|
||||
{
|
||||
var id = $(e.currentTarget).attr('data-recipe-include-id');
|
||||
var recipeId = $(e.currentTarget).attr('data-recipe-included-recipe-id');
|
||||
@@ -338,7 +339,8 @@ $('#save-recipe-include-button').on('click', function(e)
|
||||
}
|
||||
});
|
||||
|
||||
$("#recipe-picture").on("change", function (e) {
|
||||
$("#recipe-picture").on("change", function(e)
|
||||
{
|
||||
$("#recipe-picture-label").removeClass("d-none");
|
||||
$("#recipe-picture-label-none").addClass("d-none");
|
||||
$("#delete-current-recipe-picture-on-save-hint").addClass("d-none");
|
||||
@@ -347,7 +349,8 @@ $("#recipe-picture").on("change", function (e) {
|
||||
});
|
||||
|
||||
Grocy.DeleteRecipePictureOnSave = false;
|
||||
$("#delete-current-recipe-picture-button").on("click", function (e) {
|
||||
$("#delete-current-recipe-picture-button").on("click", function(e)
|
||||
{
|
||||
Grocy.DeleteRecipePictureOnSave = true;
|
||||
$("#current-recipe-picture").addClass("d-none");
|
||||
$("#delete-current-recipe-picture-on-save-hint").removeClass("d-none");
|
||||
|
@@ -1,6 +1,6 @@
|
||||
Grocy.RecipePosFormProductChangeCount = 0;
|
||||
|
||||
$('#save-recipe-pos-button').on('click', function (e)
|
||||
$('#save-recipe-pos-button').on('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
|
@@ -42,7 +42,7 @@ if (typeof recipe !== "undefined")
|
||||
if (GetUriParam("search") !== undefined)
|
||||
{
|
||||
$("#search").val(GetUriParam("search"));
|
||||
setTimeout(function ()
|
||||
setTimeout(function()
|
||||
{
|
||||
$("#search").keyup();
|
||||
}, 50);
|
||||
@@ -61,7 +61,7 @@ $("#search").on("keyup", Delay(function()
|
||||
recipesTables.search(value).draw();
|
||||
|
||||
$(".recipe-gallery-item").removeClass("d-none");
|
||||
console.log( $(".recipe-gallery-item .card-title:not(:contains_case_insensitive(" + value + "))"));
|
||||
console.log($(".recipe-gallery-item .card-title:not(:contains_case_insensitive(" + value + "))"));
|
||||
|
||||
$(".recipe-gallery-item .card-title:not(:contains_case_insensitive(" + value + "))").parent().parent().parent().addClass("d-none");
|
||||
}, 200));
|
||||
@@ -186,7 +186,7 @@ $(".recipe-consume").on('click', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.BeginUiBusy();
|
||||
|
||||
Grocy.Api.Post('recipes/' + objectId + '/consume', { },
|
||||
Grocy.Api.Post('recipes/' + objectId + '/consume', {},
|
||||
function(result)
|
||||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy();
|
||||
@@ -258,7 +258,7 @@ $(".recipe-print").on('click', function(e)
|
||||
|
||||
$('#servings-scale').keyup(function(event)
|
||||
{
|
||||
var data = { };
|
||||
var data = {};
|
||||
data.desired_servings = $(this).val();
|
||||
|
||||
Grocy.Api.Put('objects/recipes/' + $(this).data("recipe-id"), data,
|
||||
|
@@ -93,16 +93,16 @@ $("#delete-selected-shopping-list").on("click", function()
|
||||
className: 'btn-danger'
|
||||
}
|
||||
},
|
||||
callback: function (result)
|
||||
callback: function(result)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
Grocy.Api.Delete('objects/shopping_lists/' + objectId, {},
|
||||
function (result)
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/shoppinglist');
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ $(document).on('click', '.shoppinglist-delete-button', function(e)
|
||||
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
|
||||
Grocy.FrontendHelpers.BeginUiBusy();
|
||||
|
||||
Grocy.Api.Delete('objects/shopping_list/' + shoppingListItemId, { },
|
||||
Grocy.Api.Delete('objects/shopping_list/' + shoppingListItemId, {},
|
||||
function(result)
|
||||
{
|
||||
animateCSS("#shoppinglistitem-" + shoppingListItemId + "-row", "fadeOut", function()
|
||||
|
@@ -40,7 +40,7 @@ $('#shopping-list-form input').keyup(function(event)
|
||||
Grocy.FrontendHelpers.ValidateForm('shopping-list-form');
|
||||
});
|
||||
|
||||
$('#shopping-list-form input').keydown(function (event)
|
||||
$('#shopping-list-form input').keydown(function(event)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
{
|
||||
|
@@ -16,12 +16,12 @@
|
||||
if (GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
Grocy.Api.Get('stock/products/' + jsonData.product_id,
|
||||
function (productDetails)
|
||||
function(productDetails)
|
||||
{
|
||||
window.parent.postMessage(WindowMessageBag("ShowSuccessMessage", __t("Added %1$s of %2$s to the shopping list \"%3$s\"", jsonData.product_amount + " " + __n(jsonData.product_amount, productDetails.quantity_unit_purchase.name, productDetails.quantity_unit_purchase.name_plural), productDetails.product.name, $("#shopping_list_id option:selected").text())), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("CloseAllModals"), Grocy.BaseUrl);
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
@@ -48,12 +48,12 @@
|
||||
if (GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
Grocy.Api.Get('stock/products/' + jsonData.product_id,
|
||||
function (productDetails)
|
||||
function(productDetails)
|
||||
{
|
||||
window.parent.postMessage(WindowMessageBag("ShowSuccessMessage", __t("Added %1$s of %2$s to the shopping list \"%3$s\"", jsonData.amount + " " + __n(jsonData.amount, productDetails.quantity_unit_purchase.name, productDetails.quantity_unit_purchase.name_plural), productDetails.product.name, $("#shopping_list_id option:selected").text())), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("CloseAllModals"), Grocy.BaseUrl);
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
@@ -79,12 +79,12 @@
|
||||
if (GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
Grocy.Api.Get('stock/products/' + jsonData.product_id,
|
||||
function (productDetails)
|
||||
function(productDetails)
|
||||
{
|
||||
window.parent.postMessage(WindowMessageBag("ShowSuccessMessage", __t("Added %1$s of %2$s to the shopping list \"%3$s\"", jsonData.amount + " " + __n(jsonData.amount, productDetails.quantity_unit_purchase.name, productDetails.quantity_unit_purchase.name_plural), productDetails.product.name, $("#shopping_list_id option:selected").text())), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("CloseAllModals"), Grocy.BaseUrl);
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
Grocy.Components.ProductCard.Refresh(productId);
|
||||
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function (productDetails)
|
||||
function(productDetails)
|
||||
{
|
||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
|
||||
|
||||
|
@@ -42,12 +42,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#shoppinglocation-form input').keyup(function (event)
|
||||
$('#shoppinglocation-form input').keyup(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form');
|
||||
});
|
||||
|
||||
$('#shoppinglocation-form input').keydown(function (event)
|
||||
$('#shoppinglocation-form input').keydown(function(event)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
{
|
||||
|
@@ -19,7 +19,7 @@ $("#search").on("keyup", Delay(function()
|
||||
locationsTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.shoppinglocation-delete-button', function (e)
|
||||
$(document).on('click', '.shoppinglocation-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-shoppinglocation-name');
|
||||
var objectId = $(e.currentTarget).attr('data-shoppinglocation-id');
|
||||
|
@@ -43,7 +43,7 @@ $(document).on('click', '.stock-consume-button', function(e)
|
||||
|
||||
var wasSpoiled = $(e.currentTarget).hasClass("stock-consume-button-spoiled");
|
||||
|
||||
Grocy.Api.Post('stock/products/' + productId + '/consume', { 'amount': consumeAmount, 'spoiled': wasSpoiled, 'location_id': locationId, 'stock_entry_id': specificStockEntryId},
|
||||
Grocy.Api.Post('stock/products/' + productId + '/consume', { 'amount': consumeAmount, 'spoiled': wasSpoiled, 'location_id': locationId, 'stock_entry_id': specificStockEntryId },
|
||||
function(bookingResponse)
|
||||
{
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
@@ -190,7 +190,7 @@ function RefreshStockEntryRow(stockRowId)
|
||||
$('#stock-' + stockRowId + '-shopping-location').attr('data-shopping-location-id', result.location_id);
|
||||
$('#stock-' + stockRowId + '-shopping-location').text(shoppingLocationName);
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
@@ -236,7 +236,7 @@ Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
|
||||
function UndoStockBookingEntry(bookingId, stockRowId)
|
||||
{
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
window.postMessage(WindowMessageBag("StockEntryChanged", stockRowId), Grocy.BaseUrl);
|
||||
|
@@ -10,11 +10,12 @@
|
||||
price = parseFloat(jsonForm.price).toFixed(2);
|
||||
}
|
||||
|
||||
var jsonData = { };
|
||||
var jsonData = {};
|
||||
jsonData.amount = jsonForm.amount;
|
||||
jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue();
|
||||
jsonData.purchased_date = Grocy.Components.DateTimePicker2.GetValue();
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) {
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
jsonData.shopping_location_id = Grocy.Components.ShoppingLocationPicker.GetValue();
|
||||
}
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
@@ -52,7 +53,7 @@
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||
|
||||
$('#stockentry-form input').keyup(function (event)
|
||||
$('#stockentry-form input').keyup(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||
});
|
||||
@@ -124,7 +125,7 @@ Grocy.Api.Get('stock/products/' + Grocy.EditObjectProductId,
|
||||
}
|
||||
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ $(document).on('click', '.undo-stock-booking-button', function(e)
|
||||
correspondingBookingsRoot = $(".stock-booking-correlation-" + correlationId);
|
||||
}
|
||||
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
correspondingBookingsRoot.addClass("text-muted");
|
||||
|
@@ -200,7 +200,8 @@ function RefreshStatistics()
|
||||
function(result)
|
||||
{
|
||||
var amountSum = 0;
|
||||
result.forEach(element => {
|
||||
result.forEach(element =>
|
||||
{
|
||||
amountSum += parseInt(element.amount);
|
||||
});
|
||||
$("#info-current-stock").text(__n(result.length, '%s Product', '%s Products'));
|
||||
|
@@ -19,7 +19,7 @@ $("#search").on("keyup", Delay(function()
|
||||
categoriesTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.task-category-delete-button', function (e)
|
||||
$(document).on('click', '.task-category-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-category-name');
|
||||
var objectId = $(e.currentTarget).attr('data-category-id');
|
||||
|
@@ -42,12 +42,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#task-category-form input').keyup(function (event)
|
||||
$('#task-category-form input').keyup(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('task-category-form');
|
||||
});
|
||||
|
||||
$('#task-category-form input').keydown(function (event)
|
||||
$('#task-category-form input').keydown(function(event)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
{
|
||||
|
@@ -102,7 +102,7 @@ $(document).on('click', '.undo-task-button', function(e)
|
||||
var taskId = $(e.currentTarget).attr('data-task-id');
|
||||
var taskName = $(e.currentTarget).attr('data-task-name');
|
||||
|
||||
Grocy.Api.Post('tasks/' + taskId + '/undo', { },
|
||||
Grocy.Api.Post('tasks/' + taskId + '/undo', {},
|
||||
function()
|
||||
{
|
||||
window.location.reload();
|
||||
@@ -115,7 +115,7 @@ $(document).on('click', '.undo-task-button', function(e)
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on('click', '.delete-task-button', function (e)
|
||||
$(document).on('click', '.delete-task-button', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
@@ -185,7 +185,8 @@ function RefreshStatistics()
|
||||
var overdueCount = 0;
|
||||
var now = moment();
|
||||
var nextXDaysThreshold = moment().add(nextXDays, "days");
|
||||
result.forEach(element => {
|
||||
result.forEach(element =>
|
||||
{
|
||||
var date = moment(element.due_date);
|
||||
if (date.isBefore(now))
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
$('#save-transfer-button').on('click', function (e)
|
||||
$('#save-transfer-button').on('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
{
|
||||
$("#flow-info-addbarcodetoselection").addClass("d-none");
|
||||
$('#barcode-lookup-disabled-hint').addClass('d-none');
|
||||
window.history.replaceState({ }, document.title, U("/transfer"));
|
||||
window.history.replaceState({}, document.title, U("/transfer"));
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
@@ -52,11 +52,11 @@
|
||||
|
||||
if (productDetails.product.enable_tare_weight_handling == 1)
|
||||
{
|
||||
var successMessage = __t('Transfered %1$s of %2$s from %3$s to %4$s', Math.abs(jsonForm.amount - parseFloat(productDetails.product.tare_weight)) + " " + __n(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name,$('option:selected', "#location_id_from").text(), $('option:selected', "#location_id_to").text()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + bookingResponse.transaction_id + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||
var successMessage = __t('Transfered %1$s of %2$s from %3$s to %4$s', Math.abs(jsonForm.amount - parseFloat(productDetails.product.tare_weight)) + " " + __n(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name, $('option:selected', "#location_id_from").text(), $('option:selected', "#location_id_to").text()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + bookingResponse.transaction_id + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
var successMessage =__t('Transfered %1$s of %2$s from %3$s to %4$s', Math.abs(jsonForm.amount) + " " + __n(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name, $('option:selected', "#location_id_from").text(), $('option:selected', "#location_id_to").text()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + bookingResponse.transaction_id + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||
var successMessage = __t('Transfered %1$s of %2$s from %3$s to %4$s', Math.abs(jsonForm.amount) + " " + __n(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name, $('option:selected', "#location_id_from").text(), $('option:selected', "#location_id_to").text()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockTransaction(\'' + bookingResponse.transaction_id + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||
}
|
||||
|
||||
if (GetUriParam("embedded") !== undefined)
|
||||
@@ -137,7 +137,8 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function(productDetails)
|
||||
{
|
||||
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.Clear();
|
||||
return;
|
||||
@@ -402,7 +403,7 @@ $("#use_specific_stock_entry").on("change", function()
|
||||
|
||||
function UndoStockBooking(bookingId)
|
||||
{
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', { },
|
||||
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Booking successfully undone"));
|
||||
@@ -416,12 +417,12 @@ function UndoStockBooking(bookingId)
|
||||
|
||||
function UndoStockTransaction(transactionId)
|
||||
{
|
||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', { },
|
||||
function (result)
|
||||
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', {},
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Transaction successfully undone"));
|
||||
},
|
||||
function (xhr)
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ $("#search").on("keyup", Delay(function()
|
||||
userentitiesTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.userentity-delete-button', function (e)
|
||||
$(document).on('click', '.userentity-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-userentity-name');
|
||||
var objectId = $(e.currentTarget).attr('data-userentity-id');
|
||||
@@ -41,7 +41,7 @@ $(document).on('click', '.userentity-delete-button', function (e)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
Grocy.Api.Delete('objects/userentities/' + objectId, { },
|
||||
Grocy.Api.Delete('objects/userentities/' + objectId, {},
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/userentities');
|
||||
|
@@ -31,7 +31,7 @@ $("#entity-filter").on("change", function()
|
||||
$("#new-userfield-button").attr("href", U("/userfield/new?entity=" + value));
|
||||
});
|
||||
|
||||
$(document).on('click', '.userfield-delete-button', function (e)
|
||||
$(document).on('click', '.userfield-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-userfield-name');
|
||||
var objectId = $(e.currentTarget).attr('data-userfield-id');
|
||||
|
@@ -35,7 +35,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#user-form input').keyup(function (event)
|
||||
$('#user-form input').keyup(function(event)
|
||||
{
|
||||
var element = document.getElementById("password_confirm");
|
||||
if ($("#password").val() !== $("#password_confirm").val())
|
||||
@@ -50,7 +50,7 @@ $('#user-form input').keyup(function (event)
|
||||
Grocy.FrontendHelpers.ValidateForm('user-form');
|
||||
});
|
||||
|
||||
$('#user-form input').keydown(function (event)
|
||||
$('#user-form input').keydown(function(event)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
{
|
||||
|
@@ -19,7 +19,7 @@ $("#search").on("keyup", Delay(function()
|
||||
userobjectsTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.userobject-delete-button', function (e)
|
||||
$(document).on('click', '.userobject-delete-button', function(e)
|
||||
{
|
||||
var objectId = $(e.currentTarget).attr('data-userobject-id');
|
||||
|
||||
@@ -40,7 +40,7 @@ $(document).on('click', '.userobject-delete-button', function (e)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
Grocy.Api.Delete('objects/userobjects/' + objectId, { },
|
||||
Grocy.Api.Delete('objects/userobjects/' + objectId, {},
|
||||
function(result)
|
||||
{
|
||||
window.location.reload();
|
||||
|
@@ -1,10 +1,12 @@
|
||||
$('input.permission-cb').click(
|
||||
function () {
|
||||
function()
|
||||
{
|
||||
check_hierachy(this.checked, this.name);
|
||||
}
|
||||
);
|
||||
|
||||
function check_hierachy(checked, name) {
|
||||
function check_hierachy(checked, name)
|
||||
{
|
||||
var disabled = checked;
|
||||
$('#permission-sub-' + name).find('input.permission-cb')
|
||||
.prop('checked', disabled)
|
||||
@@ -12,28 +14,37 @@ function check_hierachy(checked, name) {
|
||||
}
|
||||
|
||||
$('#permission-save').click(
|
||||
function () {
|
||||
function()
|
||||
{
|
||||
var permission_list = $('input.permission-cb')
|
||||
.filter(function () {
|
||||
.filter(function()
|
||||
{
|
||||
return $(this).prop('checked') && !$(this).attr('disabled');
|
||||
}).map(function () {
|
||||
}).map(function()
|
||||
{
|
||||
return $(this).data('perm-id');
|
||||
}).toArray();
|
||||
Grocy.Api.Put('users/' + Grocy.EditObjectId + '/permissions', {
|
||||
'permissions': permission_list,
|
||||
}, function (result) {
|
||||
}, function(result)
|
||||
{
|
||||
toastr.success(__t("Permissions saved"));
|
||||
}, function (xhr) {
|
||||
}, function(xhr)
|
||||
{
|
||||
toastr.error(__t(JSON.parse(xhr.response).error_message));
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
if (Grocy.EditObjectId == Grocy.UserId) {
|
||||
$('input.permission-cb[name=ADMIN]').click(function () {
|
||||
if (!this.checked) {
|
||||
if (!confirm(__t('Are you sure you want to remove full permissions for yourself?'))) {
|
||||
if (Grocy.EditObjectId == Grocy.UserId)
|
||||
{
|
||||
$('input.permission-cb[name=ADMIN]').click(function()
|
||||
{
|
||||
if (!this.checked)
|
||||
{
|
||||
if (!confirm(__t('Are you sure you want to remove full permissions for yourself?')))
|
||||
{
|
||||
this.checked = true;
|
||||
check_hierachy(this.checked, this.name);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ $("#search").on("keyup", Delay(function()
|
||||
usersTable.search(value).draw();
|
||||
}, 200));
|
||||
|
||||
$(document).on('click', '.user-delete-button', function (e)
|
||||
$(document).on('click', '.user-delete-button', function(e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-user-username');
|
||||
var objectId = $(e.currentTarget).attr('data-user-id');
|
||||
|
Reference in New Issue
Block a user