master
parent
d8f461db80
commit
e16822912c
|
@ -10,7 +10,67 @@ function getAddressFiedlValue(addressComponents, $field){
|
|||
let field = addressComponents.find(obj => obj.types.indexOf($field) > -1);
|
||||
return field != undefined?field.long_name:'';
|
||||
}
|
||||
function initialize() {
|
||||
|
||||
let input = document.querySelector("#ctelefon");
|
||||
if(input != undefined){
|
||||
let iti = window.intlTelInput(input, {
|
||||
initialCountry: "de",
|
||||
preferredCountries: ["de"],
|
||||
geoIpLookup: function(callback) {
|
||||
$.get('https://ipinfo.io', function() {}, "jsonp").always(function(resp) {
|
||||
let countryCode = (resp && resp.country)?resp.country:"us";
|
||||
callback(countryCode);
|
||||
});
|
||||
},
|
||||
utilsScript: "/template/assets/libs/intl-tel-input/js/utils.min.js",
|
||||
});
|
||||
}
|
||||
function updateProducts(){
|
||||
$('#list-products').html('');
|
||||
if(objProducts.length > 0){
|
||||
getInfoFromSelectedProduct().done(function(response, status){
|
||||
response.contents.forEach(function(product){
|
||||
let objProduct = getProductInfo(product);
|
||||
let elementProduct = createProductElement(objProduct);
|
||||
$('#list-products').append(elementProduct);
|
||||
});
|
||||
$('#total-checkout-price').text(numberToEuroFormat(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();
|
||||
}
|
||||
}
|
||||
|
||||
// iti.getNumber();
|
||||
|
||||
$(window).on('load', function(){
|
||||
updateProducts();
|
||||
$("#successful-submitting-form").delay(4000).slideUp(200, function() { $(this).alert('close'); });
|
||||
$('#anfrage').submit(function(){
|
||||
objProducts = [];
|
||||
localStorage.setItem("products", JSON.stringify(objProducts));
|
||||
});
|
||||
$(document).on('input', '.select-quantity', function(){
|
||||
getInfoFromSelectedProduct().done(function(response, status){
|
||||
totalPrice = 0;
|
||||
response.contents.forEach(function(product){
|
||||
let objProduct = getProductInfo(product);
|
||||
objProduct = calculatePrice(objProduct);
|
||||
totalPrice += objProduct.calc_preis*objProduct.quantity;
|
||||
});
|
||||
$('#total-checkout-price').text(numberToEuroFormat(totalPrice));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('load', google.maps.event, function(){
|
||||
let input = document.getElementById('field_location');
|
||||
let options = {
|
||||
types: ['address'],
|
||||
|
@ -56,61 +116,4 @@ function initialize() {
|
|||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
$(window).on('load', google.maps.event, initialize);
|
||||
let input = document.querySelector("#ctelefon");
|
||||
if(input != undefined){
|
||||
let iti = window.intlTelInput(input, {
|
||||
initialCountry: "de",
|
||||
preferredCountries: ["de"],
|
||||
geoIpLookup: function(callback) {
|
||||
$.get('https://ipinfo.io', function() {}, "jsonp").always(function(resp) {
|
||||
let countryCode = (resp && resp.country)?resp.country:"us";
|
||||
callback(countryCode);
|
||||
});
|
||||
},
|
||||
utilsScript: "/template/assets/libs/intl-tel-input/js/utils.min.js",
|
||||
});
|
||||
}
|
||||
// iti.getNumber();
|
||||
function updateProducts(){
|
||||
$('#list-products').html('');
|
||||
if(objProducts.length > 0){
|
||||
getInfoFromSelectedProduct().done(function(response, status){
|
||||
response.contents.forEach(function(product){
|
||||
let objProduct = getProductInfo(product);
|
||||
let elementProduct = createProductElement(objProduct);
|
||||
$('#list-products').append(elementProduct);
|
||||
});
|
||||
$('#total-checkout-price').text(numberToEuroFormat(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();
|
||||
$("#successful-submitting-form").delay(4000).slideUp(200, function() { $(this).alert('close'); });
|
||||
$('#anfrage').submit(function(){
|
||||
objProducts = [];
|
||||
localStorage.setItem("products", JSON.stringify(objProducts));
|
||||
});
|
||||
$(document).on('input', '.select-quantity', function(){
|
||||
getInfoFromSelectedProduct().done(function(response, status){
|
||||
totalPrice = 0;
|
||||
response.contents.forEach(function(product){
|
||||
let objProduct = getProductInfo(product);
|
||||
objProduct = calculatePrice(objProduct);
|
||||
totalPrice += objProduct.calc_preis*objProduct.quantity;
|
||||
});
|
||||
$('#total-checkout-price').text(numberToEuroFormat(totalPrice));
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue