From 7e848f154816b1b84434962cf0f2722b84dae9a2 Mon Sep 17 00:00:00 2001 From: Gustavo Luigi Date: Tue, 30 Aug 2022 11:36:00 +0200 Subject: [PATCH] . --- content/master.blade.php | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/content/master.blade.php b/content/master.blade.php index b8a19a6..8371e5f 100644 --- a/content/master.blade.php +++ b/content/master.blade.php @@ -1,6 +1,7 @@ + @insert("content.includes.meta") @insert("content.includes.css") @yield('head') @@ -103,9 +104,10 @@ let objProducts = []; function updateProductsInLocalStorage(){ localStorage.setItem("products", JSON.stringify(objProducts)); + $('#count-products-in-bag').text(objProducts.length); if(objProducts.length > 0) { - $.get("{{url('/contents/all')}}/"+objProducts.join(","), function(response, status){ - $('#count-products-in-bag').text(response.contents.length); + $('#count-products-in-bag').show(); + $.get($('meta[name="get-contents"]').attr('content')+"/"+objProducts.join(","), function(response, status){ $('#list-products-in-bag').html(''); response.contents.forEach(function(item){ $('#list-products-in-bag').append(` @@ -123,7 +125,6 @@ - Löschen 18,00€ `); @@ -132,43 +133,12 @@ }else $('#count-products-in-bag').hide(); } function addToBag(productId){ - if(objProducts.indexOf(productId) == -1) objProducts.push(productId); + if(objProducts.indexOf(productId) == -1) objProducts.push(productId+':'+1); updateProductsInLocalStorage(); } $(window).on('load', function(){ if(localStorage.getItem("products") != null) objProducts = JSON.parse(localStorage.getItem("products")); -<<<<<<< HEAD - $.get("{{url('/contents/all')}}/"+objProducts.join(","), function(response, status){ - $('#count-products-in-bag').text(response.contents.length); - if(response.contents.length > 0) response.contents.forEach(function(item){ - $('#list-products-in-bag').append(` - - - - - - ${item.title} -
- sofort verfügbar -
- - Löschen -ds - - 18,00€ -
- - `); - }); - else $('#count-products-in-bag').hide(); - }); -======= updateProductsInLocalStorage(); ->>>>>>> e4497e2d3c22ce5756190e6ee74fbeb1d9d09fad }); @yield('scripts')