master
parent
73faccfe64
commit
7e848f1548
|
@ -1,6 +1,7 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="{{str_replace('_', '-', app()->getLocale())}}">
|
<html lang="{{str_replace('_', '-', app()->getLocale())}}">
|
||||||
<head>
|
<head>
|
||||||
|
<meta name="get-contents" content="{{url('/contents/all')}}">
|
||||||
@insert("content.includes.meta")
|
@insert("content.includes.meta")
|
||||||
@insert("content.includes.css")
|
@insert("content.includes.css")
|
||||||
@yield('head')
|
@yield('head')
|
||||||
|
@ -103,9 +104,10 @@
|
||||||
let objProducts = [];
|
let objProducts = [];
|
||||||
function updateProductsInLocalStorage(){
|
function updateProductsInLocalStorage(){
|
||||||
localStorage.setItem("products", JSON.stringify(objProducts));
|
localStorage.setItem("products", JSON.stringify(objProducts));
|
||||||
|
$('#count-products-in-bag').text(objProducts.length);
|
||||||
if(objProducts.length > 0) {
|
if(objProducts.length > 0) {
|
||||||
$.get("{{url('/contents/all')}}/"+objProducts.join(","), function(response, status){
|
$('#count-products-in-bag').show();
|
||||||
$('#count-products-in-bag').text(response.contents.length);
|
$.get($('meta[name="get-contents"]').attr('content')+"/"+objProducts.join(","), function(response, status){
|
||||||
$('#list-products-in-bag').html('');
|
$('#list-products-in-bag').html('');
|
||||||
response.contents.forEach(function(item){
|
response.contents.forEach(function(item){
|
||||||
$('#list-products-in-bag').append(`
|
$('#list-products-in-bag').append(`
|
||||||
|
@ -123,7 +125,6 @@
|
||||||
<option value="2">Anzahl: 2</option>
|
<option value="2">Anzahl: 2</option>
|
||||||
<option value="3">Anzahl: 3</option>
|
<option value="3">Anzahl: 3</option>
|
||||||
</select>
|
</select>
|
||||||
<a href="" class="text-muted small text-decoration-none">Löschen</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle text-end">18,00€</td>
|
<td class="align-middle text-end">18,00€</td>
|
||||||
</tr>`);
|
</tr>`);
|
||||||
|
@ -132,43 +133,12 @@
|
||||||
}else $('#count-products-in-bag').hide();
|
}else $('#count-products-in-bag').hide();
|
||||||
}
|
}
|
||||||
function addToBag(productId){
|
function addToBag(productId){
|
||||||
if(objProducts.indexOf(productId) == -1) objProducts.push(productId);
|
if(objProducts.indexOf(productId) == -1) objProducts.push(productId+':'+1);
|
||||||
updateProductsInLocalStorage();
|
updateProductsInLocalStorage();
|
||||||
}
|
}
|
||||||
$(window).on('load', function(){
|
$(window).on('load', function(){
|
||||||
if(localStorage.getItem("products") != null) objProducts = JSON.parse(localStorage.getItem("products"));
|
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(`
|
|
||||||
<tr>
|
|
||||||
<td class="text-start">
|
|
||||||
<img class="rounded img-fluid" src="https://picsum.photos/120/120">
|
|
||||||
</td>
|
|
||||||
<td class="text-start">
|
|
||||||
<span class="fs-5">${item.title}</span>
|
|
||||||
<br>
|
|
||||||
<small class="text-success">sofort verfügbar</small>
|
|
||||||
<br>
|
|
||||||
<select class="form-select form-select-sm" style="width:120px;" aria-label="Default select example">
|
|
||||||
<option selected value="1">Anzahl: 1</option>
|
|
||||||
<option value="2">Anzahl: 2</option>
|
|
||||||
<option value="3">Anzahl: 3</option>
|
|
||||||
</select>
|
|
||||||
<a href="" class="text-muted small text-decoration-none">Löschen</a>
|
|
||||||
ds
|
|
||||||
</td>
|
|
||||||
<td class="align-middle text-end">18,00€
|
|
||||||
<br>
|
|
||||||
</td>
|
|
||||||
</tr>`);
|
|
||||||
});
|
|
||||||
else $('#count-products-in-bag').hide();
|
|
||||||
});
|
|
||||||
=======
|
|
||||||
updateProductsInLocalStorage();
|
updateProductsInLocalStorage();
|
||||||
>>>>>>> e4497e2d3c22ce5756190e6ee74fbeb1d9d09fad
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@yield('scripts')
|
@yield('scripts')
|
||||||
|
|
Loading…
Reference in New Issue