diff --git a/public/viewjs/batteriesoverview.js b/public/viewjs/batteriesoverview.js index 5f07d238..fc18880f 100644 --- a/public/viewjs/batteriesoverview.js +++ b/public/viewjs/batteriesoverview.js @@ -114,12 +114,6 @@ $(document).on('click', '.track-charge-cycle-button', function(e) ); }); -$(document).on("click", ".battery-name-cell", function(e) -{ - Grocy.Components.BatteryCard.Refresh($(e.currentTarget).attr("data-battery-id")); - $("#batteriesoverview-batterycard-modal").modal("show"); -}); - $(document).on('click', '.battery-grocycode-label-print', function(e) { e.preventDefault(); diff --git a/public/viewjs/choresoverview.js b/public/viewjs/choresoverview.js index b09757de..1de9ca52 100644 --- a/public/viewjs/choresoverview.js +++ b/public/viewjs/choresoverview.js @@ -210,12 +210,6 @@ $(document).on('click', '.track-chore-button', function(e) ); }); -$(document).on("click", ".chore-name-cell", function(e) -{ - Grocy.Components.ChoreCard.Refresh($(e.currentTarget).attr("data-chore-id")); - $("#choresoverview-chorecard-modal").modal("show"); -}); - $(document).on('click', '.chore-grocycode-label-print', function(e) { e.preventDefault(); diff --git a/public/viewjs/components/batterycard.js b/public/viewjs/components/batterycard.js index 6533628d..37120200 100644 --- a/public/viewjs/components/batterycard.js +++ b/public/viewjs/components/batterycard.js @@ -24,3 +24,9 @@ Grocy.Components.BatteryCard.Refresh = function(batteryId) } ); }; + +$(document).on("click", ".batterycard-trigger", function(e) +{ + Grocy.Components.BatteryCard.Refresh($(e.currentTarget).attr("data-battery-id")); + $("#batterycard-modal").modal("show"); +}); diff --git a/public/viewjs/components/chorecard.js b/public/viewjs/components/chorecard.js index 318a865e..200dfe2b 100644 --- a/public/viewjs/components/chorecard.js +++ b/public/viewjs/components/chorecard.js @@ -48,3 +48,9 @@ Grocy.Components.ChoreCard.Refresh = function(choreId) } ); }; + +$(document).on("click", ".chorecard-trigger", function(e) +{ + Grocy.Components.ChoreCard.Refresh($(e.currentTarget).attr("data-chore-id")); + $("#chorecard-modal").modal("show"); +}); diff --git a/public/viewjs/components/productcard.js b/public/viewjs/components/productcard.js index 3a52ee3f..970c3467 100644 --- a/public/viewjs/components/productcard.js +++ b/public/viewjs/components/productcard.js @@ -265,3 +265,13 @@ $("#productcard-product-description").on("hidden.bs.collapse", function() { $(".expandable-text").find("a[data-toggle='collapse']").text(__t("Show more")); }) + +$(document).on("click", ".productcard-trigger", function(e) +{ + var productId = $(e.currentTarget).attr("data-product-id"); + if (productId != "") + { + Grocy.Components.ProductCard.Refresh(productId); + $("#productcard-modal").modal("show"); + } +}); diff --git a/public/viewjs/mealplan.js b/public/viewjs/mealplan.js index 4fc6fa9f..05a3dbc8 100644 --- a/public/viewjs/mealplan.js +++ b/public/viewjs/mealplan.js @@ -264,7 +264,7 @@ $(".calendar").each(function() element.html('\
\ - \ + \
' + mealPlanEntry.product_amount + " " + __n(mealPlanEntry.product_amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural, true) + '
\
' + fulfillmentIconHtml + " " + fulfillmentInfoHtml + '
\ ' + costsAndCaloriesPerServing + ' \ @@ -951,14 +951,6 @@ $(document).on("click", ".display-recipe-button", function(e) ); }); -$(document).on("click", ".display-product-button", function(e) -{ - $(".tooltip").tooltip("hide"); - - Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr('data-product-id')); - $("#mealplan-productcard-modal").modal("show"); -}); - $(document).on("click", ".mealplan-entry-done-button", function(e) { e.preventDefault(); diff --git a/public/viewjs/products.js b/public/viewjs/products.js index 7f87be52..3d91986e 100644 --- a/public/viewjs/products.js +++ b/public/viewjs/products.js @@ -175,9 +175,3 @@ $("#merge-products-save-button").on("click", function(e) } ); }); - -$(document).on("click", ".product-name-cell", function(e) -{ - Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id")); - $("#productcard-modal").modal("show"); -}); diff --git a/public/viewjs/recipeposform.js b/public/viewjs/recipeposform.js index 316ffe06..c7174980 100644 --- a/public/viewjs/recipeposform.js +++ b/public/viewjs/recipeposform.js @@ -58,8 +58,6 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e) if (productId) { - Grocy.Components.ProductCard.Refresh(productId); - Grocy.Api.Get('stock/products/' + productId, function(productDetails) { diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index 67c0cec9..27bbe8a2 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -145,15 +145,6 @@ $(document).on('click', '.shoppinglist-delete-button', function(e) ); }); -$(document).on("click", ".product-name-cell", function(e) -{ - if ($(e.currentTarget).attr("data-product-id") != "") - { - Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id")); - $("#shoppinglist-productcard-modal").modal("show"); - } -}); - $(document).on('click', '#add-products-below-min-stock-amount', function(e) { Grocy.Api.Post('stock/shoppinglist/add-missing-products', { "list_id": $("#selected-shopping-list").val() }, diff --git a/public/viewjs/stockentries.js b/public/viewjs/stockentries.js index 649b69c3..22891de0 100644 --- a/public/viewjs/stockentries.js +++ b/public/viewjs/stockentries.js @@ -151,12 +151,6 @@ $(document).on('click', '.product-open-button', function(e) ); }); -$(document).on("click", ".stock-name-cell", function(e) -{ - Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-stock-id")); - $("#stockentry-productcard-modal").modal("show"); -}); - $(document).on('click', '.stockentry-grocycode-label-print', function(e) { e.preventDefault(); @@ -337,9 +331,3 @@ function UndoStockBookingEntry(bookingId, stockRowId) } ); }; - -$(document).on("click", ".product-name-cell", function(e) -{ - Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id")); - $("#productcard-modal").modal("show"); -}); diff --git a/public/viewjs/stockjournal.js b/public/viewjs/stockjournal.js index 5d36a35a..2c0fd741 100644 --- a/public/viewjs/stockjournal.js +++ b/public/viewjs/stockjournal.js @@ -144,9 +144,3 @@ $(document).on('click', '.product-grocycode-label-print', function(e) } }); }); - -$(document).on("click", ".product-name-cell", function(e) -{ - Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id")); - $("#stockjournal-productcard-modal").modal("show"); -}); diff --git a/public/viewjs/stockoverview.js b/public/viewjs/stockoverview.js index 8ebd0d8b..fb7159b4 100755 --- a/public/viewjs/stockoverview.js +++ b/public/viewjs/stockoverview.js @@ -229,12 +229,6 @@ $(document).on('click', '.product-open-button', function(e) ); }); -$(document).on("click", ".product-name-cell", function(e) -{ - Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id")); - $("#stockoverview-productcard-modal").modal("show"); -}); - function RefreshStatistics() { Grocy.Api.Get('stock', diff --git a/views/batteriesoverview.blade.php b/views/batteriesoverview.blade.php index f865b643..1abadfbd 100644 --- a/views/batteriesoverview.blade.php +++ b/views/batteriesoverview.blade.php @@ -129,7 +129,7 @@
- {{ FindObjectInArrayByPropertyValue($batteries, 'id', $currentBatteryEntry->battery_id)->name }} @@ -204,20 +204,7 @@ - +@include('components.batterycard', [ +'asModal' => true +]) @stop diff --git a/views/choresoverview.blade.php b/views/choresoverview.blade.php index cf6d177b..0d498680 100644 --- a/views/choresoverview.blade.php +++ b/views/choresoverview.blade.php @@ -174,7 +174,7 @@ {{ $__t('Reschedule next execution') }} - @@ -207,7 +207,7 @@ - {{ FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name }} @@ -286,22 +286,9 @@ - +@include('components.chorecard', [ +'asModal' => true +]) - -
- @include('components.productcard') -
@stop diff --git a/views/shoppinglist.blade.php b/views/shoppinglist.blade.php index d7ee0249..394f5616 100644 --- a/views/shoppinglist.blade.php +++ b/views/shoppinglist.blade.php @@ -227,7 +227,7 @@ - @if(!empty($listItem->product_id)) {{ $listItem->product_name }}
@endif{!! nl2br($listItem->note ?? '') !!} @@ -426,20 +426,8 @@ - + +@include('components.productcard', [ +'asModal' => true +]) @stop diff --git a/views/stockentries.blade.php b/views/stockentries.blade.php index e81206a2..f8e84037 100644 --- a/views/stockentries.blade.php +++ b/views/stockentries.blade.php @@ -199,7 +199,7 @@ @endif - @@ -247,7 +247,7 @@ data-product-id="{{ $stockEntry->product_id }}"> {{ $stockEntry->product_id }} - {{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }} @@ -319,20 +319,7 @@ - +@include('components.productcard', [ +'asModal' => true +]) @stop diff --git a/views/stockjournal.blade.php b/views/stockjournal.blade.php index 03bfb387..c672a89c 100644 --- a/views/stockjournal.blade.php +++ b/views/stockjournal.blade.php @@ -217,7 +217,7 @@ @endif - @@ -256,7 +256,7 @@ - {{ $stockLogEntry->product_name }} @if($stockLogEntry->undone == 1) @@ -301,20 +301,7 @@ - +@include('components.productcard', [ +'asModal' => true +]) @stop diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index 5c55dda2..325a27a6 100755 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -279,7 +279,7 @@ @endif - @@ -323,7 +323,7 @@ - {{ $currentStockEntry->product_name }} {{ $currentStockEntry->product_barcodes }} @@ -428,7 +428,7 @@ {!! $currentStockEntry->product_description !!} - {{ $currentStockEntry->parent_product_name }} @@ -465,20 +465,7 @@ - +@include('components.productcard', [ +'asModal' => true +]) @stop