diff --git a/public/js/extensions.js b/public/js/extensions.js
index a3197eed..87adf511 100644
--- a/public/js/extensions.js
+++ b/public/js/extensions.js
@@ -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;
- }
-});
+ "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;
}
diff --git a/public/js/grocy.js b/public/js/grocy.js
index 91e38909..dd8ca04e 100644
--- a/public/js/grocy.js
+++ b/public/js/grocy.js
@@ -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');
}
});
diff --git a/public/js/grocy_clock.js b/public/js/grocy_clock.js
index d617c0f6..efa13886 100644
--- a/public/js/grocy_clock.js
+++ b/public/js/grocy_clock.js
@@ -1,4 +1,4 @@
-$("#show-clock-in-header").on("change", function ()
+$("#show-clock-in-header").on("change", function()
{
CheckHeaderClockEnabled();
});
diff --git a/public/js/grocy_uisound.js b/public/js/grocy_uisound.js
index b7150084..254fd244 100644
--- a/public/js/grocy_uisound.js
+++ b/public/js/grocy_uisound.js
@@ -1,4 +1,4 @@
-Grocy.UISound = { };
+Grocy.UISound = {};
Grocy.UISound.Play = function(url)
{
diff --git a/public/js/grocy_wakelockhandling.js b/public/js/grocy_wakelockhandling.js
index a18b3a31..490678ec 100644
--- a/public/js/grocy_wakelockhandling.js
+++ b/public/js/grocy_wakelockhandling.js
@@ -1,4 +1,4 @@
-Grocy.WakeLock = { };
+Grocy.WakeLock = {};
Grocy.WakeLock.NoSleepJsIntance = null;
Grocy.WakeLock.InitDone = false;
diff --git a/public/viewjs/barcodescannertesting.js b/public/viewjs/barcodescannertesting.js
index 6a6a2937..10d26dd1 100644
--- a/public/viewjs/barcodescannertesting.js
+++ b/public/viewjs/barcodescannertesting.js
@@ -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();
diff --git a/public/viewjs/batteries.js b/public/viewjs/batteries.js
index 893e8ed9..0829ebe4 100644
--- a/public/viewjs/batteries.js
+++ b/public/viewjs/batteries.js
@@ -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');
diff --git a/public/viewjs/batteriesjournal.js b/public/viewjs/batteriesjournal.js
index b998fce0..682f0bce 100644
--- a/public/viewjs/batteriesjournal.js
+++ b/public/viewjs/batteriesjournal.js
@@ -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");
diff --git a/public/viewjs/batteriesoverview.js b/public/viewjs/batteriesoverview.js
index 4d5326d3..49a4869a 100644
--- a/public/viewjs/batteriesoverview.js
+++ b/public/viewjs/batteriesoverview.js
@@ -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))
{
diff --git a/public/viewjs/batterytracking.js b/public/viewjs/batterytracking.js
index 67add80d..07c01d2f 100644
--- a/public/viewjs/batterytracking.js
+++ b/public/viewjs/batterytracking.js
@@ -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"));
diff --git a/public/viewjs/calendar.js b/public/viewjs/calendar.js
index 96a3b649..9c8461b6 100644
--- a/public/viewjs/calendar.js
+++ b/public/viewjs/calendar.js
@@ -17,9 +17,10 @@ var calendar = $("#calendar").fullCalendar({
"eventLimit": false,
"height": "auto",
"eventSources": fullcalendarEventSources,
- eventClick: function(info) {
+ eventClick: function(info)
+ {
location.href = info.link;
- }
+ }
});
$("#ical-button").on("click", function(e)
diff --git a/public/viewjs/choreform.js b/public/viewjs/choreform.js
index 057240e6..4e839d14 100644
--- a/public/viewjs/choreform.js
+++ b/public/viewjs/choreform.js
@@ -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')
diff --git a/public/viewjs/chores.js b/public/viewjs/chores.js
index 8c600cf6..7d3ca85a 100644
--- a/public/viewjs/chores.js
+++ b/public/viewjs/chores.js
@@ -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');
diff --git a/public/viewjs/choresjournal.js b/public/viewjs/choresjournal.js
index 2e548998..bfa48add 100644
--- a/public/viewjs/choresjournal.js
+++ b/public/viewjs/choresjournal.js
@@ -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");
diff --git a/public/viewjs/choresoverview.js b/public/viewjs/choresoverview.js
index 8fed886a..1a3d33f5 100644
--- a/public/viewjs/choresoverview.js
+++ b/public/viewjs/choresoverview.js
@@ -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))
{
diff --git a/public/viewjs/choretracking.js b/public/viewjs/choretracking.js
index 05b60fa9..027bceeb 100644
--- a/public/viewjs/choretracking.js
+++ b/public/viewjs/choretracking.js
@@ -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"));
diff --git a/public/viewjs/components/barcodescanner.js b/public/viewjs/components/barcodescanner.js
index a9dd93f4..af033325 100644
--- a/public/viewjs/components/barcodescanner.js
+++ b/public/viewjs/components/barcodescanner.js
@@ -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: [
{
@@ -233,7 +238,7 @@ $(document).on("click", "#barcodescanner-start-button", async function(e)
{
Grocy.Components.BarcodeScanner.TorchOn(Quagga.CameraAccess.getActiveTrack());
return false;
- }
+ }
},
cancel: {
label: __t('Cancel'),
@@ -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();
diff --git a/public/viewjs/components/batterycard.js b/public/viewjs/components/batterycard.js
index d23d8736..e4ad85ab 100644
--- a/public/viewjs/components/batterycard.js
+++ b/public/viewjs/components/batterycard.js
@@ -1,4 +1,4 @@
-Grocy.Components.BatteryCard = { };
+Grocy.Components.BatteryCard = {};
Grocy.Components.BatteryCard.Refresh = function(batteryId)
{
diff --git a/public/viewjs/components/calendarcard.js b/public/viewjs/components/calendarcard.js
index db393f55..36cc3425 100644
--- a/public/viewjs/components/calendarcard.js
+++ b/public/viewjs/components/calendarcard.js
@@ -1,40 +1,40 @@
$('#calendar').datetimepicker(
-{
- format: 'L',
- buttons: {
- showToday: true,
- showClose: false
- },
- calendarWeeks: true,
- locale: moment.locale(),
- icons: {
- time: 'far fa-clock',
- date: 'far fa-calendar',
- up: 'fas fa-arrow-up',
- down: 'fas fa-arrow-down',
- previous: 'fas fa-chevron-left',
- next: 'fas fa-chevron-right',
- today: 'fas fa-calendar-check',
- clear: 'far fa-trash-alt',
- close: 'far fa-times-circle'
- },
- keepOpen: true,
- inline: true,
- keyBinds: {
- up: function(widget) { },
- down: function(widget) { },
- 'control up': function(widget) { },
- 'control down': function(widget) { },
- left: function(widget) { },
- right: function(widget) { },
- pageUp: function(widget) { },
- pageDown: function(widget) { },
- enter: function(widget) { },
- escape: function(widget) { },
- 'control space': function(widget) { },
- t: function(widget) { },
- 'delete': function(widget) { }
- }
-});
+ {
+ format: 'L',
+ buttons: {
+ showToday: true,
+ showClose: false
+ },
+ calendarWeeks: true,
+ locale: moment.locale(),
+ icons: {
+ time: 'far fa-clock',
+ date: 'far fa-calendar',
+ up: 'fas fa-arrow-up',
+ down: 'fas fa-arrow-down',
+ previous: 'fas fa-chevron-left',
+ next: 'fas fa-chevron-right',
+ today: 'fas fa-calendar-check',
+ clear: 'far fa-trash-alt',
+ close: 'far fa-times-circle'
+ },
+ keepOpen: true,
+ inline: true,
+ keyBinds: {
+ up: function(widget) { },
+ down: function(widget) { },
+ 'control up': function(widget) { },
+ 'control down': function(widget) { },
+ left: function(widget) { },
+ right: function(widget) { },
+ pageUp: function(widget) { },
+ pageDown: function(widget) { },
+ enter: function(widget) { },
+ escape: function(widget) { },
+ 'control space': function(widget) { },
+ t: function(widget) { },
+ 'delete': function(widget) { }
+ }
+ });
$('#calendar').datetimepicker('show');
diff --git a/public/viewjs/components/chorecard.js b/public/viewjs/components/chorecard.js
index 83ca9d22..861eaa51 100644
--- a/public/viewjs/components/chorecard.js
+++ b/public/viewjs/components/chorecard.js
@@ -1,4 +1,4 @@
-Grocy.Components.ChoreCard = { };
+Grocy.Components.ChoreCard = {};
Grocy.Components.ChoreCard.Refresh = function(choreId)
{
diff --git a/public/viewjs/components/datetimepicker.js b/public/viewjs/components/datetimepicker.js
index ca46f55c..38b1f2da 100644
--- a/public/viewjs/components/datetimepicker.js
+++ b/public/viewjs/components/datetimepicker.js
@@ -1,4 +1,4 @@
-Grocy.Components.DateTimePicker = { };
+Grocy.Components.DateTimePicker = {};
Grocy.Components.DateTimePicker.GetInputElement = function()
{
@@ -80,45 +80,45 @@ if (Grocy.Components.DateTimePicker.GetInputElement().data('limit-end-to-now') =
Grocy.Components.DateTimePicker.Init = function()
{
$('.datetimepicker').datetimepicker(
- {
- format: Grocy.Components.DateTimePicker.GetInputElement().data('format'),
- buttons: {
- showToday: true,
- showClose: true
- },
- calendarWeeks: Grocy.CalendarShowWeekNumbers,
- maxDate: limitDate,
- locale: moment.locale(),
- defaultDate: startDate,
- useCurrent: false,
- icons: {
- time: 'far fa-clock',
- date: 'far fa-calendar',
- up: 'fas fa-arrow-up',
- down: 'fas fa-arrow-down',
- previous: 'fas fa-chevron-left',
- next: 'fas fa-chevron-right',
- today: 'fas fa-calendar-check',
- clear: 'far fa-trash-alt',
- close: 'far fa-times-circle'
- },
- sideBySide: true,
- keyBinds: {
- up: function(widget) { },
- down: function(widget) { },
- 'control up': function(widget) { },
- 'control down': function(widget) { },
- left: function(widget) { },
- right: function(widget) { },
- pageUp: function(widget) { },
- pageDown: function(widget) { },
- enter: function(widget) { },
- escape: function(widget) { },
- 'control space': function(widget) { },
- t: function(widget) { },
- 'delete': function(widget) { }
- }
- });
+ {
+ format: Grocy.Components.DateTimePicker.GetInputElement().data('format'),
+ buttons: {
+ showToday: true,
+ showClose: true
+ },
+ calendarWeeks: Grocy.CalendarShowWeekNumbers,
+ maxDate: limitDate,
+ locale: moment.locale(),
+ defaultDate: startDate,
+ useCurrent: false,
+ icons: {
+ time: 'far fa-clock',
+ date: 'far fa-calendar',
+ up: 'fas fa-arrow-up',
+ down: 'fas fa-arrow-down',
+ previous: 'fas fa-chevron-left',
+ next: 'fas fa-chevron-right',
+ today: 'fas fa-calendar-check',
+ clear: 'far fa-trash-alt',
+ close: 'far fa-times-circle'
+ },
+ sideBySide: true,
+ keyBinds: {
+ up: function(widget) { },
+ down: function(widget) { },
+ 'control up': function(widget) { },
+ 'control down': function(widget) { },
+ left: function(widget) { },
+ right: function(widget) { },
+ pageUp: function(widget) { },
+ pageDown: function(widget) { },
+ enter: function(widget) { },
+ escape: function(widget) { },
+ 'control space': function(widget) { },
+ t: function(widget) { },
+ 'delete': function(widget) { }
+ }
+ });
}
Grocy.Components.DateTimePicker.Init();
diff --git a/public/viewjs/components/datetimepicker2.js b/public/viewjs/components/datetimepicker2.js
index 60206eb6..8a730d09 100644
--- a/public/viewjs/components/datetimepicker2.js
+++ b/public/viewjs/components/datetimepicker2.js
@@ -1,4 +1,4 @@
-Grocy.Components.DateTimePicker2 = { };
+Grocy.Components.DateTimePicker2 = {};
Grocy.Components.DateTimePicker2.GetInputElement = function()
{
@@ -80,45 +80,45 @@ if (Grocy.Components.DateTimePicker2.GetInputElement().data('limit-end-to-now')
Grocy.Components.DateTimePicker2.Init = function()
{
$('.datetimepicker2').datetimepicker(
- {
- format: Grocy.Components.DateTimePicker2.GetInputElement().data('format'),
- buttons: {
- showToday: true,
- showClose: true
- },
- calendarWeeks: Grocy.CalendarShowWeekNumbers,
- maxDate: limitDate,
- locale: moment.locale(),
- defaultDate: startDate,
- useCurrent: false,
- icons: {
- time: 'far fa-clock',
- date: 'far fa-calendar',
- up: 'fas fa-arrow-up',
- down: 'fas fa-arrow-down',
- previous: 'fas fa-chevron-left',
- next: 'fas fa-chevron-right',
- today: 'fas fa-calendar-check',
- clear: 'far fa-trash-alt',
- close: 'far fa-times-circle'
- },
- sideBySide: true,
- keyBinds: {
- up: function(widget) { },
- down: function(widget) { },
- 'control up': function(widget) { },
- 'control down': function(widget) { },
- left: function(widget) { },
- right: function(widget) { },
- pageUp: function(widget) { },
- pageDown: function(widget) { },
- enter: function(widget) { },
- escape: function(widget) { },
- 'control space': function(widget) { },
- t: function(widget) { },
- 'delete': function(widget) { }
- }
- });
+ {
+ format: Grocy.Components.DateTimePicker2.GetInputElement().data('format'),
+ buttons: {
+ showToday: true,
+ showClose: true
+ },
+ calendarWeeks: Grocy.CalendarShowWeekNumbers,
+ maxDate: limitDate,
+ locale: moment.locale(),
+ defaultDate: startDate,
+ useCurrent: false,
+ icons: {
+ time: 'far fa-clock',
+ date: 'far fa-calendar',
+ up: 'fas fa-arrow-up',
+ down: 'fas fa-arrow-down',
+ previous: 'fas fa-chevron-left',
+ next: 'fas fa-chevron-right',
+ today: 'fas fa-calendar-check',
+ clear: 'far fa-trash-alt',
+ close: 'far fa-times-circle'
+ },
+ sideBySide: true,
+ keyBinds: {
+ up: function(widget) { },
+ down: function(widget) { },
+ 'control up': function(widget) { },
+ 'control down': function(widget) { },
+ left: function(widget) { },
+ right: function(widget) { },
+ pageUp: function(widget) { },
+ pageDown: function(widget) { },
+ enter: function(widget) { },
+ escape: function(widget) { },
+ 'control space': function(widget) { },
+ t: function(widget) { },
+ 'delete': function(widget) { }
+ }
+ });
}
Grocy.Components.DateTimePicker2.Init();
diff --git a/public/viewjs/components/locationpicker.js b/public/viewjs/components/locationpicker.js
index 4bb46b67..c6dae8c5 100644
--- a/public/viewjs/components/locationpicker.js
+++ b/public/viewjs/components/locationpicker.js
@@ -1,4 +1,4 @@
-Grocy.Components.LocationPicker = { };
+Grocy.Components.LocationPicker = {};
Grocy.Components.LocationPicker.GetPicker = function()
{
diff --git a/public/viewjs/components/numberpicker.js b/public/viewjs/components/numberpicker.js
index 5da1757d..5d54aea7 100644
--- a/public/viewjs/components/numberpicker.js
+++ b/public/viewjs/components/numberpicker.js
@@ -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();
diff --git a/public/viewjs/components/productamountpicker.js b/public/viewjs/components/productamountpicker.js
index aa85efae..b1b1af19 100644
--- a/public/viewjs/components/productamountpicker.js
+++ b/public/viewjs/components/productamountpicker.js
@@ -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()
diff --git a/public/viewjs/components/productcard.js b/public/viewjs/components/productcard.js
index 78cce90d..c20994e7 100644
--- a/public/viewjs/components/productcard.js
+++ b/public/viewjs/components/productcard.js
@@ -1,4 +1,4 @@
-Grocy.Components.ProductCard = { };
+Grocy.Components.ProductCard = {};
Grocy.Components.ProductCard.Refresh = function(productId)
{
@@ -95,7 +95,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
{
if (productDetails.last_qu_factor_purchase_to_stock > 1)
{
- $('#productcard-product-last-price').text(Number.parseFloat(productDetails.last_price).toLocaleString() + ' ' + Grocy.Currency + ' per 1 ' + productDetails.quantity_unit_purchase.name + ' of ' + productDetails.last_qu_factor_purchase_to_stock + ' ' + productDetails.quantity_unit_stock.name_plural);
+ $('#productcard-product-last-price').text(Number.parseFloat(productDetails.last_price).toLocaleString() + ' ' + Grocy.Currency + ' per 1 ' + productDetails.quantity_unit_purchase.name + ' of ' + productDetails.last_qu_factor_purchase_to_stock + ' ' + productDetails.quantity_unit_stock.name_plural);
}
else
{
@@ -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,
diff --git a/public/viewjs/components/productpicker.js b/public/viewjs/components/productpicker.js
index c42d01a6..16d4bd5f 100644
--- a/public/viewjs/components/productpicker.js
+++ b/public/viewjs/components/productpicker.js
@@ -1,4 +1,4 @@
-Grocy.Components.ProductPicker = { };
+Grocy.Components.ProductPicker = {};
Grocy.Components.ProductPicker.GetPicker = function()
{
diff --git a/public/viewjs/components/recipepicker.js b/public/viewjs/components/recipepicker.js
index fca2b018..29488701 100644
--- a/public/viewjs/components/recipepicker.js
+++ b/public/viewjs/components/recipepicker.js
@@ -1,4 +1,4 @@
-Grocy.Components.RecipePicker = { };
+Grocy.Components.RecipePicker = {};
Grocy.Components.RecipePicker.GetPicker = function()
{
diff --git a/public/viewjs/components/shoppinglocationpicker.js b/public/viewjs/components/shoppinglocationpicker.js
index cc2ae73e..58973599 100644
--- a/public/viewjs/components/shoppinglocationpicker.js
+++ b/public/viewjs/components/shoppinglocationpicker.js
@@ -1,4 +1,4 @@
-Grocy.Components.ShoppingLocationPicker = { };
+Grocy.Components.ShoppingLocationPicker = {};
Grocy.Components.ShoppingLocationPicker.GetPicker = function()
{
diff --git a/public/viewjs/components/userfieldsform.js b/public/viewjs/components/userfieldsform.js
index 4be4febc..abc8fabb 100644
--- a/public/viewjs/components/userfieldsform.js
+++ b/public/viewjs/components/userfieldsform.js
@@ -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()
{
diff --git a/public/viewjs/components/userpicker.js b/public/viewjs/components/userpicker.js
index 0ef8682c..f36a83fb 100644
--- a/public/viewjs/components/userpicker.js
+++ b/public/viewjs/components/userpicker.js
@@ -1,4 +1,4 @@
-Grocy.Components.UserPicker = { };
+Grocy.Components.UserPicker = {};
Grocy.Components.UserPicker.GetPicker = function()
{
diff --git a/public/viewjs/consume.js b/public/viewjs/consume.js
index 8e3be2e0..e007dc55 100644
--- a/public/viewjs/consume.js
+++ b/public/viewjs/consume.js
@@ -47,14 +47,14 @@
var jsonDataBarcode = {};
jsonDataBarcode.barcode = addBarcode;
jsonDataBarcode.product_id = jsonForm.product_id;
- jsonDataBarcode.qu_factor_purchase_to_stock = productDetails.product.qu_factor_purchase_to_stock;
+ jsonDataBarcode.qu_factor_purchase_to_stock = productDetails.product.qu_factor_purchase_to_stock;
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
function(result)
{
$("#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"))
@@ -187,12 +187,12 @@ $("#location_id").on('change', function(e)
$("#specific_stock_entry").find("option").remove().end().append("");
if ($("#use_specific_stock_entry").is(":checked"))
{
- $("#use_specific_stock_entry").click();
+ $("#use_specific_stock_entry").click();
}
if (GetUriParam("embedded") !== undefined)
{
- stockId = GetUriParam('stockId');
+ stockId = GetUriParam('stockId');
}
if (locationId)
@@ -260,7 +260,7 @@ $("#location_id").on('change', function(e)
}
}
},
- function (xhr)
+ function(xhr)
{
console.error(xhr);
}
@@ -268,7 +268,7 @@ $("#location_id").on('change', function(e)
},
function(xhr)
{
- console.error(xhr);
+ console.error(xhr);
}
);
}
@@ -447,7 +447,7 @@ $("#specific_stock_entry").on("change", function(e)
{
if ($(e.target).val() == "")
{
- var sumValue = 0;
+ var sumValue = 0;
Grocy.Api.Get("stock/products/" + Grocy.Components.ProductPicker.GetValue() + '/entries',
function(stockEntries)
{
@@ -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);
}
diff --git a/public/viewjs/equipment.js b/public/viewjs/equipment.js
index e97f8ff6..0bdb87e5 100644
--- a/public/viewjs/equipment.js
+++ b/public/viewjs/equipment.js
@@ -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');
diff --git a/public/viewjs/equipmentform.js b/public/viewjs/equipmentform.js
index 086b8b2f..54f449bd 100644
--- a/public/viewjs/equipmentform.js
+++ b/public/viewjs/equipmentform.js
@@ -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");
diff --git a/public/viewjs/inventory.js b/public/viewjs/inventory.js
index 56880a11..1a851327 100644
--- a/public/viewjs/inventory.js
+++ b/public/viewjs/inventory.js
@@ -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)
@@ -40,7 +41,7 @@
var jsonDataBarcode = {};
jsonDataBarcode.barcode = addBarcode;
jsonDataBarcode.product_id = jsonForm.product_id;
- jsonDataBarcode.qu_factor_purchase_to_stock = productDetails.product.qu_factor_purchase_to_stock;
+ jsonDataBarcode.qu_factor_purchase_to_stock = productDetails.product.qu_factor_purchase_to_stock;
jsonDataBarcode.shopping_location_id = jsonForm.shopping_location_id;
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
@@ -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);
}
diff --git a/public/viewjs/locationform.js b/public/viewjs/locationform.js
index 65e7862b..88547f80 100644
--- a/public/viewjs/locationform.js
+++ b/public/viewjs/locationform.js
@@ -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
{
diff --git a/public/viewjs/locations.js b/public/viewjs/locations.js
index 09b0d3ed..28947d3a 100644
--- a/public/viewjs/locations.js
+++ b/public/viewjs/locations.js
@@ -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');
diff --git a/public/viewjs/manageapikeys.js b/public/viewjs/manageapikeys.js
index 3b2e60d2..59a97756 100644
--- a/public/viewjs/manageapikeys.js
+++ b/public/viewjs/manageapikeys.js
@@ -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');
diff --git a/public/viewjs/mealplan.js b/public/viewjs/mealplan.js
index ab6c5f29..002ffee5 100644
--- a/public/viewjs/mealplan.js
+++ b/public/viewjs/mealplan.js
@@ -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")
@@ -634,11 +634,11 @@ $(document).on('click', '.product-consume-button', function(e)
var productId = $(e.currentTarget).attr('data-product-id');
var consumeAmount = parseFloat($(e.currentTarget).attr('data-product-amount'));
- Grocy.Api.Post('stock/products/' + productId + '/consume', { 'amount': consumeAmount, 'spoiled': false },
+ Grocy.Api.Post('stock/products/' + productId + '/consume', { 'amount': consumeAmount, 'spoiled': false },
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) + '
' + __t("Undo") + '';
@@ -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);
}
diff --git a/public/viewjs/openapiui.js b/public/viewjs/openapiui.js
index a598aa75..d4f77c11 100644
--- a/public/viewjs/openapiui.js
+++ b/public/viewjs/openapiui.js
@@ -2,7 +2,7 @@
{
return {
components: {
- Topbar: function () { return null }
+ Topbar: function() { return null }
}
}
}
diff --git a/public/viewjs/productform.js b/public/viewjs/productform.js
index ec45bdb4..157ad8d3 100644
--- a/public/viewjs/productform.js
+++ b/public/viewjs/productform.js
@@ -48,7 +48,7 @@
var jsonDataBarcode = {};
jsonDataBarcode.barcode = prefillBarcode;
jsonDataBarcode.product_id = result.created_object_id;
- jsonDataBarcode.qu_factor_purchase_to_stock = jsonData.qu_factor_purchase_to_stock;
+ jsonDataBarcode.qu_factor_purchase_to_stock = jsonData.qu_factor_purchase_to_stock;
jsonDataBarcode.shopping_location_id = jsonData.shopping_location_id;
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
@@ -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');
}
diff --git a/public/viewjs/productgroupform.js b/public/viewjs/productgroupform.js
index 86d5b33d..0ca0e725 100644
--- a/public/viewjs/productgroupform.js
+++ b/public/viewjs/productgroupform.js
@@ -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
{
diff --git a/public/viewjs/products.js b/public/viewjs/products.js
index ace04d3d..5934c4b0 100644
--- a/public/viewjs/products.js
+++ b/public/viewjs/products.js
@@ -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);
}
diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js
index 173596f1..89a91212 100644
--- a/public/viewjs/purchase.js
+++ b/public/viewjs/purchase.js
@@ -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;
@@ -54,7 +55,7 @@
var jsonDataBarcode = {};
jsonDataBarcode.barcode = addBarcode;
jsonDataBarcode.product_id = jsonForm.product_id;
- jsonDataBarcode.qu_factor_purchase_to_stock = jsonForm.qu_factor_purchase_to_stock;
+ jsonDataBarcode.qu_factor_purchase_to_stock = jsonForm.qu_factor_purchase_to_stock;
jsonDataBarcode.shopping_location_id = jsonForm.shopping_location_id;
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
@@ -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();
@@ -142,23 +144,23 @@ if (Grocy.Components.ProductPicker !== undefined)
{
Grocy.Api.Get('productbarcodedetails/' + document.getElementById("product_id").getAttribute("barcode"),
function(resultBarcode)
+ {
+ if (resultBarcode != null)
{
- if (resultBarcode != null)
- {
- $('#product_id').attr("barcode-qu-factor-purchase-to-stock", resultBarcode.qu_factor_purchase_to_stock);
- $('#product_id').attr("barcode-shopping-location-id", resultBarcode.shopping_location_id);
- }
- else
- {
- $('#product_id').attr("barcode-qu-factor-purchase-to-stock", "null");
- $('#product_id').attr("barcode-shopping-location-id", "null");
- }
- },
- function(xhr)
- {
- console.error(xhr);
+ $('#product_id').attr("barcode-qu-factor-purchase-to-stock", resultBarcode.qu_factor_purchase_to_stock);
+ $('#product_id').attr("barcode-shopping-location-id", resultBarcode.shopping_location_id);
}
- );
+ else
+ {
+ $('#product_id').attr("barcode-qu-factor-purchase-to-stock", "null");
+ $('#product_id').attr("barcode-shopping-location-id", "null");
+ }
+ },
+ function(xhr)
+ {
+ console.error(xhr);
+ }
+ );
}
else
{
@@ -184,15 +186,16 @@ if (Grocy.Components.ProductPicker !== undefined)
{
if (productDetails.last_qu_factor_purchase_to_stock != null)
{
- qu_factor_purchase_to_stock = productDetails.last_qu_factor_purchase_to_stock;
+ qu_factor_purchase_to_stock = productDetails.last_qu_factor_purchase_to_stock;
}
else
{
- qu_factor_purchase_to_stock = productDetails.product.qu_factor_purchase_to_stock;
+ qu_factor_purchase_to_stock = productDetails.product.qu_factor_purchase_to_stock;
}
}
- 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);
@@ -401,7 +404,7 @@ $('#qu_factor_purchase_to_stock').on('change', function(e)
{
var value = $(e.target).val();
$('#amount_qu_unit').attr("qu-factor-purchase-to-stock", value);
- $('#amount_qu_unit').text(document.getElementById("amount_qu_unit").getAttribute("quantity-unit-purchase-name") + " (" + __t("will be multiplied by a factor of %1$s to get %2$s", parseFloat(value).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 2 }), __n(2, document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name"), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name-plural")) + ")"));
+ $('#amount_qu_unit').text(document.getElementById("amount_qu_unit").getAttribute("quantity-unit-purchase-name") + " (" + __t("will be multiplied by a factor of %1$s to get %2$s", parseFloat(value).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: 2 }), __n(2, document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name"), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name-plural")) + ")"));
refreshPriceHint();
Grocy.FrontendHelpers.ValidateForm('purchase-form');
});
@@ -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);
}
diff --git a/public/viewjs/quantityunitform.js b/public/viewjs/quantityunitform.js
index a2017b1c..93afb585 100644
--- a/public/viewjs/quantityunitform.js
+++ b/public/viewjs/quantityunitform.js
@@ -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");
diff --git a/public/viewjs/quantityunits.js b/public/viewjs/quantityunits.js
index bb7ba589..9d5766a1 100644
--- a/public/viewjs/quantityunits.js
+++ b/public/viewjs/quantityunits.js
@@ -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');
diff --git a/public/viewjs/recipeform.js b/public/viewjs/recipeform.js
index 65e9f126..9a36d7ed 100644
--- a/public/viewjs/recipeform.js
+++ b/public/viewjs/recipeform.js
@@ -39,10 +39,11 @@ $('.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));
+ (result) => saveRecipePicture(result, location));
return;
}
@@ -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
{
@@ -212,7 +213,7 @@ $(document).on('click', '.recipe-pos-edit-button', function(e)
var recipePosId = $(e.currentTarget).attr('data-recipe-pos-id');
bootbox.dialog({
- message: '',
+ message: '',
size: 'large',
backdrop: true,
closeButton: false,
@@ -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,21 +339,23 @@ $('#save-recipe-include-button').on('click', 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");
- $("#current-recipe-picture").addClass("d-none");
- Grocy.DeleteRecipePictureOnSave = false;
+$("#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");
+ $("#current-recipe-picture").addClass("d-none");
+ Grocy.DeleteRecipePictureOnSave = false;
});
Grocy.DeleteRecipePictureOnSave = false;
-$("#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");
- $("#recipe-picture-label").addClass("d-none");
- $("#recipe-picture-label-none").removeClass("d-none");
+$("#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");
+ $("#recipe-picture-label").addClass("d-none");
+ $("#recipe-picture-label-none").removeClass("d-none");
});
Grocy.Components.UserfieldsForm.Load();
diff --git a/public/viewjs/recipeposform.js b/public/viewjs/recipeposform.js
index 71c338b0..e02d90ea 100644
--- a/public/viewjs/recipeposform.js
+++ b/public/viewjs/recipeposform.js
@@ -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();
diff --git a/public/viewjs/recipes.js b/public/viewjs/recipes.js
index ff67eb21..56d03d21 100644
--- a/public/viewjs/recipes.js
+++ b/public/viewjs/recipes.js
@@ -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,
diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js
index aca61c7a..3244e25e 100644
--- a/public/viewjs/shoppinglist.js
+++ b/public/viewjs/shoppinglist.js
@@ -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()
diff --git a/public/viewjs/shoppinglistform.js b/public/viewjs/shoppinglistform.js
index a10b6a34..820ae3e4 100644
--- a/public/viewjs/shoppinglistform.js
+++ b/public/viewjs/shoppinglistform.js
@@ -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
{
diff --git a/public/viewjs/shoppinglistitemform.js b/public/viewjs/shoppinglistitemform.js
index a579735b..db706114 100644
--- a/public/viewjs/shoppinglistitemform.js
+++ b/public/viewjs/shoppinglistitemform.js
@@ -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);
diff --git a/public/viewjs/shoppinglocationform.js b/public/viewjs/shoppinglocationform.js
index 587981c1..42cbda51 100644
--- a/public/viewjs/shoppinglocationform.js
+++ b/public/viewjs/shoppinglocationform.js
@@ -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
{
diff --git a/public/viewjs/shoppinglocations.js b/public/viewjs/shoppinglocations.js
index 972bce7d..5843ba00 100644
--- a/public/viewjs/shoppinglocations.js
+++ b/public/viewjs/shoppinglocations.js
@@ -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');
diff --git a/public/viewjs/stockentries.js b/public/viewjs/stockentries.js
index 99b1bd0b..ed7e8b6c 100644
--- a/public/viewjs/stockentries.js
+++ b/public/viewjs/stockentries.js
@@ -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);
diff --git a/public/viewjs/stockentryform.js b/public/viewjs/stockentryform.js
index d0b41f81..732f4485 100644
--- a/public/viewjs/stockentryform.js
+++ b/public/viewjs/stockentryform.js
@@ -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);
}
diff --git a/public/viewjs/stockjournal.js b/public/viewjs/stockjournal.js
index 416607ca..0fba3da0 100644
--- a/public/viewjs/stockjournal.js
+++ b/public/viewjs/stockjournal.js
@@ -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");
diff --git a/public/viewjs/stockoverview.js b/public/viewjs/stockoverview.js
index b1f6fbbf..ec8ad794 100644
--- a/public/viewjs/stockoverview.js
+++ b/public/viewjs/stockoverview.js
@@ -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'));
diff --git a/public/viewjs/taskcategories.js b/public/viewjs/taskcategories.js
index 16732e64..d3953b43 100644
--- a/public/viewjs/taskcategories.js
+++ b/public/viewjs/taskcategories.js
@@ -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');
diff --git a/public/viewjs/taskcategoryform.js b/public/viewjs/taskcategoryform.js
index 9658a745..3a2bbb0d 100644
--- a/public/viewjs/taskcategoryform.js
+++ b/public/viewjs/taskcategoryform.js
@@ -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
{
diff --git a/public/viewjs/tasks.js b/public/viewjs/tasks.js
index b01ff5d2..7e93c03d 100644
--- a/public/viewjs/tasks.js
+++ b/public/viewjs/tasks.js
@@ -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))
{
diff --git a/public/viewjs/transfer.js b/public/viewjs/transfer.js
index bc3dc3bf..f09bc165 100644
--- a/public/viewjs/transfer.js
+++ b/public/viewjs/transfer.js
@@ -1,4 +1,4 @@
-$('#save-transfer-button').on('click', function (e)
+$('#save-transfer-button').on('click', function(e)
{
e.preventDefault();
@@ -33,14 +33,14 @@
var jsonDataBarcode = {};
jsonDataBarcode.barcode = addBarcode;
jsonDataBarcode.product_id = jsonForm.product_id;
- jsonDataBarcode.qu_factor_purchase_to_stock = productDetails.product.qu_factor_purchase_to_stock;
+ jsonDataBarcode.qu_factor_purchase_to_stock = productDetails.product.qu_factor_purchase_to_stock;
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
function(result)
{
$("#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()) + '
' + __t("Undo") + '';
+ 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()) + '
' + __t("Undo") + '';
}
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()) + '
' + __t("Undo") + '';
+ 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()) + '
' + __t("Undo") + '';
}
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;
@@ -346,7 +347,7 @@ $("#specific_stock_entry").on("change", function(e)
{
if ($(e.target).val() == "")
{
- var sumValue = 0;
+ var sumValue = 0;
Grocy.Api.Get("stock/products/" + Grocy.Components.ProductPicker.GetValue() + '/entries',
function(stockEntries)
{
@@ -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);
}
diff --git a/public/viewjs/userentities.js b/public/viewjs/userentities.js
index c26dc1b9..74bbaf98 100644
--- a/public/viewjs/userentities.js
+++ b/public/viewjs/userentities.js
@@ -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');
diff --git a/public/viewjs/userfields.js b/public/viewjs/userfields.js
index 648126d7..5d5c2711 100644
--- a/public/viewjs/userfields.js
+++ b/public/viewjs/userfields.js
@@ -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');
diff --git a/public/viewjs/userform.js b/public/viewjs/userform.js
index 9f1ac734..65818d01 100644
--- a/public/viewjs/userform.js
+++ b/public/viewjs/userform.js
@@ -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
{
diff --git a/public/viewjs/userobjects.js b/public/viewjs/userobjects.js
index 5b348e1a..5a0f92e8 100644
--- a/public/viewjs/userobjects.js
+++ b/public/viewjs/userobjects.js
@@ -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();
diff --git a/public/viewjs/userpermissions.js b/public/viewjs/userpermissions.js
index d5196dea..cc2c9933 100644
--- a/public/viewjs/userpermissions.js
+++ b/public/viewjs/userpermissions.js
@@ -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) {
- toastr.success(__t("Permissions saved"));
- }, function (xhr) {
- toastr.error(__t(JSON.parse(xhr.response).error_message));
- }
+ 'permissions': permission_list,
+ }, function(result)
+ {
+ toastr.success(__t("Permissions saved"));
+ }, 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);
}
diff --git a/public/viewjs/users.js b/public/viewjs/users.js
index b3961be5..d0d4c675 100644
--- a/public/viewjs/users.js
+++ b/public/viewjs/users.js
@@ -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');