diff --git a/public/js/grocy.js b/public/js/grocy.js index 41567e42..bbc21578 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -542,7 +542,16 @@ ResizeResponsiveEmbeds = function() { $("iframe.embed-responsive").each(function() { - $(this).attr("height", $(this)[0].contentWindow.document.body.scrollHeight.toString() + "px"); + var iframeBody = $(this)[0].contentWindow.document.body; + if (iframeBody) + { + $(this).attr("height", iframeBody.scrollHeight.toString() + "px"); + } + + if ($("body").hasClass("fullscreen-card")) + { + $(this).attr("height", $("body").height().toString() + "px"); + } }); var maxHeight = $("body").height() - $("#mainNav").outerHeight() - 62; @@ -550,7 +559,7 @@ ResizeResponsiveEmbeds = function() { maxHeight = $("body").height(); } - $("embed.embed-responsive").attr("height", maxHeight.toString() + "px"); + $("embed.embed-responsive:not(.resize-done)").attr("height", maxHeight.toString() + "px").addClass("resize-done"); } $(window).on("resize", function() { @@ -564,6 +573,10 @@ $(document).on("shown.bs.modal", function(e) { ResizeResponsiveEmbeds(); }); +$(document).on("hidden.bs.modal", function(e) +{ + $("body").removeClass("fullscreen-card"); +}); $("body").children().each(function(index, child) { new ResizeObserver(function() @@ -705,8 +718,8 @@ if (Grocy.CalendarFirstDayOfWeek) if (GetUriParam("embedded")) { - $("body").append('
\ - \ @@ -737,7 +750,7 @@ $(window).on("message", function(e) } else if (data.Message == "CloseLastModal") { - $(".modal").last().modal("hide"); + $(".modal:visible").last().modal("hide"); } else if (data.Message == "ResizeResponsiveEmbeds") { @@ -753,11 +766,15 @@ $(window).on("message", function(e) } else if (data.Message == "BroadcastMessage") { - // data.Payload is the original WindowMessageBag => distribute to this window + all child iframes + // data.Payload is the original WindowMessageBag + + // => Send the original message to this window window.postMessage(data.Payload, Grocy.BaseUrl); + + // => Bubble the broadcast message down to all child iframes $("iframe.embed-responsive").each(function() { - $(this)[0].contentWindow.postMessage(data.Payload, Grocy.BaseUrl); + $(this)[0].contentWindow.postMessage(data, Grocy.BaseUrl); }); } }); diff --git a/public/viewjs/batteryform.js b/public/viewjs/batteryform.js index b258a858..3e6446d0 100644 --- a/public/viewjs/batteryform.js +++ b/public/viewjs/batteryform.js @@ -107,5 +107,5 @@ Grocy.Components.UserfieldsForm.Load(); setTimeout(function() { $('#name').focus(); -}, 150); +}, 200); Grocy.FrontendHelpers.ValidateForm('battery-form'); diff --git a/public/viewjs/choreform.js b/public/viewjs/choreform.js index 3d11733e..31448be8 100644 --- a/public/viewjs/choreform.js +++ b/public/viewjs/choreform.js @@ -141,7 +141,7 @@ setTimeout(function() $("#consume_product_on_execution").click(); Grocy.Components.ProductPicker.GetPicker().trigger('change'); -}, 100); +}, 200); $('.input-group-chore-period-type').on('change keyup', function(e) { diff --git a/public/viewjs/choresjournal.js b/public/viewjs/choresjournal.js index 8d7c3dd4..14f92031 100644 --- a/public/viewjs/choresjournal.js +++ b/public/viewjs/choresjournal.js @@ -43,11 +43,15 @@ $("#search").on("keyup", Delay(function() $("#clear-filter-button").on("click", function() { $("#search").val(""); - $("#chore-filter").val("all"); $("#daterange-filter").val("24"); - RemoveUriParam("months"); - RemoveUriParam("chore"); + + if (GetUriParam("embedded") === undefined) + { + $("#chore-filter").val("all"); + RemoveUriParam("chore"); + } + window.location.reload(); }); diff --git a/public/viewjs/consume.js b/public/viewjs/consume.js index e550a6c3..c4834460 100644 --- a/public/viewjs/consume.js +++ b/public/viewjs/consume.js @@ -495,7 +495,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e) setTimeout(function() { $('#display_amount').focus(); - }, 150); + }, 200); if (productDetails.stock_amount == productDetails.stock_amount_opened || productDetails.product.enable_tare_weight_handling == 1) { diff --git a/public/viewjs/equipment.js b/public/viewjs/equipment.js index 921104d1..25d87dda 100644 --- a/public/viewjs/equipment.js +++ b/public/viewjs/equipment.js @@ -159,6 +159,7 @@ $(".selectedEquipmentInstructionManualToggleFullscreenButton").on('click', funct card.find(".card-header").toggleClass("fixed-top"); card.find(".card-body").toggleClass("mt-5"); $("body").toggleClass("fullscreen-card"); + $("embed.embed-responsive").removeClass("resize-done"); ResizeResponsiveEmbeds(); }); diff --git a/public/viewjs/inventory.js b/public/viewjs/inventory.js index 67ebe15d..602f6fb6 100644 --- a/public/viewjs/inventory.js +++ b/public/viewjs/inventory.js @@ -314,7 +314,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e) setTimeout(function() { $('#display_amount').focus(); - }, 150); + }, 200); $('#display_amount').trigger('keyup'); RefreshPriceHint(); }, diff --git a/public/viewjs/locationform.js b/public/viewjs/locationform.js index a58565f4..6314188d 100644 --- a/public/viewjs/locationform.js +++ b/public/viewjs/locationform.js @@ -93,4 +93,4 @@ Grocy.FrontendHelpers.ValidateForm('location-form'); setTimeout(function() { $('#name').focus(); -}, 150); +}, 200); diff --git a/public/viewjs/mealplan.js b/public/viewjs/mealplan.js index 1181bc8d..df35c092 100644 --- a/public/viewjs/mealplan.js +++ b/public/viewjs/mealplan.js @@ -927,6 +927,8 @@ $(document).on("click", ".display-recipe-button", function(e) Grocy.Api.Put('objects/recipes/' + objectId, { "desired_servings": servings }, function(result) { + $("body").addClass("fullscreen-card"); + bootbox.dialog({ message: '', size: 'extra-large', diff --git a/public/viewjs/productbarcodeform.js b/public/viewjs/productbarcodeform.js index 86960db1..ad59b59b 100644 --- a/public/viewjs/productbarcodeform.js +++ b/public/viewjs/productbarcodeform.js @@ -99,7 +99,7 @@ Grocy.FrontendHelpers.ValidateForm('barcode-form'); setTimeout(function() { $('#barcode').focus(); -}, 150); +}, 200); RefreshLocaleNumberInput(); Grocy.Components.UserfieldsForm.Load() diff --git a/public/viewjs/productgroupform.js b/public/viewjs/productgroupform.js index dc33e5b6..9057279b 100644 --- a/public/viewjs/productgroupform.js +++ b/public/viewjs/productgroupform.js @@ -78,5 +78,5 @@ Grocy.Components.UserfieldsForm.Load(); setTimeout(function() { $('#name').focus(); -}, 150); +}, 200); Grocy.FrontendHelpers.ValidateForm('product-group-form'); diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js index 7234c4e3..393eae2d 100644 --- a/public/viewjs/purchase.js +++ b/public/viewjs/purchase.js @@ -346,7 +346,7 @@ if (Grocy.Components.ProductPicker !== undefined) setTimeout(function() { $('#display_amount').focus(); - }, 150); + }, 200); Grocy.FrontendHelpers.ValidateForm('purchase-form'); if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && Grocy.FrontendHelpers.ValidateForm("purchase-form")) diff --git a/public/viewjs/recipeposform.js b/public/viewjs/recipeposform.js index 97564c09..83475a16 100644 --- a/public/viewjs/recipeposform.js +++ b/public/viewjs/recipeposform.js @@ -124,14 +124,14 @@ if (!Grocy.Components.ProductPicker.InAnyFlow()) setTimeout(function() { $("#display_amount").focus(); - }, 150); + }, 200); } else { setTimeout(function() { Grocy.Components.ProductPicker.GetInputElement().focus(); - }, 150); + }, 200); } } else @@ -143,7 +143,7 @@ else setTimeout(function() { Grocy.Components.ProductPicker.GetInputElement().focus(); - }, 150); + }, 200); } } diff --git a/public/viewjs/recipes.js b/public/viewjs/recipes.js index e0f7fd36..78ab5297 100644 --- a/public/viewjs/recipes.js +++ b/public/viewjs/recipes.js @@ -290,6 +290,8 @@ recipesTables.on('select', function(e, dt, type, indexes) } else { + $("body").addClass("fullscreen-card"); + bootbox.dialog({ message: '', size: 'extra-large', @@ -322,6 +324,8 @@ $(".recipe-gallery-item").on("click", function(e) } else { + $("body").addClass("fullscreen-card"); + bootbox.dialog({ message: '', size: 'extra-large', diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index e5189e1b..71d08bdf 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -272,6 +272,7 @@ $(document).on('click', '#add-all-items-to-stock-button', function(e) Grocy.ShoppingListAddToStockButtonList = $(".shopping-list-stock-add-workflow-list-item-button"); Grocy.ShoppingListToStockWorkflowCount = Grocy.ShoppingListAddToStockButtonList.length; Grocy.ShoppingListToStockWorkflowCurrent++; + $("#shopping-list-stock-add-workflow-modal .modal-footer").removeClass("d-none"); $(".shopping-list-stock-add-workflow-list-item-button").first().click(); }); @@ -281,6 +282,7 @@ $("#shopping-list-stock-add-workflow-modal").on("hidden.bs.modal", function(e) Grocy.ShoppingListToStockWorkflowCount = 0; Grocy.ShoppingListToStockWorkflowCurrent = 0; Grocy.ShoppingListAddToStockButtonList = []; + $("#shopping-list-stock-add-workflow-modal .modal-footer").addClass("d-none"); }) $(window).on("message", function(e) @@ -445,6 +447,7 @@ $(document).on("click", "#print-shopping-list-button", function(e) title: __t('Printing'), message: '

' + __t('Connecting to printer...') + '

' }); + //Delaying for one second so that the alert can be closed setTimeout(function() { diff --git a/public/viewjs/shoppinglistform.js b/public/viewjs/shoppinglistform.js index bf17ea70..7dd38bdf 100644 --- a/public/viewjs/shoppinglistform.js +++ b/public/viewjs/shoppinglistform.js @@ -82,5 +82,5 @@ Grocy.Components.UserfieldsForm.Load(); setTimeout(function() { $('#name').focus(); -}, 150); +}, 200); Grocy.FrontendHelpers.ValidateForm('shopping-list-form'); diff --git a/public/viewjs/shoppinglistitemform.js b/public/viewjs/shoppinglistitemform.js index 3f17999b..a008796c 100644 --- a/public/viewjs/shoppinglistitemform.js +++ b/public/viewjs/shoppinglistitemform.js @@ -213,7 +213,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e) setTimeout(function() { $('#display_amount').focus(); - }, 150); + }, 300); Grocy.FrontendHelpers.ValidateForm('shoppinglist-form'); Grocy.ShoppingListItemFormInitialLoadDone = true; }, @@ -292,14 +292,14 @@ if (!Grocy.Components.ProductPicker.InAnyFlow()) setTimeout(function() { $("#display_amount").focus(); - }, 150); + }, 300); } else { setTimeout(function() { Grocy.Components.ProductPicker.GetInputElement().focus(); - }, 150); + }, 200); } } else @@ -311,7 +311,7 @@ else setTimeout(function() { Grocy.Components.ProductPicker.GetInputElement().focus(); - }, 150); + }, 200); } } diff --git a/public/viewjs/shoppinglocationform.js b/public/viewjs/shoppinglocationform.js index ba3bc05e..4b0e5ebd 100644 --- a/public/viewjs/shoppinglocationform.js +++ b/public/viewjs/shoppinglocationform.js @@ -92,5 +92,5 @@ Grocy.Components.UserfieldsForm.Load(); setTimeout(function() { $('#name').focus(); -}, 150); +}, 200); Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form'); diff --git a/public/viewjs/stockentries.js b/public/viewjs/stockentries.js index 75bcf0cc..799f0b52 100644 --- a/public/viewjs/stockentries.js +++ b/public/viewjs/stockentries.js @@ -31,7 +31,12 @@ $("#clear-filter-button").on("click", function() { $("#location-filter").val("all"); $("#location-filter").trigger("change"); - Grocy.Components.ProductPicker.Clear(); + + if (GetUriParam("embedded") === undefined) + { + Grocy.Components.ProductPicker.Clear(); + } + stockEntriesTable.draw(); }); @@ -311,11 +316,7 @@ $(window).on("message", function(e) { var data = e.originalEvent.data; - if (data.Message == "StockEntryChanged") - { - RefreshStockEntryRow(data.Payload); - } - else if (data.Message == "ProductChanged") + if (data.Message == "ProductChanged") { window.location.reload(); } @@ -328,7 +329,6 @@ function UndoStockBookingEntry(bookingId, stockRowId, productId) Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {}, function(result) { - window.top.postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("StockEntryChanged", stockRowId)), Grocy.BaseUrl); window.top.postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", productId)), Grocy.BaseUrl); toastr.success(__t("Booking successfully undone")); }, diff --git a/public/viewjs/stockentryform.js b/public/viewjs/stockentryform.js index 650dc055..366a2d4e 100644 --- a/public/viewjs/stockentryform.js +++ b/public/viewjs/stockentryform.js @@ -62,7 +62,6 @@ { var successMessage = __t('Stock entry successfully updated') + '
' + __t("Undo") + ''; - window.top.postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("StockEntryChanged", Grocy.EditObjectRowId)), Grocy.BaseUrl); window.top.postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", Grocy.EditObjectProductId)), Grocy.BaseUrl); window.parent.postMessage(WindowMessageBag("ShowSuccessMessage", successMessage), Grocy.BaseUrl); window.parent.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl); @@ -149,5 +148,5 @@ Grocy.Components.UserfieldsForm.Load(); setTimeout(function() { $('#amount').focus(); -}, 150); +}, 200); Grocy.FrontendHelpers.ValidateForm("stockentry-form"); diff --git a/public/viewjs/stockjournal.js b/public/viewjs/stockjournal.js index 2c0fd741..54d32266 100644 --- a/public/viewjs/stockjournal.js +++ b/public/viewjs/stockjournal.js @@ -82,11 +82,15 @@ $("#clear-filter-button").on("click", function() $("#transaction-type-filter").val("all"); $("#location-filter").val("all"); $("#user-filter").val("all"); - $("#product-filter").val("all"); $("#daterange-filter").val("6"); - RemoveUriParam("months"); - RemoveUriParam("product"); + + if (GetUriParam("embedded") === undefined) + { + RemoveUriParam("product"); + $("#product-filter").val("all"); + } + window.location.reload(); }); diff --git a/public/viewjs/taskcategoryform.js b/public/viewjs/taskcategoryform.js index 727de55f..3ed29e70 100644 --- a/public/viewjs/taskcategoryform.js +++ b/public/viewjs/taskcategoryform.js @@ -92,5 +92,5 @@ Grocy.Components.UserfieldsForm.Load(); setTimeout(function() { $('#name').focus(); -}, 150); +}, 200); Grocy.FrontendHelpers.ValidateForm('task-category-form'); diff --git a/public/viewjs/taskform.js b/public/viewjs/taskform.js index fd6b1ee5..769fefd0 100644 --- a/public/viewjs/taskform.js +++ b/public/viewjs/taskform.js @@ -112,6 +112,6 @@ Grocy.Components.UserfieldsForm.Load(); setTimeout(function() { $('#name').focus(); -}, 150); +}, 200); Grocy.Components.DateTimePicker.GetInputElement().trigger('input'); Grocy.FrontendHelpers.ValidateForm('task-form'); diff --git a/public/viewjs/transfer.js b/public/viewjs/transfer.js index 86549b74..906fe76e 100644 --- a/public/viewjs/transfer.js +++ b/public/viewjs/transfer.js @@ -283,7 +283,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e) setTimeout(function() { $('#display_amount').focus(); - }, 150); + }, 200); }, function(xhr) { diff --git a/public/viewjs/userentityform.js b/public/viewjs/userentityform.js index 0b1ea86b..9f5151c0 100644 --- a/public/viewjs/userentityform.js +++ b/public/viewjs/userentityform.js @@ -103,7 +103,7 @@ $("#show_in_sidebar_menu").on("click", function() setTimeout(function() { $('#name').focus(); -}, 150); +}, 200); Grocy.FrontendHelpers.ValidateForm('userentity-form'); // Click twice to trigger on-click but not change the actual checked state diff --git a/views/about.blade.php b/views/about.blade.php index 254cdfd6..b9cfe19d 100644 --- a/views/about.blade.php +++ b/views/about.blade.php @@ -4,7 +4,7 @@ @section('content')
-
+

@yield('title')


diff --git a/views/batteries.blade.php b/views/batteries.blade.php index 1e518305..90325ea9 100644 --- a/views/batteries.blade.php +++ b/views/batteries.blade.php @@ -9,7 +9,7 @@