Benjamin Völkl 2022-09-01 16:48:41 +02:00
commit 5321304dde
1 changed files with 64 additions and 3 deletions

View File

@ -5,6 +5,7 @@
@stop
@section('content')
<div class="container">
<<<<<<< HEAD
@if(true)
<div class="row">

@ -74,6 +75,26 @@
</div>
<!-- Calendly inline widget end -->
</div>
=======
<div style="display: none;" class="col-12 text-center" id="no-products-in-checkout">
<br>
<br>
<br>
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
<lottie-player src="https://assets2.lottiefiles.com/packages/lf20_3VDN1k.json" background="transparent" speed="1" style="width: 150px; height: 150px; margin-left: 40%" loop autoplay></lottie-player>
<br>
<br>
<br>
<i>Es befinden sich keine Produkte im Warenkorb</i>
<br>
<br>
<br>
</div>
@if(session()->has('success'))
<br>
<div class="alert alert-success">{{session()->get('success')}}</div>
<br>
>>>>>>> 34c1696f24b5a829bac5e7a90220349835cf2765
@else
<section>
<div class="row">
@ -180,7 +201,8 @@
<tfoot>
<tr>
<th scope="col">Gesammt:</th>
<th colspan="2" class="text-end">2838,00 €
<th colspan="2" class="text-end">
<span id="total-checkout-price">0 €</span>
<br>
<small class="text-end fw-light">Preise inkl. 19% Umsatzsteuer</small>
</th>
@ -273,9 +295,7 @@
});
});
}

$(window).on('load', google.maps.event, initialize);

let input = document.querySelector("#ctelefon");
let iti = window.intlTelInput(input, {
initialCountry: "de", geoIpLookup: function(callback) {
@ -287,6 +307,47 @@
utilsScript: "{{storage('assets/libs/intl-tel-input/js/utils.min.js')}}",
});
$(window).on('load', function(){
if(objProducts.length > 0) {
let ids = objProducts.map(obj => obj.id);
$.get($('meta[name="get-contents"]').attr('content')+"/"+ids.join(","), function(response, status){
response.contents.forEach(function(item){
let objProductInfo = objProducts.find(obj => obj.id == item.id);
let elementProduct = `
<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 select-quantity" data-id="${item.id}" style="width:125px;" aria-label="Default select example">`;
for(let i = 1; i <= 5; i++){
if(objProductInfo.quantity == i) elementProduct += `<option selected value="${i}">Anzahl: ${i}</option>`;
else elementProduct += `<option value="${i}">Anzahl: ${i}</option>`;
}
totalPrice += item.data_fields.preis*objProductInfo.quantity;
elementProduct += `
</select>
<button data-id="${item.id}" class="btn-remove-product text-muted small text-decoration-none" style="padding: 0; border: none; background: transparen;">Löschen</button>
</td>
<td class="align-middle text-end">${formatter.format(item.data_fields.preis)}</td>
</tr>`;
$('#list-products-in-bag').append(elementProduct);
});
$('#total-price').text(formatter.format(totalPrice));
});
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').show();
$('#total-checkout-price').parent().parent().parent().show();
$('#no-products-in-checkout').hide();
}else {
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide();
$('#total-checkout-price').parent().parent().parent().hide();
$('#no-products-in-checkout').show();
}

$('#anfrage').submit(function(){
objProducts = [];
updateProductsInLocalStorage();