From 1ad1ed317466166882c7d4d242cad7f0bb75a2ab Mon Sep 17 00:00:00 2001
From: Gustavo Luigi <=>
Date: Thu, 8 Sep 2022 13:14:40 +0200
Subject: [PATCH 4/7] bugfix in send form
---
assets/js/checkout.js | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/assets/js/checkout.js b/assets/js/checkout.js
index 8df88eb..f04ab7f 100644
--- a/assets/js/checkout.js
+++ b/assets/js/checkout.js
@@ -34,7 +34,15 @@ 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();
@@ -48,13 +56,6 @@ function updateProducts(){
$('#no-products-in-checkout').hide();
$('#cart-error-in-checkout').hide();
}
- else if(totalPrice > 0){
- $('#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();
- }
else{
$('#form-section').hide();
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide();
@@ -78,7 +79,7 @@ $(window).on('load', function(){
product = calculatePrice(product);
return product.quantity+'x '+product.title+' ('+numberToEuroFormat(product.calc_preis)+')';
});
- let cart = products.join("\n")+"\nGesammt: "+numberToEuroFormat(totalPrice);
+ let cart = products.join(" - ")+" - Gesammt: "+numberToEuroFormat(totalPrice);
$('#ccart').val(cart);
objProducts = [];
localStorage.setItem("products", JSON.stringify(objProducts));
From ffc413d1c84d361c052c6ee307c73634a6e6f3d8 Mon Sep 17 00:00:00 2001
From: Gustavo Luigi <=>
Date: Thu, 8 Sep 2022 13:31:11 +0200
Subject: [PATCH 5/7] send number with country code in form
---
assets/js/checkout.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/assets/js/checkout.js b/assets/js/checkout.js
index f04ab7f..d27f6e5 100644
--- a/assets/js/checkout.js
+++ b/assets/js/checkout.js
@@ -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) {
@@ -65,8 +66,6 @@ function updateProducts(){
}
}
-// iti.getNumber();
-
$(window).on('load', function(){
updateProducts();
$("#successful-submitting-form").delay(4000).slideUp(200, function() { $(this).alert('close'); });
@@ -81,6 +80,7 @@ $(window).on('load', function(){
});
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();
From d5fe11a4d0ef1e14e392e9b88e0675afc2494a98 Mon Sep 17 00:00:00 2001
From: Gustavo Luigi <=>
Date: Fri, 9 Sep 2022 12:31:59 +0200
Subject: [PATCH 6/7] update content type and form config
---
content-types.json | 2 +-
forms.json | 38 +++++++++++++++++++++++---------------
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/content-types.json b/content-types.json
index 4ef5587..24da23c 100644
--- a/content-types.json
+++ b/content-types.json
@@ -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":""}]}]
\ No newline at end of file
diff --git a/forms.json b/forms.json
index 5fd7eb2..c11a3a8 100644
--- a/forms.json
+++ b/forms.json
@@ -1,30 +1,38 @@
[
{
"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\"}}]}",
+ "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":"[]"
+ }
]
}
]
\ No newline at end of file
From 673b72a1becce08044588d501f343c449d775e81 Mon Sep 17 00:00:00 2001
From: Gustavo Luigi <=>
Date: Fri, 9 Sep 2022 13:46:15 +0200
Subject: [PATCH 7/7] .
---
forms.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/forms.json b/forms.json
index c11a3a8..c31ebda 100644
--- a/forms.json
+++ b/forms.json
@@ -14,7 +14,7 @@
"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\"}}]}",
+ "api-body-json":"{\"records\":[{\"fields\":{\"Kundenname\":\"#vorname #nachname\",\"Anrede\":\"#anrede\",\"Telefon\":\"#telefon\",\"E-Mail\":\"#email\",\"Notes\":\"#cart\"}}]}",
"api-body-data":"[]",
"api-header-data":"[]"
},
@@ -32,7 +32,7 @@
"api-body-json":"{\"SERVICE\":\"customer.create\",\"DATA\":{\"CUSTOMER_TYPE\":\"business\",\"ORGANIZATION\":\"Musterfirma\",\"LAST_NAME\":\"Mustermann\"}}",
"api-body-data":"[]",
"api-header-data":"[]"
- }
+ }
]
}
]
\ No newline at end of file