Merge branch 'master' of code.areya.de:Areya/areya-energy

master
Benjamin Völkl 2022-09-10 19:14:09 +02:00
commit a0eae04c78
6 changed files with 66 additions and 23 deletions

View File

@ -12,8 +12,9 @@ function getAddressFiedlValue(addressComponents, $field){
}

let input = document.querySelector("#ctelefon");
let iti = null;
if(input != undefined){
let iti = window.intlTelInput(input, {
iti = window.intlTelInput(input, {
initialCountry: "de",
preferredCountries: ["de"],
geoIpLookup: function(callback) {
@ -34,22 +35,37 @@ function updateProducts(){
let elementProduct = createProductElement(objProduct);
$('#list-products').append(elementProduct);
});
$('#total-checkout-price').text(numberToEuroFormat(totalPrice));
if(totalPrice > 0){
$('#total-checkout-price').text(numberToEuroFormat(totalPrice));
}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){
$('#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();
});
$('#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{
$('#cart-error-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();
$('#cart-error-in-checkout').hide();
}
}

// iti.getNumber();

$(window).on('load', function(){
updateProducts();
$("#successful-submitting-form").delay(4000).slideUp(200, function() { $(this).alert('close'); });
@ -60,9 +76,11 @@ $(window).on('load', function(){
let products = response.contents.map(product => {
product = getProductInfo(product);
product = calculatePrice(product);
return product;
return product.quantity+'x '+product.title+' ('+numberToEuroFormat(product.calc_preis)+')';
});
$('#ccart').val(JSON.stringify({"total-price": totalPrice, "products": products}));
let cart = products.join(" - ")+" - Gesammt: "+numberToEuroFormat(totalPrice);
$('#ccart').val(cart);
$('#ctelefon').val(iti.getNumber());
objProducts = [];
localStorage.setItem("products", JSON.stringify(objProducts));
form.unbind('submit').submit();

View File

@ -113,6 +113,15 @@ function updateProductsInLocalStorage(){
$('#list-products-in-bag').append(elementProduct);
});
$('#total-price').text(numberToEuroFormat(totalPrice));
}).fail(function(response){
$('.cart-link').hide();
$(".btn-share").hide();
$('#count-products-in-bag').hide();
$('#list-products-in-bag').parent().parent().parent().parent().parent().find('.modal-footer').hide();
$('#total-price').parent().parent().parent().hide();
$('#no-products').hide();
$('#cart-error').show();
$('#modal-buttons').hide();
});
$('.cart-link').show();
$(".btn-share").show();
@ -120,6 +129,7 @@ function updateProductsInLocalStorage(){
$('#list-products-in-bag').parent().parent().parent().parent().parent().find('.modal-footer').show();
$('#total-price').parent().parent().parent().show();
$('#no-products').hide();
$('#cart-error').hide();
$('#modal-buttons').show();
cartLink = window.location.origin+'/'+btoa(JSON.stringify(objProducts));
@ -139,6 +149,7 @@ function updateProductsInLocalStorage(){
$('#list-products-in-bag').parent().parent().parent().parent().parent().find('.modal-footer').hide();
$('#total-price').parent().parent().parent().hide();
$('#no-products').show();
$('#cart-error').hide();
$('#modal-buttons').hide();
}
let productId = $('meta[name="product-id"]').attr('content');

View File

@ -1 +1 @@
{"content-types":[{"slug":"solarmodule","name":"Solarmodule","description":"Solarmodule","icon":"solar-panel","status":1,"blade":"solarmodule","fields":[{"name":"Beschreibung","type":"textfield","description":"","position":1,"required":0,"default_value":""},{"name":"Hersteller","type":"select","description":"","position":2,"required":1,"default_value":"","options":["JA Solar","Longi"]},{"name":"Preis","type":"number","description":"","attr":{"min":"0","step":"0.01"},"position":5,"required":1,"default_value":""},{"name":"Lieferumfang","type":"textfield","description":"","position":3,"required":1,"default_value":""},{"name":"preis_5","type":"number","description":"Preis pro Modul bei Abnahme ab 5 St\u00fcck","attr":{"max":"500","min":"0","step":"0.01"},"position":4,"required":0,"default_value":""},{"name":"preis_10","type":"number","description":"Preis pro Modul bei Abnahme ab 10 St\u00fcck","attr":{"min":"0","step":"0.01"},"position":6,"required":0,"default_value":""},{"name":"preis_palette","type":"number","description":"Preis pro Modul bei Abnahme von einer geschlossenen Palette","attr":{"min":"0","step":"0.01"},"position":7,"required":0,"default_value":""},{"name":"Module pro Palette","type":"number","description":"","attr":{"max":"50","min":"0","step":"1"},"position":8,"required":1,"default_value":""},{"name":"Leistung","type":"number","description":"Leistung in Wp des Moduls","attr":{"min":"0","step":"1"},"position":9,"required":1,"default_value":""}]},{"slug":"balkonkraftwerk","name":"Balkonkraftwerk","description":"Produkt","icon":"shopping-bag","status":1,"blade":"balkonkraftwerk","fields":[{"name":"Preis","type":"number","description":"","position":1,"required":1,"default_value":""},{"name":"Beschreibung","type":"textfield","description":"","position":2,"required":1,"default_value":""},{"name":"Kurzbeschreibung","type":"textfield","description":"","position":3,"required":1,"default_value":""},{"name":"Technische Daten","type":"textfield","description":"","position":4,"required":0,"default_value":""}]},{"slug":"kabel","name":"Kabel","description":"Solar und AC Kabel","icon":"parking","status":1,"blade":"balkonkraftwerk","fields":[{"name":"L\u00e4nge","type":"number","description":"","attr":{"min":"0","step":"1"},"position":1,"required":0,"default_value":""},{"name":"Preis","type":"number","description":"","attr":{"min":"0","step":"0.01"},"position":2,"required":1,"default_value":""}]},{"slug":"befestigung","name":"Befestigung","description":"d","icon":"hammer","status":1,"blade":"balkonkraftwerk","fields":[{"name":"preis","type":"number","description":"","attr":{"min":"0","step":"0.01"},"position":1,"required":1,"default_value":""}]}]}
[{"slug":"solarmodule","name":"Solarmodule","description":"Solarmodule","icon":"solar-panel","status":1,"blade":"solarmodule","fields":[{"name":"Beschreibung","type":"textfield","description":"","position":1,"required":0,"default_value":""},{"name":"Hersteller","type":"select","description":"","position":2,"required":1,"default_value":"","options":["JA Solar","Longi"]},{"name":"Preis","type":"number","description":"","attr":{"min":"0","step":"0.01"},"position":5,"required":1,"default_value":""},{"name":"Lieferumfang","type":"textfield","description":"","position":3,"required":1,"default_value":""},{"name":"preis_5","type":"number","description":"Preis pro Modul bei Abnahme ab 5 St\u00fcck","attr":{"max":"500","min":"0","step":"0.01"},"position":4,"required":0,"default_value":""},{"name":"preis_10","type":"number","description":"Preis pro Modul bei Abnahme ab 10 St\u00fcck","attr":{"min":"0","step":"0.01"},"position":6,"required":0,"default_value":""},{"name":"preis_palette","type":"number","description":"Preis pro Modul bei Abnahme von einer geschlossenen Palette","attr":{"min":"0","step":"0.01"},"position":7,"required":0,"default_value":""},{"name":"Module pro Palette","type":"number","description":"","attr":{"max":"50","min":"0","step":"1"},"position":8,"required":1,"default_value":""},{"name":"Leistung","type":"number","description":"Leistung in Wp des Moduls","attr":{"min":"0","step":"1"},"position":9,"required":1,"default_value":""}]},{"slug":"balkonkraftwerk","name":"Balkonkraftwerk","description":"Produkt","icon":"shopping-bag","status":1,"blade":"balkonkraftwerk","fields":[{"name":"Preis","type":"number","description":"","position":1,"required":1,"default_value":""},{"name":"Beschreibung","type":"textfield","description":"","position":2,"required":1,"default_value":""},{"name":"Kurzbeschreibung","type":"textfield","description":"","position":3,"required":1,"default_value":""},{"name":"Technische Daten","type":"textfield","description":"","position":4,"required":0,"default_value":""}]},{"slug":"kabel","name":"Kabel","description":"Solar und AC Kabel","icon":"parking","status":1,"blade":"balkonkraftwerk","fields":[{"name":"L\u00e4nge","type":"number","description":"","attr":{"min":"0","step":"1"},"position":1,"required":0,"default_value":""},{"name":"Preis","type":"number","description":"","attr":{"min":"0","step":"0.01"},"position":2,"required":1,"default_value":""}]},{"slug":"befestigung","name":"Befestigung","description":"d","icon":"hammer","status":1,"blade":"balkonkraftwerk","fields":[{"name":"preis","type":"number","description":"","attr":{"min":"0","step":"0.01"},"position":1,"required":1,"default_value":""}]}]

View File

@ -112,6 +112,9 @@
</div>
<div class="modal-body">
<div class="row">
<div style="display: none;" class="alert alert-danger" role="alert" id="cart-error">
Fehler beim Laden der Produkte, versuchen Sie, die Seite neu zu laden
</div>
<div style="display: none;" class="col-12 text-center" id="no-products">

<br>

View File

@ -58,6 +58,9 @@
<!-- Calendly inline widget end -->
</div>
@else
<div style="display: none;" class="alert alert-danger" role="alert" id="cart-error-in-checkout">
Fehler beim Laden der Produkte, versuchen Sie die Seite neu zu laden
</div>
<div style="display: none;" class="col-12 text-center" id="no-products-in-checkout">
<br>
<br>
@ -108,7 +111,7 @@
<div class="alert alert-danger">{{session()->get('error')}}</div>
<br>
@endif
<x-form id="anfrage" id-name="anfrage" channels="bestaetigung,airtable,warenkorb">
<x-form id="anfrage" id-name="anfrage" channels="airtable,warenkorb">
<input type="hidden" name="cart" id="ccart">
<div class="mb-4">
<label for="" class="form-label">Anrede</label>

View File

@ -1,29 +1,37 @@
[
{
"name":"Anfrage",
"description":"Anfrage",
"status":1,
"channels":[
{
"name":"Bestaetigung",
"type":"email",
"status":1,
"active":"1",
"email-address":"info@areya.de",
"email-subject":"Bestaetigung",
"email-body-type":"text",
"email-body":"Olá"
},
{
"name":"Fastbill",
"name":"airtable",
"type":"api",
"status":1,
"active":"1",
"api-url":"https://my.fastbill.com/api/1.0/api.php",
"api-url":"https:\/\/api.airtable.com\/v0\/app1v3E11EmcsjPn0\/Kunden",
"api-method":"post",
"api-auth-type":"bearer-token",
"api-auth-token":"keyPme6FnfdkW4Oks",
"api-body-type":"json",
"api-body-json":"{\"records\":[{\"fields\":{\"Kundenname\":\"#vorname #nachname\",\"Anrede\":\"#anrede\",\"Telefon\":\"#telefon\",\"E-Mail\":\"#email\",\"Notes\":\"#cart\"}}]}",
"api-body-data":"[]",
"api-header-data":"[]"
},
{
"name":"fastbill-client",
"type":"api",
"status":1,
"active":"1",
"api-url":"https:\/\/my.fastbill.com\/api\/1.0\/api.php",
"api-method":"post",
"api-auth-type":"basic",
"api-auth-username":"info@areya.de",
"api-auth-username":"benjamin.voelkl@areya.de",
"api-auth-password":"e0364f3a42ca616af0fe78de3337008d5P7ZRTq9OsOVlWNlf7h3i5C9ZUagDgyV",
"api-body-type":"json"
"api-body-type":"json",
"api-body-json":"{\"SERVICE\":\"customer.create\",\"DATA\":{\"CUSTOMER_TYPE\":\"business\",\"ORGANIZATION\":\"Musterfirma\",\"LAST_NAME\":\"Mustermann\"}}",
"api-body-data":"[]",
"api-header-data":"[]"
}
]
}