From 4b5b7bcb19a149b4ff5aaed136ed766ca978f5e9 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Mon, 14 Sep 2020 11:20:29 +0200 Subject: [PATCH] Applied formatting rules for by #1000 changed files --- controllers/GenericEntityApiController.php | 2 +- public/js/grocy.js | 15 +++++++++------ public/viewjs/components/datetimepicker2.js | 6 +++--- public/viewjs/purchase.js | 5 +++-- services/CalendarService.php | 2 -- views/components/productpicker.blade.php | 10 +++++----- views/components/shoppinglocationpicker.blade.php | 3 ++- 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/controllers/GenericEntityApiController.php b/controllers/GenericEntityApiController.php index 9f2c59c4..320e537d 100644 --- a/controllers/GenericEntityApiController.php +++ b/controllers/GenericEntityApiController.php @@ -64,7 +64,7 @@ class GenericEntityApiController extends BaseApiController } else { - return $this->GenericErrorResponse($response, "Invalid entity"); + return $this->GenericErrorResponse($response, 'Invalid entity'); } } diff --git a/public/js/grocy.js b/public/js/grocy.js index f24f7d82..5d675dbe 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -670,13 +670,15 @@ $(Grocy.UserPermissions).each(function(index, item) $('.permission-' + item.permission_name).addClass('disabled').addClass('not-allowed'); } }); -$('a.link-return').not(".btn").each(function () { - var base = $(this).data('href'); - if(base.contains('?')) +$('a.link-return').not(".btn").each(function() +{ + var base = $(this).data('href'); + if (base.contains('?')) { $(this).attr('href', base + '&returnto' + encodeURIComponent(location.pathname)); } - else{ + else + { $(this).attr('href', base + '?returnto=' + encodeURIComponent(location.pathname)); } @@ -697,8 +699,9 @@ $(document).on("click", "a.btn.link-return", function(e) } }); -$('.dropdown-item').has('.form-check input[type=checkbox]').on('click', function (e) { - if($(e.target).is('div.form-check') || $(e.target).is('div.dropdown-item')) +$('.dropdown-item').has('.form-check input[type=checkbox]').on('click', function(e) +{ + if ($(e.target).is('div.form-check') || $(e.target).is('div.dropdown-item')) { $(e.target).find('input[type=checkbox]').click(); } diff --git a/public/viewjs/components/datetimepicker2.js b/public/viewjs/components/datetimepicker2.js index 8a730d09..6b1beb73 100644 --- a/public/viewjs/components/datetimepicker2.js +++ b/public/viewjs/components/datetimepicker2.js @@ -12,9 +12,6 @@ Grocy.Components.DateTimePicker2.GetValue = function() Grocy.Components.DateTimePicker2.SetValue = function(value) { - Grocy.Components.DateTimePicker2.GetInputElement().val(value); - Grocy.Components.DateTimePicker2.GetInputElement().trigger('change'); - // "Click" the shortcut checkbox when the desired value is // not the shortcut value and it is currently set var shortcutValue = $("#datetimepicker2-shortcut").data("datetimepicker2-shortcut-value"); @@ -23,6 +20,9 @@ Grocy.Components.DateTimePicker2.SetValue = function(value) $("#datetimepicker2-shortcut").click(); } + Grocy.Components.DateTimePicker2.GetInputElement().val(value); + Grocy.Components.DateTimePicker2.GetInputElement().trigger('change'); + Grocy.Components.DateTimePicker2.GetInputElement().keyup(); } diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js index 910711bf..d6e6632d 100644 --- a/public/viewjs/purchase.js +++ b/public/viewjs/purchase.js @@ -33,7 +33,8 @@ { jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue(); } - else { + else + { jsonData.best_before_date = null; } @@ -106,7 +107,7 @@ { Grocy.Components.LocationPicker.Clear(); } - if(Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) + if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) { Grocy.Components.DateTimePicker.Clear(); } diff --git a/services/CalendarService.php b/services/CalendarService.php index f90dab17..0108a5b0 100644 --- a/services/CalendarService.php +++ b/services/CalendarService.php @@ -123,7 +123,6 @@ class CalendarService extends BaseService $mealPlanDayNotes = $this->getDatabase()->meal_plan()->where('type', 'note'); $titlePrefix = $this->getLocalizationService()->__t('Meal plan note') . ': '; - foreach ($mealPlanDayNotes as $mealPlanDayNote) { $mealPlanNotesEvents[] = [ @@ -137,7 +136,6 @@ class CalendarService extends BaseService $mealPlanDayProducts = $this->getDatabase()->meal_plan()->where('type', 'product'); $titlePrefix = $this->getLocalizationService()->__t('Meal plan product') . ': '; - foreach ($mealPlanDayProducts as $mealPlanDayProduct) { $mealPlanProductEvents[] = [ diff --git a/views/components/productpicker.blade.php b/views/components/productpicker.blade.php index 587c34ae..a2253514 100644 --- a/views/components/productpicker.blade.php +++ b/views/components/productpicker.blade.php @@ -35,11 +35,11 @@ data-target="@productpicker"> @foreach($products as $product) - @php $bc = null; - if(isset($barcodes)) { - $bc = FindObjectInArrayByPropertyValue($barcodes, 'product_id', $product->id); - } - @endphp + @php $bc = null; + if(isset($barcodes)) { + $bc = FindObjectInArrayByPropertyValue($barcodes, 'product_id', $product->id); + } + @endphp @endforeach diff --git a/views/components/shoppinglocationpicker.blade.php b/views/components/shoppinglocationpicker.blade.php index d36bc116..17624786 100644 --- a/views/components/shoppinglocationpicker.blade.php +++ b/views/components/shoppinglocationpicker.blade.php @@ -12,7 +12,8 @@ data-next-input-selector="{{ $nextInputSelector }}" data-prefill-by-name="{{ $prefillByName }}" data-prefill-by-id="{{ $prefillById }}"> -