neue Bestellseite
This commit is contained in:
parent
ddf001fe6a
commit
de71b1f24e
@ -86,8 +86,8 @@
|
|||||||
|
|
||||||
<input type="date"
|
<input type="date"
|
||||||
name="geburtsdatum"
|
name="geburtsdatum"
|
||||||
|
id="geburtsdatum"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
placeholder="Geburtsdatum"
|
|
||||||
required>
|
required>
|
||||||
|
|
||||||
<input name="mobil" class="form-control" placeholder="Mobilnummer" required>
|
<input name="mobil" class="form-control" placeholder="Mobilnummer" required>
|
||||||
@ -139,7 +139,12 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="form-check mt-2">
|
<div class="form-check mt-2">
|
||||||
<input class="form-check-input" type="checkbox" name="agreeSepa" required>
|
<input class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
name="agreeSepa"
|
||||||
|
value="on"
|
||||||
|
required>
|
||||||
|
|
||||||
<label class="form-check-label">
|
<label class="form-check-label">
|
||||||
SEPA-Mandat erteilen
|
SEPA-Mandat erteilen
|
||||||
</label>
|
</label>
|
||||||
@ -203,25 +208,30 @@
|
|||||||
|
|
||||||
<h5>Rechtliches</h5>
|
<h5>Rechtliches</h5>
|
||||||
|
|
||||||
<div class="form-check mb-2">
|
|
||||||
|
<!-- Eltern-Zustimmung -->
|
||||||
|
<div class="form-check mb-2 d-none" id="consentBox">
|
||||||
|
|
||||||
<input class="form-check-input"
|
<input class="form-check-input"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="agreeConsent"
|
name="agreeConsent"
|
||||||
id="agreeConsent">
|
id="agreeConsent"
|
||||||
|
value="on">
|
||||||
|
|
||||||
<label class="form-check-label">
|
<label class="form-check-label">
|
||||||
Einverständnis gelesen
|
Einverständnis der Erziehungsberechtigten
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- AGB -->
|
||||||
<div class="form-check mb-3">
|
<div class="form-check mb-3">
|
||||||
|
|
||||||
<input class="form-check-input"
|
<input class="form-check-input"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="agreeAgb"
|
name="agreeAgb"
|
||||||
|
value="on"
|
||||||
required>
|
required>
|
||||||
|
|
||||||
<label class="form-check-label">
|
<label class="form-check-label">
|
||||||
@ -265,13 +275,12 @@ let currentStep = 1;
|
|||||||
|
|
||||||
function nextStep(step){
|
function nextStep(step){
|
||||||
|
|
||||||
// 👉 Nur validieren, wenn wir vorwärts gehen
|
// Nur vorwärts validieren
|
||||||
if(step > currentStep){
|
if(step > currentStep){
|
||||||
if(!validateStep(currentStep)) return;
|
if(!validateStep(currentStep)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveForm();
|
saveForm();
|
||||||
|
|
||||||
|
|
||||||
currentStep = step;
|
currentStep = step;
|
||||||
|
|
||||||
@ -290,40 +299,50 @@ function nextStep(step){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAgeAndConsent(){
|
|
||||||
|
|
||||||
const data =
|
/* ============================
|
||||||
JSON.parse(localStorage.getItem('registerData'));
|
ALTER PRÜFEN
|
||||||
|
============================ */
|
||||||
|
|
||||||
if(!data || !data.geburtsdatum) return;
|
function isUnder18(){
|
||||||
|
|
||||||
const birth = new Date(data.geburtsdatum);
|
const bday =
|
||||||
|
document.getElementById('geburtsdatum').value;
|
||||||
|
|
||||||
|
if(!bday) return false;
|
||||||
|
|
||||||
|
const birth = new Date(bday);
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
|
|
||||||
let age = today.getFullYear() - birth.getFullYear();
|
let age = today.getFullYear() - birth.getFullYear();
|
||||||
|
|
||||||
const m = today.getMonth() - birth.getMonth();
|
if(
|
||||||
if (m < 0 || (m === 0 && today.getDate() < birth.getDate())) {
|
today.getMonth() < birth.getMonth() ||
|
||||||
|
(today.getMonth() === birth.getMonth() &&
|
||||||
|
today.getDate() < birth.getDate())
|
||||||
|
){
|
||||||
age--;
|
age--;
|
||||||
}
|
}
|
||||||
|
|
||||||
const consentBox =
|
return age < 18;
|
||||||
document.getElementById('agreeConsent');
|
}
|
||||||
|
|
||||||
if(!consentBox) return;
|
|
||||||
|
|
||||||
// Unter 18 → aktiv & Pflicht
|
function checkAgeAndConsent(){
|
||||||
if(age < 18){
|
|
||||||
|
|
||||||
consentBox.disabled = false;
|
const box = document.getElementById('consentBox');
|
||||||
consentBox.required = true;
|
const checkbox = document.getElementById('agreeConsent');
|
||||||
|
|
||||||
} else {
|
if(isUnder18()){
|
||||||
|
|
||||||
// Ab 18 → deaktiviert
|
box.classList.remove('d-none');
|
||||||
consentBox.checked = false;
|
checkbox.required = true;
|
||||||
consentBox.disabled = true;
|
|
||||||
consentBox.required = false;
|
}else{
|
||||||
|
|
||||||
|
box.classList.add('d-none');
|
||||||
|
checkbox.required = false;
|
||||||
|
checkbox.checked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,19 +399,27 @@ function updateNav(){
|
|||||||
|
|
||||||
|
|
||||||
/* ============================
|
/* ============================
|
||||||
AUTO SAVE
|
AUTO SAVE (MIT CHECKBOX FIX)
|
||||||
============================ */
|
============================ */
|
||||||
|
|
||||||
const form = document.getElementById('registerForm');
|
const form = document.getElementById('registerForm');
|
||||||
|
|
||||||
form.addEventListener('input', saveForm);
|
form.addEventListener('input', saveForm);
|
||||||
|
|
||||||
|
|
||||||
function saveForm(){
|
function saveForm(){
|
||||||
|
|
||||||
const data = {};
|
const data = {};
|
||||||
|
|
||||||
new FormData(form).forEach((v,k)=>{
|
Array.from(form.elements).forEach(el=>{
|
||||||
data[k]=v;
|
|
||||||
|
if(!el.name) return;
|
||||||
|
|
||||||
|
if(el.type === 'checkbox'){
|
||||||
|
data[el.name] = el.checked ? 'on' : '';
|
||||||
|
}else{
|
||||||
|
data[el.name] = el.value;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
localStorage.setItem('registerData',
|
localStorage.setItem('registerData',
|
||||||
@ -409,10 +436,13 @@ function loadForm(){
|
|||||||
|
|
||||||
Object.keys(data).forEach(key=>{
|
Object.keys(data).forEach(key=>{
|
||||||
|
|
||||||
const field =
|
const field = form.elements[key];
|
||||||
form.elements[key];
|
|
||||||
|
|
||||||
if(field){
|
if(!field) return;
|
||||||
|
|
||||||
|
if(field.type === 'checkbox'){
|
||||||
|
field.checked = data[key] === 'on';
|
||||||
|
}else{
|
||||||
field.value = data[key];
|
field.value = data[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -440,7 +470,6 @@ function buildSummary(){
|
|||||||
<b>Adresse:</b>
|
<b>Adresse:</b>
|
||||||
${data.strasse} ${data.hausnummer},
|
${data.strasse} ${data.hausnummer},
|
||||||
${data.plz} ${data.ort}<br>
|
${data.plz} ${data.ort}<br>
|
||||||
|
|
||||||
<b>IBAN:</b> ${data.iban}<br>
|
<b>IBAN:</b> ${data.iban}<br>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -458,5 +487,3 @@ form.addEventListener('submit',()=>{
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<%- include('partials/footer') %>
|
|
||||||
Loading…
Reference in New Issue
Block a user