Gustavo Luigi 2022-09-01 16:49:45 +02:00
parent 5321304dde
commit f15af3bae0
1 changed files with 14 additions and 10 deletions

View File

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

@ -75,7 +74,6 @@
</div>
<!-- Calendly inline widget end -->
</div>
=======
<div style="display: none;" class="col-12 text-center" id="no-products-in-checkout">
<br>
<br>
@ -94,9 +92,8 @@
<br>
<div class="alert alert-success">{{session()->get('success')}}</div>
<br>
>>>>>>> 34c1696f24b5a829bac5e7a90220349835cf2765
@else
<section>
<section id="form-section" style="display: none;">
<div class="row">
<div class="col-12">
<h1 class="mb-5">Angebot anfragen</h1>
@ -250,7 +247,7 @@
}
function initialize() {
let input = document.getElementById('field_location');
let options = {
let options = {
types: ['address'],
componentRestrictions: { country: "de" }
};
@ -306,8 +303,9 @@
},
utilsScript: "{{storage('assets/libs/intl-tel-input/js/utils.min.js')}}",
});
$(window).on('load', function(){

function updateProducts(){
$('#list-products').html('');
if(objProducts.length > 0) {
let ids = objProducts.map(obj => obj.id);
$.get($('meta[name="get-contents"]').attr('content')+"/"+ids.join(","), function(response, status){
@ -328,30 +326,36 @@
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);
$('#list-products').append(elementProduct);
});
$('#total-price').text(formatter.format(totalPrice));
$('#total-checkout-price').text(formatter.format(totalPrice));
});
$('#form-section').show();
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').show();
$('#total-checkout-price').parent().parent().parent().show();
$('#no-products-in-checkout').hide();
}else {
$('#form-section').hide();
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide();
$('#total-checkout-price').parent().parent().parent().hide();
$('#no-products-in-checkout').show();
}
}

$(window).on('load', function(){
updateProducts();
$('#anfrage').submit(function(){
objProducts = [];
updateProductsInLocalStorage();
});
$(document).on('click', '.btn-remove-product', function(){ updateProducts(); });
$(document).on('change', '.select-quantity', function(){ updateProducts(); });
});
</script>
@stop