master
parent
a19a3b69e2
commit
ac51fea980
|
@ -1,7 +1,7 @@
|
|||
@extends('template.'.config('settings.template').'.content.master')
|
||||
@section('head')
|
||||
<title>Checkout - Blau Solar</title>
|
||||
<link rel="stylesheet" href="{{storage('assets/libs/intl-tel-input/css/intlTelInput.min.css')}}">
|
||||
<link rel="stylesheet" href="{{storage('libs/intl-tel-input/css/intlTelInput.min.css')}}">
|
||||
@stop
|
||||
@section('content')
|
||||
<div class="container">
|
||||
|
@ -33,15 +33,15 @@
|
|||
<div class="calendly-inline-widget" style="width:1200px;;height:100%;" data-auto-load="false">
|
||||
<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
|
||||
<script>
|
||||
Calendly.initInlineWidget({
|
||||
url: 'https://calendly.com/areya/beratung-solar?hide_gdpr_banner=1',
|
||||
prefill: {
|
||||
name: "{{session()->get('entry')['vorname']}} {{session()->get('entry')['nachname']}}",
|
||||
email: "{{session()->get('entry')['email']}}",
|
||||
location: "4916098200321"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Calendly.initInlineWidget({
|
||||
url: 'https://calendly.com/areya/beratung-solar?hide_gdpr_banner=1',
|
||||
prefill: {
|
||||
name: "{{session()->get('entry')['vorname']}} {{session()->get('entry')['nachname']}}",
|
||||
email: "{{session()->get('entry')['email']}}",
|
||||
location: "4916098200321"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
@ -243,6 +243,6 @@
|
|||
@stop
|
||||
@section('scripts')
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAKGJCCKvmWZl-L5bBF0uS5BWf0gN4ZkpI&v=3.exp&sensor=false&libraries=places"></script>
|
||||
<script src="{{storage('assets/libs/intl-tel-input/js/intlTelInput.min.js')}}"></script>
|
||||
<script src="{{storage('libs/intl-tel-input/js/intlTelInput.min.js')}}"></script>
|
||||
<script src="{{storage('js/checkout.js')}}"></script>
|
||||
@stop
|
||||
|
|
|
@ -6,45 +6,47 @@ function clearAddressFields() {
|
|||
$('#locality').val('');
|
||||
$('#postal-code').val('');
|
||||
}
|
||||
function getAddressFiedlValue(addressComponents, $field){
|
||||
function getAddressFiedlValue(addressComponents, $field) {
|
||||
let field = addressComponents.find(obj => obj.types.indexOf($field) > -1);
|
||||
return field != undefined?field.long_name:'';
|
||||
return field != undefined ? field.long_name : '';
|
||||
}
|
||||
|
||||
urlBase = $('meta[name="url-base"]').attr("content");
|
||||
|
||||
let input = document.querySelector("#ctelefon");
|
||||
let iti = null;
|
||||
if(input != undefined){
|
||||
if (input != undefined) {
|
||||
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";
|
||||
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",
|
||||
utilsScript: urlBase + "/template/libs/intl-tel-input/js/utils.min.js",
|
||||
});
|
||||
}
|
||||
function updateProducts(){
|
||||
function updateProducts() {
|
||||
$('#list-products').html('');
|
||||
if(objProducts.length > 0){
|
||||
getInfoFromSelectedProduct().done(function(response, status){
|
||||
response.contents.forEach(function(product){
|
||||
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);
|
||||
});
|
||||
if(totalPrice > 0){
|
||||
if (totalPrice > 0) {
|
||||
$('#total-checkout-price').text(numberToEuroFormat(totalPrice));
|
||||
}else{
|
||||
} 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').hide();
|
||||
$('#cart-error-in-checkout').show();
|
||||
}
|
||||
}).fail(function(response){
|
||||
}).fail(function (response) {
|
||||
$('#form-section').hide();
|
||||
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide();
|
||||
$('#total-checkout-price').parent().parent().parent().hide();
|
||||
|
@ -57,7 +59,7 @@ function updateProducts(){
|
|||
$('#no-products-in-checkout').hide();
|
||||
$('#cart-error-in-checkout').hide();
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$('#form-section').hide();
|
||||
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide();
|
||||
$('#total-checkout-price').parent().parent().parent().hide();
|
||||
|
@ -66,19 +68,19 @@ function updateProducts(){
|
|||
}
|
||||
}
|
||||
|
||||
$(window).on('load', function(){
|
||||
$(window).on('load', function () {
|
||||
updateProducts();
|
||||
$("#successful-submitting-form").delay(4000).slideUp(200, function() { $(this).alert('close'); });
|
||||
$('#anfrage').submit(function(event){
|
||||
$("#successful-submitting-form").delay(4000).slideUp(200, function () { $(this).alert('close'); });
|
||||
$('#anfrage').submit(function (event) {
|
||||
event.preventDefault();
|
||||
let form = $(this);
|
||||
getInfoFromSelectedProduct().done(function(response, status){
|
||||
getInfoFromSelectedProduct().done(function (response, status) {
|
||||
let products = response.contents.map(product => {
|
||||
product = getProductInfo(product);
|
||||
product = calculatePrice(product);
|
||||
return product.quantity+'x '+product.title+' ('+numberToEuroFormat(product.calc_preis)+')';
|
||||
return product.quantity + 'x ' + product.title + ' (' + numberToEuroFormat(product.calc_preis) + ')';
|
||||
});
|
||||
let cart = products.join(" - ")+" - Gesammt: "+numberToEuroFormat(totalPrice);
|
||||
let cart = products.join(" - ") + " - Gesammt: " + numberToEuroFormat(totalPrice);
|
||||
$('#ccart').val(cart);
|
||||
$('#ctelefon').val(iti.getNumber());
|
||||
objProducts = [];
|
||||
|
@ -86,33 +88,33 @@ $(window).on('load', function(){
|
|||
form.unbind('submit').submit();
|
||||
});
|
||||
});
|
||||
$(document).on('click', '.btn-remove-product', function(){
|
||||
if(objProducts.length > 0){
|
||||
$(document).on('click', '.btn-remove-product', function () {
|
||||
if (objProducts.length > 0) {
|
||||
$('#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{
|
||||
} 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();
|
||||
}
|
||||
});
|
||||
$(document).on('input', '.select-quantity', function(){
|
||||
getInfoFromSelectedProduct().done(function(response, status){
|
||||
$(document).on('input', '.select-quantity', function () {
|
||||
getInfoFromSelectedProduct().done(function (response, status) {
|
||||
totalPrice = 0;
|
||||
response.contents.forEach(function(product){
|
||||
response.contents.forEach(function (product) {
|
||||
let objProduct = getProductInfo(product);
|
||||
objProduct = calculatePrice(objProduct);
|
||||
totalPrice += objProduct.calc_preis*objProduct.quantity;
|
||||
totalPrice += objProduct.calc_preis * objProduct.quantity;
|
||||
});
|
||||
$('#total-checkout-price').text(numberToEuroFormat(totalPrice));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('load', google.maps.event, function(){
|
||||
$(window).on('load', google.maps.event, function () {
|
||||
let input = document.getElementById('field_location');
|
||||
let options = {
|
||||
types: ['address'],
|
||||
|
@ -126,16 +128,16 @@ $(window).on('load', google.maps.event, function(){
|
|||
var componentMap = {
|
||||
country: 'country',
|
||||
locality: 'locality',
|
||||
administrative_area_level_1 : 'administrative_area_level_1',
|
||||
administrative_area_level_2 : 'administrative_area_level_2',
|
||||
administrative_area_level_1: 'administrative_area_level_1',
|
||||
administrative_area_level_2: 'administrative_area_level_2',
|
||||
postal_code: 'postal_code',
|
||||
route: 'route',
|
||||
street_number : 'street_number',
|
||||
street_number: 'street_number',
|
||||
};
|
||||
$('#address-components').show();
|
||||
let addressComponents = autocomplete.getPlace().address_components;
|
||||
let streetNumber = getAddressFiedlValue(addressComponents, 'street_number');
|
||||
if(streetNumber == '') {
|
||||
if (streetNumber == '') {
|
||||
$('#street-number').prop('disabled', false);
|
||||
$('#street-number').focus();
|
||||
}
|
||||
|
@ -150,11 +152,11 @@ $(window).on('load', google.maps.event, function(){
|
|||
$('#locality').val(locality);
|
||||
let postalCode = getAddressFiedlValue(addressComponents, 'postal_code');
|
||||
$('#postal-code').val(postalCode);
|
||||
$('#street-number').blur(function(){
|
||||
if($('#street-number').val() == '') $('#street-number').focus();
|
||||
else{
|
||||
$('#street-number').blur(function () {
|
||||
if ($('#street-number').val() == '') $('#street-number').focus();
|
||||
else {
|
||||
$('#street-number').prop('disabled', true);
|
||||
$('#field_location').val(route+' '+$('#street-number').val()+', '+locality+', '+country);
|
||||
$('#field_location').val(route + ' ' + $('#street-number').val() + ', ' + locality + ', ' + country);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,6 +29,7 @@ function calculatePrice(objProduct) {
|
|||
}
|
||||
|
||||
function createProductElement(objProduct) {
|
||||
if (!objProduct.image) objProduct.image = "";
|
||||
calculatePrice(objProduct);
|
||||
let elementProduct = `
|
||||
<tr>
|
||||
|
|
Loading…
Reference in New Issue