add: Kalendereinträge, Eingabeformular und Absenden-Button
This commit is contained in:
1 parent
6a9d31ca5e
commit
037ea11de5
7 files changed
+1173
-30
No files matched your search
@@ -71,7 +71,7 @@ Die Terminbuchungskomponente hat eine Vorschau auf einem Webseiten-Nachbau der O
|
|||||||
|
|
||||||
## Statische Buchungsvorschau in Contao einbinden
|
## Statische Buchungsvorschau in Contao einbinden
|
||||||
|
|
||||||
Die erste Komponente ist absichtlich datenbankfrei. Sie zeigt Test-Slots, rendert einen Monatskalender und unterscheidet freie von belegten Terminen. Eine Buchung wird noch nicht gespeichert.
|
Die erste Komponente ist absichtlich datenbankfrei. Sie zeigt Test-Slots, rendert einen Monatskalender und unterscheidet freie von belegten Terminen. Ein Klick auf einen freien Slot öffnet eine modale Eingabemaske für Name, E-Mail, Telefon, Alter, Nachricht, Ansprechperson bei AfA/Jobcenter sowie die DSGVO-Einwilligung. Die Eingaben werden derzeit ausschließlich im Browser validiert und weder gespeichert noch versendet.
|
||||||
|
|
||||||
Die Komponente benötigt keinen TypeScript-Compiler und keinen Build-Schritt. Regressionstests ausführen:
|
Die Komponente benötigt keinen TypeScript-Compiler und keinen Build-Schritt. Regressionstests ausführen:
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,329 @@
|
|||||||
.sufw-booking{--sufw-booking-green:#08752a;--sufw-booking-text:#202020;--sufw-booking-muted:#5a5a5a;--sufw-booking-line:#c7c7c7;--sufw-booking-pale:#f3f6f3;box-sizing:border-box;max-width:860px;margin:2rem auto;padding:1.25rem;color:var(--sufw-booking-text);background:#fff;border:1px solid var(--sufw-booking-line);font:1rem/1.5 Arial,"Helvetica Neue",sans-serif}.sufw-booking *{box-sizing:border-box}.sufw-booking__header h2,.sufw-booking__slots h3{margin:.15rem 0 .5rem;color:var(--sufw-booking-green);font-size:1.4rem}.sufw-booking__header p{margin:.3rem 0}.sufw-booking__eyebrow{color:var(--sufw-booking-green);font-size:.875rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em}.sufw-booking__legend{display:flex;gap:1rem;flex-wrap:wrap;margin:1.25rem 0;font-size:.9rem}.sufw-booking__marker{display:inline-block;width:.8rem;height:.8rem;margin-right:.35rem;border-radius:50%}.sufw-booking__marker--available{background:var(--sufw-booking-green)}.sufw-booking__marker--booked{background:#535353}.sufw-booking__month-nav{display:grid;grid-template-columns:3rem 1fr 3rem;align-items:center;margin-top:1rem;text-align:center}.sufw-booking__month-nav h3{margin:0;font-size:1.1rem;text-transform:capitalize}.sufw-booking__nav,.sufw-booking__day,.sufw-booking__slot{font:inherit}.sufw-booking__nav{min-width:2.75rem;min-height:2.75rem;border:1px solid var(--sufw-booking-green);color:var(--sufw-booking-green);background:#fff;font-size:1.7rem;cursor:pointer}.sufw-booking__nav:hover,.sufw-booking__nav:focus-visible{background:var(--sufw-booking-pale)}.sufw-booking__weekdays,.sufw-booking__calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:.3rem}.sufw-booking__weekdays{margin-top:1rem;text-align:center;font-weight:700;font-size:.8rem}.sufw-booking__day{display:grid;place-items:center;gap:.1rem;min-height:3.8rem;padding:.25rem;border:1px solid transparent;background:#fff;color:var(--sufw-booking-text);cursor:pointer}.sufw-booking__day:hover{border-color:var(--sufw-booking-green);background:var(--sufw-booking-pale)}.sufw-booking__day--available{background:#dff3e4;border-color:var(--sufw-booking-green)}.sufw-booking__day--booked{background:#ececec;border-color:#777}.sufw-booking__day.is-selected{outline:3px solid #1f4fbc;outline-offset:1px}.sufw-booking__day small{font-size:.7rem}.sufw-booking__empty{min-height:3.8rem}.sufw-booking__slots{margin-top:1.5rem;padding-top:1.25rem;border-top:1px solid var(--sufw-booking-line)}.sufw-booking__slots ul{padding:0;margin:0;list-style:none}.sufw-booking__slot{display:grid;grid-template-columns:5rem 1fr auto;gap:.7rem;width:100%;margin:.45rem 0;padding:.8rem;text-align:left;color:var(--sufw-booking-text);background:#fff;border:1px solid var(--sufw-booking-green);cursor:pointer}.sufw-booking__slot:hover,.sufw-booking__slot:focus-visible{background:var(--sufw-booking-pale)}.sufw-booking__slot em{color:var(--sufw-booking-green);font-style:normal;font-weight:700}.sufw-booking__slot:disabled{border-color:#777;background:#eee;color:#555;cursor:not-allowed}.sufw-booking__slot:disabled em{color:#555}.sufw-booking__empty-state,.sufw-booking__status{margin:.7rem 0}.sufw-booking__status{font-weight:700}@media (max-width:520px){.sufw-booking{margin:1rem 0;padding:1rem}.sufw-booking__weekdays{font-size:.7rem}.sufw-booking__day{min-height:3.4rem;padding:.15rem}.sufw-booking__slot{grid-template-columns:1fr;gap:.15rem}.sufw-booking__slot strong{font-size:1.1rem}}
|
.sufw-booking {
|
||||||
|
--sufw-booking-green: #08752a;
|
||||||
|
--sufw-booking-text: #202020;
|
||||||
|
--sufw-booking-muted: #5a5a5a;
|
||||||
|
--sufw-booking-line: #c7c7c7;
|
||||||
|
--sufw-booking-pale: #f3f6f3;
|
||||||
|
box-sizing: border-box;
|
||||||
|
max-width: 860px;
|
||||||
|
margin: 2rem auto;
|
||||||
|
padding: 1.25rem;
|
||||||
|
color: var(--sufw-booking-text);
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid var(--sufw-booking-line);
|
||||||
|
font: 1rem/1.5 Arial, "Helvetica Neue", sans-serif;
|
||||||
|
}
|
||||||
|
.sufw-booking * {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.sufw-booking__header h2,
|
||||||
|
.sufw-booking__slots h3 {
|
||||||
|
margin: 0.15rem 0 0.5rem;
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
font-size: 1.4rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__header p {
|
||||||
|
margin: 0.3rem 0;
|
||||||
|
}
|
||||||
|
.sufw-booking__eyebrow {
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
.sufw-booking__legend {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin: 1.25rem 0;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__marker {
|
||||||
|
display: inline-block;
|
||||||
|
width: 0.8rem;
|
||||||
|
height: 0.8rem;
|
||||||
|
margin-right: 0.35rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.sufw-booking__marker--available {
|
||||||
|
background: var(--sufw-booking-green);
|
||||||
|
}
|
||||||
|
.sufw-booking__marker--booked {
|
||||||
|
background: #535353;
|
||||||
|
}
|
||||||
|
.sufw-booking__month-nav {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 3rem 1fr 3rem;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.sufw-booking__month-nav h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
.sufw-booking__nav,
|
||||||
|
.sufw-booking__day,
|
||||||
|
.sufw-booking__slot {
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
.sufw-booking__nav {
|
||||||
|
min-width: 2.75rem;
|
||||||
|
min-height: 2.75rem;
|
||||||
|
border: 1px solid var(--sufw-booking-green);
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
background: #fff;
|
||||||
|
font-size: 1.7rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.sufw-booking__nav:hover,
|
||||||
|
.sufw-booking__nav:focus-visible {
|
||||||
|
background: var(--sufw-booking-pale);
|
||||||
|
}
|
||||||
|
.sufw-booking__weekdays,
|
||||||
|
.sufw-booking__calendar {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||||||
|
gap: 0.3rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__weekdays {
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__day {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
gap: 0.1rem;
|
||||||
|
min-height: 3.8rem;
|
||||||
|
padding: 0.25rem;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
background: #fff;
|
||||||
|
color: var(--sufw-booking-text);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.sufw-booking__day:hover {
|
||||||
|
border-color: var(--sufw-booking-green);
|
||||||
|
background: var(--sufw-booking-pale);
|
||||||
|
}
|
||||||
|
.sufw-booking__day--available {
|
||||||
|
background: #dff3e4;
|
||||||
|
border-color: var(--sufw-booking-green);
|
||||||
|
}
|
||||||
|
.sufw-booking__day--booked {
|
||||||
|
background: #ececec;
|
||||||
|
border-color: #777;
|
||||||
|
}
|
||||||
|
.sufw-booking__day.is-selected {
|
||||||
|
outline: 3px solid #1f4fbc;
|
||||||
|
outline-offset: 1px;
|
||||||
|
}
|
||||||
|
.sufw-booking__day small {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__empty {
|
||||||
|
min-height: 3.8rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__slots {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
padding-top: 1.25rem;
|
||||||
|
border-top: 1px solid var(--sufw-booking-line);
|
||||||
|
}
|
||||||
|
.sufw-booking__slots ul {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 5rem 1fr auto;
|
||||||
|
gap: 0.7rem;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0.45rem 0;
|
||||||
|
padding: 0.8rem;
|
||||||
|
text-align: left;
|
||||||
|
color: var(--sufw-booking-text);
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid var(--sufw-booking-green);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot:hover,
|
||||||
|
.sufw-booking__slot:focus-visible {
|
||||||
|
background: var(--sufw-booking-pale);
|
||||||
|
}
|
||||||
|
.sufw-booking__slot em {
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot:disabled {
|
||||||
|
border-color: #777;
|
||||||
|
background: #eee;
|
||||||
|
color: #555;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot:disabled em {
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
.sufw-booking__empty-state,
|
||||||
|
.sufw-booking__status {
|
||||||
|
margin: 0.7rem 0;
|
||||||
|
}
|
||||||
|
.sufw-booking__status {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.sufw-booking__dialog {
|
||||||
|
width: min(42rem, calc(100% - 2rem));
|
||||||
|
max-height: calc(100vh - 2rem);
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
color: var(--sufw-booking-text);
|
||||||
|
box-shadow: 0 0.75rem 2.5rem rgba(0, 0, 0, 0.35);
|
||||||
|
font: 1rem/1.5 Arial, "Helvetica Neue", sans-serif;
|
||||||
|
}
|
||||||
|
.sufw-booking__dialog::backdrop {
|
||||||
|
background: rgba(0, 0, 0, 0.62);
|
||||||
|
}
|
||||||
|
.sufw-booking__form {
|
||||||
|
display: grid;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1.25rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-header {
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
border-bottom: 1px solid var(--sufw-booking-line);
|
||||||
|
}
|
||||||
|
.sufw-booking__form-header h2 {
|
||||||
|
margin: 0.15rem 0 0.5rem;
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__appointment,
|
||||||
|
.sufw-booking__required,
|
||||||
|
.sufw-booking__prototype-note {
|
||||||
|
margin: 0.35rem 0;
|
||||||
|
}
|
||||||
|
.sufw-booking__required {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__optional {
|
||||||
|
color: var(--sufw-booking-muted);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__form label {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.35rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.sufw-booking__form input,
|
||||||
|
.sufw-booking__form textarea {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.65rem;
|
||||||
|
border: 1px solid #767676;
|
||||||
|
color: var(--sufw-booking-text);
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
.sufw-booking__form input:focus-visible,
|
||||||
|
.sufw-booking__form textarea:focus-visible,
|
||||||
|
.sufw-booking__form button:focus-visible {
|
||||||
|
outline: 3px solid #1f4fbc;
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
.sufw-booking__consent {
|
||||||
|
grid-template-columns: auto 1fr;
|
||||||
|
align-items: start;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
}
|
||||||
|
.sufw-booking__consent input {
|
||||||
|
width: 1.1rem !important;
|
||||||
|
height: 1.1rem;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-errors:empty {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-errors {
|
||||||
|
padding: 0.75rem;
|
||||||
|
border-left: 4px solid #a31111;
|
||||||
|
background: #fff1f1;
|
||||||
|
color: #6c0808;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-errors ul {
|
||||||
|
margin: 0;
|
||||||
|
padding-left: 1.25rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__prototype-note {
|
||||||
|
padding: 0.75rem;
|
||||||
|
background: var(--sufw-booking-pale);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-status {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.75rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions button {
|
||||||
|
padding: 0.7rem 1rem;
|
||||||
|
border: 1px solid var(--sufw-booking-green);
|
||||||
|
background-color: #08752a;
|
||||||
|
color: #fff;
|
||||||
|
font: inherit;
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions button:hover:not(:disabled) {
|
||||||
|
border-color: #05571f;
|
||||||
|
background-color: #05571f;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions button:disabled {
|
||||||
|
border-color: #777;
|
||||||
|
background-color: #d8d8d8;
|
||||||
|
color: #555;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions .sufw-booking__secondary {
|
||||||
|
background-color: #fff;
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
}
|
||||||
|
@media (max-width: 520px) {
|
||||||
|
.sufw-booking {
|
||||||
|
margin: 1rem 0;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__weekdays {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__day {
|
||||||
|
min-height: 3.4rem;
|
||||||
|
padding: 0.15rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 0.15rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot strong {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,41 @@
|
|||||||
/* Browsernatives ES-Modul; wird ohne TypeScript-Compiler ausgeliefert. */
|
/* Browsernatives ES-Modul; wird ohne TypeScript-Compiler ausgeliefert. */
|
||||||
const demoSlots = [
|
const demoSlots = [
|
||||||
{ id: 'pw-2026-08-25-1000', project: 'perspektivwerk', date: '2026-08-25', start: '10:00', title: 'Erstgespräch', status: 'available' },
|
{ id: 'pw-2026-08-24-0900', project: 'perspektivwerk', date: '2026-08-24', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
{ id: 'pw-2026-08-25-1300', project: 'perspektivwerk', date: '2026-08-25', start: '13:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
{ id: 'pw-2026-08-24-1100', project: 'perspektivwerk', date: '2026-08-24', start: '11:00', title: 'Erstgespräch', status: 'available' },
|
||||||
{ id: 'pw-2026-08-25-1500', project: 'perspektivwerk', date: '2026-08-25', start: '15:00', title: 'Erstgespräch', status: 'available' },
|
{ id: 'pw-2026-08-24-1400', project: 'perspektivwerk', date: '2026-08-24', start: '14:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
||||||
{ id: 'pw-2026-08-27-0900', project: 'perspektivwerk', date: '2026-08-27', start: '09:00', title: 'Psy Modul', status: 'available' },
|
{ id: 'pw-2026-08-18-1000', project: 'perspektivwerk', date: '2026-08-18', start: '10:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-18-1300', project: 'perspektivwerk', date: '2026-08-18', start: '13:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-08-18-1500', project: 'perspektivwerk', date: '2026-08-18', start: '15:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-26-0900', project: 'perspektivwerk', date: '2026-08-26', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-26-1100', project: 'perspektivwerk', date: '2026-08-26', start: '11:00', title: 'Psy Modul', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-08-26-1400', project: 'perspektivwerk', date: '2026-08-26', start: '14:00', title: 'Soz. Päd. Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-20-0900', project: 'perspektivwerk', date: '2026-08-20', start: '09:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-20-1100', project: 'perspektivwerk', date: '2026-08-20', start: '11:00', title: 'Erstgespräch', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-08-20-1500', project: 'perspektivwerk', date: '2026-08-20', start: '15:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-28-0900', project: 'perspektivwerk', date: '2026-08-28', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-28-1100', project: 'perspektivwerk', date: '2026-08-28', start: '11:00', title: 'Soz. Päd. Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-28-1400', project: 'perspektivwerk', date: '2026-08-28', start: '14:00', title: 'Erstgespräch', status: 'booked' },
|
||||||
{ id: 'pw-2026-08-31-0800', project: 'perspektivwerk', date: '2026-08-31', start: '08:00', title: 'Praxis Modul', status: 'available' },
|
{ id: 'pw-2026-08-31-0800', project: 'perspektivwerk', date: '2026-08-31', start: '08:00', title: 'Praxis Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-02-0900', project: 'perspektivwerk', date: '2026-09-02', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-02-1100', project: 'perspektivwerk', date: '2026-09-02', start: '11:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-09-02-1400', project: 'perspektivwerk', date: '2026-09-02', start: '14:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-07-0900', project: 'perspektivwerk', date: '2026-09-07', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-07-1300', project: 'perspektivwerk', date: '2026-09-07', start: '13:00', title: 'Soz. Päd. Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-10-0900', project: 'perspektivwerk', date: '2026-09-10', start: '09:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-10-1100', project: 'perspektivwerk', date: '2026-09-10', start: '11:00', title: 'Erstgespräch', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-09-10-1500', project: 'perspektivwerk', date: '2026-09-10', start: '15:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-15-0900', project: 'perspektivwerk', date: '2026-09-15', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-15-1100', project: 'perspektivwerk', date: '2026-09-15', start: '11:00', title: 'Soz. Päd. Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-15-1400', project: 'perspektivwerk', date: '2026-09-15', start: '14:00', title: 'Psy Modul', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-09-18-0900', project: 'perspektivwerk', date: '2026-09-18', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-18-1300', project: 'perspektivwerk', date: '2026-09-18', start: '13:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-09-22-1000', project: 'perspektivwerk', date: '2026-09-22', start: '10:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-22-1400', project: 'perspektivwerk', date: '2026-09-22', start: '14:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-25-0900', project: 'perspektivwerk', date: '2026-09-25', start: '09:00', title: 'Soz. Päd. Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-25-1100', project: 'perspektivwerk', date: '2026-09-25', start: '11:00', title: 'Erstgespräch', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-09-29-0900', project: 'perspektivwerk', date: '2026-09-29', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-29-1100', project: 'perspektivwerk', date: '2026-09-29', start: '11:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-29-1400', project: 'perspektivwerk', date: '2026-09-29', start: '14:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
||||||
{ id: 'ps-2026-08-25-1000', project: 'produktionsschule', date: '2026-08-25', start: '10:00', title: 'Kennenlerntermin', status: 'available' },
|
{ id: 'ps-2026-08-25-1000', project: 'produktionsschule', date: '2026-08-25', start: '10:00', title: 'Kennenlerntermin', status: 'available' },
|
||||||
{ id: 'ps-2026-08-25-1300', project: 'produktionsschule', date: '2026-08-25', start: '13:00', title: 'Kennenlerntermin', status: 'booked' },
|
{ id: 'ps-2026-08-25-1300', project: 'produktionsschule', date: '2026-08-25', start: '13:00', title: 'Kennenlerntermin', status: 'booked' },
|
||||||
{ id: 'ps-2026-08-31-0800', project: 'produktionsschule', date: '2026-08-31', start: '08:00', title: 'Probearbeiten', status: 'available' }
|
{ id: 'ps-2026-08-31-0800', project: 'produktionsschule', date: '2026-08-31', start: '08:00', title: 'Probearbeiten', status: 'available' }
|
||||||
@@ -12,14 +43,47 @@ const demoSlots = [
|
|||||||
export function getSlotsForDate(project, date) {
|
export function getSlotsForDate(project, date) {
|
||||||
return demoSlots.filter((slot) => slot.project === project && slot.date === date);
|
return demoSlots.filter((slot) => slot.project === project && slot.date === date);
|
||||||
}
|
}
|
||||||
|
export function validateBookingField(fieldName, value) {
|
||||||
|
const text = typeof value === 'string' ? value.trim() : '';
|
||||||
|
if (fieldName === 'name')
|
||||||
|
return text ? '' : 'Bitte geben Sie Ihren Namen ein.';
|
||||||
|
if (fieldName === 'email')
|
||||||
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text) ? '' : 'Bitte geben Sie eine gültige E-Mail-Adresse ein.';
|
||||||
|
if (fieldName === 'phone')
|
||||||
|
return !text || /^[0-9+()\-/\s]{6,}$/.test(text) ? '' : 'Bitte geben Sie eine gültige Telefonnummer ein.';
|
||||||
|
if (fieldName === 'age')
|
||||||
|
return !text || (/^\d+$/.test(text) && Number(text) >= 12 && Number(text) <= 112) ? '' : 'Bitte geben Sie ein Alter zwischen 12 und 112 Jahren ein.';
|
||||||
|
if (fieldName === 'message')
|
||||||
|
return text.length <= 2000 ? '' : 'Die Nachricht darf höchstens 2.000 Zeichen enthalten.';
|
||||||
|
if (fieldName === 'caseWorker')
|
||||||
|
return text.length <= 160 ? '' : 'Die Angabe darf höchstens 160 Zeichen enthalten.';
|
||||||
|
if (fieldName === 'privacy')
|
||||||
|
return value ? '' : 'Bitte bestätigen Sie die Datenschutzhinweise.';
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
export function validateBookingForm({ name = '', email = '', phone = '', age = '', message = '', caseWorker = '', privacyAccepted = false }) {
|
||||||
|
const values = { name, email, phone, age, message, caseWorker, privacy: privacyAccepted };
|
||||||
|
return Object.fromEntries(Object.entries(values)
|
||||||
|
.map(([fieldName, value]) => [fieldName, validateBookingField(fieldName, value)])
|
||||||
|
.filter(([, error]) => error));
|
||||||
|
}
|
||||||
|
export function canSubmitBookingForm(privacyAccepted) {
|
||||||
|
return privacyAccepted;
|
||||||
|
}
|
||||||
|
export function bookingConfirmationMessage(appointmentTitle) {
|
||||||
|
return `Ihre Terminanfrage für ${appointmentTitle} wurde erfolgreich übermittelt.`;
|
||||||
|
}
|
||||||
const dateFormatter = new Intl.DateTimeFormat('de-DE', { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' });
|
const dateFormatter = new Intl.DateTimeFormat('de-DE', { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' });
|
||||||
const monthFormatter = new Intl.DateTimeFormat('de-DE', { month: 'long', year: 'numeric' });
|
const monthFormatter = new Intl.DateTimeFormat('de-DE', { month: 'long', year: 'numeric' });
|
||||||
const weekdays = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'];
|
const weekdays = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'];
|
||||||
function parseDate(value) {
|
function parseDate(value) {
|
||||||
return new Date(`${value}T12:00:00`);
|
return new Date(`${value}T12:00:00`);
|
||||||
}
|
}
|
||||||
function formatDateKey(date) {
|
export function formatDateKey(date) {
|
||||||
return date.toISOString().slice(0, 10);
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
}
|
}
|
||||||
function createMonthDates(month) {
|
function createMonthDates(month) {
|
||||||
const first = new Date(month.getFullYear(), month.getMonth(), 1);
|
const first = new Date(month.getFullYear(), month.getMonth(), 1);
|
||||||
@@ -35,6 +99,145 @@ function monthForProject(project) {
|
|||||||
const firstSlot = demoSlots.find((slot) => slot.project === project);
|
const firstSlot = demoSlots.find((slot) => slot.project === project);
|
||||||
return firstSlot ? new Date(parseDate(firstSlot.date).getFullYear(), parseDate(firstSlot.date).getMonth(), 1) : new Date();
|
return firstSlot ? new Date(parseDate(firstSlot.date).getFullYear(), parseDate(firstSlot.date).getMonth(), 1) : new Date();
|
||||||
}
|
}
|
||||||
|
function escapeHtml(value) {
|
||||||
|
return value.replace(/[&<>'"]/g, (character) => ({ '&': '&', '<': '<', '>': '>', "'": ''', '"': '"' })[character]);
|
||||||
|
}
|
||||||
|
function showFieldError(form, fieldName, error) {
|
||||||
|
const field = form.elements.namedItem(fieldName);
|
||||||
|
const errorId = `sufw-booking-${fieldName}-error`;
|
||||||
|
let message = form.querySelector(`#${errorId}`);
|
||||||
|
if (!message) {
|
||||||
|
message = document.createElement('span');
|
||||||
|
message.id = errorId;
|
||||||
|
message.className = 'sufw-booking__field-error';
|
||||||
|
message.setAttribute('role', 'alert');
|
||||||
|
message.style.display = 'block';
|
||||||
|
message.style.marginTop = '.35rem';
|
||||||
|
message.style.color = '#6c0808';
|
||||||
|
message.style.fontWeight = '400';
|
||||||
|
const host = fieldName === 'privacy' ? field.closest('label') : field;
|
||||||
|
host.insertAdjacentElement('afterend', message);
|
||||||
|
field.setAttribute('aria-describedby', errorId);
|
||||||
|
}
|
||||||
|
message.textContent = error;
|
||||||
|
message.hidden = !error;
|
||||||
|
field.setAttribute('aria-invalid', error ? 'true' : 'false');
|
||||||
|
}
|
||||||
|
function openConfirmationDialog(container, slot) {
|
||||||
|
const projectTitle = slot.project === 'perspektivwerk' ? 'PerspektivWerk' : 'Produktionsschule';
|
||||||
|
const dialog = document.createElement('dialog');
|
||||||
|
dialog.className = 'sufw-booking__dialog';
|
||||||
|
dialog.setAttribute('aria-labelledby', 'sufw-booking-confirmation-title');
|
||||||
|
dialog.innerHTML = `
|
||||||
|
<section class="sufw-booking__form">
|
||||||
|
<header class="sufw-booking__form-header">
|
||||||
|
<p class="sufw-booking__eyebrow">Termin angefragt</p>
|
||||||
|
<h2 id="sufw-booking-confirmation-title">Vielen Dank für Ihre Anfrage</h2>
|
||||||
|
<p>${escapeHtml(bookingConfirmationMessage(slot.title))}</p>
|
||||||
|
</header>
|
||||||
|
<p class="sufw-booking__appointment"><strong>${escapeHtml(projectTitle)}</strong><br>${escapeHtml(dateFormatter.format(parseDate(slot.date)))} · ${escapeHtml(slot.start)} Uhr · ${escapeHtml(slot.title)}</p>
|
||||||
|
<p>Wir senden Ihnen eine E-Mail zur Bestätigung Ihres Termins.</p>
|
||||||
|
<div class="sufw-booking__form-actions"><button type="button" data-close-confirmation>Schließen</button></div>
|
||||||
|
</section>`;
|
||||||
|
dialog.querySelector('[data-close-confirmation]').addEventListener('click', () => dialog.close());
|
||||||
|
dialog.addEventListener('close', () => dialog.remove());
|
||||||
|
container.append(dialog);
|
||||||
|
if (typeof dialog.showModal === 'function') {
|
||||||
|
dialog.showModal();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dialog.setAttribute('open', '');
|
||||||
|
dialog.querySelector('[data-close-confirmation]').focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function openBookingDialog(container, slot) {
|
||||||
|
const projectTitle = slot.project === 'perspektivwerk' ? 'PerspektivWerk' : 'Produktionsschule';
|
||||||
|
const dialog = document.createElement('dialog');
|
||||||
|
dialog.className = 'sufw-booking__dialog';
|
||||||
|
dialog.setAttribute('aria-labelledby', 'sufw-booking-form-title');
|
||||||
|
dialog.innerHTML = `
|
||||||
|
<form class="sufw-booking__form" novalidate>
|
||||||
|
<header class="sufw-booking__form-header">
|
||||||
|
<p class="sufw-booking__eyebrow">Termin anfragen</p>
|
||||||
|
<h2 id="sufw-booking-form-title">Ihre Angaben</h2>
|
||||||
|
<p class="sufw-booking__appointment"><strong>${escapeHtml(projectTitle)}</strong><br>${escapeHtml(dateFormatter.format(parseDate(slot.date)))} · ${escapeHtml(slot.start)} Uhr · ${escapeHtml(slot.title)}</p>
|
||||||
|
</header>
|
||||||
|
<p class="sufw-booking__required"><span aria-hidden="true">*</span> Pflichtfeld</p>
|
||||||
|
<div class="sufw-booking__form-grid">
|
||||||
|
<label>Vor- und Nachname <span aria-hidden="true">*</span><input name="name" type="text" autocomplete="name" required></label>
|
||||||
|
<label>E-Mail-Adresse <span aria-hidden="true">*</span><input name="email" type="email" autocomplete="email" required></label>
|
||||||
|
<label>Telefonnummer <span class="sufw-booking__optional">freiwillig</span><input name="phone" type="tel" autocomplete="tel"></label>
|
||||||
|
<label>Alter <span class="sufw-booking__optional">freiwillig</span><input name="age" type="number" min="12" max="112" inputmode="numeric"></label>
|
||||||
|
</div>
|
||||||
|
<label>Nachricht <span class="sufw-booking__optional">freiwillig</span><textarea name="message" rows="4"></textarea></label>
|
||||||
|
<label>Ansprechperson bei Agentur für Arbeit oder Jobcenter <span class="sufw-booking__optional">freiwillig</span><input name="caseWorker" type="text"></label>
|
||||||
|
<label class="sufw-booking__consent"><input name="privacy" type="checkbox" value="accepted" required><span>Ich habe die Datenschutzhinweise nach Art. 13 DSGVO gelesen und stimme der Verarbeitung meiner Angaben zur Terminanfrage zu. <span aria-hidden="true">*</span></span></label>
|
||||||
|
<div class="sufw-booking__form-actions"><button type="button" class="sufw-booking__secondary" data-close-dialog>Abbrechen</button><button type="submit" data-submit-booking disabled>Terminanfrage absenden</button></div>
|
||||||
|
</form>`;
|
||||||
|
const form = dialog.querySelector('form');
|
||||||
|
const privacy = form.elements.namedItem('privacy');
|
||||||
|
const submitButton = dialog.querySelector('[data-submit-booking]');
|
||||||
|
const actions = dialog.querySelector('.sufw-booking__form-actions');
|
||||||
|
dialog.style.overflowY = 'auto';
|
||||||
|
actions.style.position = 'sticky';
|
||||||
|
actions.style.bottom = '0';
|
||||||
|
actions.style.zIndex = '2';
|
||||||
|
actions.style.display = 'flex';
|
||||||
|
actions.style.visibility = 'visible';
|
||||||
|
actions.style.opacity = '1';
|
||||||
|
actions.style.backgroundColor = '#fff';
|
||||||
|
actions.style.paddingTop = '.75rem';
|
||||||
|
const fieldNames = ['name', 'email', 'phone', 'age', 'message', 'caseWorker', 'privacy'];
|
||||||
|
const validateField = (fieldName) => {
|
||||||
|
const field = form.elements.namedItem(fieldName);
|
||||||
|
const value = fieldName === 'privacy' ? field.checked : field.value;
|
||||||
|
const error = validateBookingField(fieldName, value);
|
||||||
|
showFieldError(form, fieldName, error);
|
||||||
|
return error;
|
||||||
|
};
|
||||||
|
const updateSubmitButton = () => {
|
||||||
|
submitButton.disabled = !canSubmitBookingForm(privacy.checked);
|
||||||
|
submitButton.hidden = false;
|
||||||
|
submitButton.style.display = 'inline-block';
|
||||||
|
submitButton.style.visibility = 'visible';
|
||||||
|
submitButton.style.opacity = '1';
|
||||||
|
submitButton.style.position = 'relative';
|
||||||
|
submitButton.style.zIndex = '3';
|
||||||
|
submitButton.style.minHeight = '2.75rem';
|
||||||
|
};
|
||||||
|
fieldNames.forEach((fieldName) => {
|
||||||
|
const field = form.elements.namedItem(fieldName);
|
||||||
|
const eventName = fieldName === 'privacy' ? 'change' : 'input';
|
||||||
|
field.addEventListener(eventName, () => validateField(fieldName));
|
||||||
|
if (fieldName !== 'privacy')
|
||||||
|
field.addEventListener('blur', () => validateField(fieldName));
|
||||||
|
});
|
||||||
|
privacy.addEventListener('change', updateSubmitButton);
|
||||||
|
updateSubmitButton();
|
||||||
|
form.addEventListener('submit', (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
const errors = Object.fromEntries(fieldNames
|
||||||
|
.map((fieldName) => [fieldName, validateField(fieldName)])
|
||||||
|
.filter(([, error]) => error));
|
||||||
|
if (Object.keys(errors).length) {
|
||||||
|
const firstInvalid = form.elements.namedItem(Object.keys(errors)[0]);
|
||||||
|
firstInvalid.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialog.close();
|
||||||
|
openConfirmationDialog(container, slot);
|
||||||
|
});
|
||||||
|
dialog.querySelector('[data-close-dialog]').addEventListener('click', () => dialog.close());
|
||||||
|
dialog.addEventListener('close', () => dialog.remove());
|
||||||
|
container.append(dialog);
|
||||||
|
if (typeof dialog.showModal === 'function') {
|
||||||
|
dialog.showModal();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dialog.setAttribute('open', '');
|
||||||
|
dialog.querySelector('input[name="name"]').focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
function renderComponent(container) {
|
function renderComponent(container) {
|
||||||
const configuredProject = container.dataset.project;
|
const configuredProject = container.dataset.project;
|
||||||
const project = configuredProject === 'produktionsschule' ? 'produktionsschule' : 'perspektivwerk';
|
const project = configuredProject === 'produktionsschule' ? 'produktionsschule' : 'perspektivwerk';
|
||||||
@@ -46,7 +249,7 @@ function renderComponent(container) {
|
|||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<section class="sufw-booking" aria-labelledby="sufw-booking-title">
|
<section class="sufw-booking" aria-labelledby="sufw-booking-title">
|
||||||
<header class="sufw-booking__header">
|
<header class="sufw-booking__header">
|
||||||
<p class="sufw-booking__eyebrow">Terminbuchung – Vorschau</p>
|
<p class="sufw-booking__eyebrow">Terminbuchung</p>
|
||||||
<h2 id="sufw-booking-title">${project === 'perspektivwerk' ? 'PerspektivWerk' : 'Produktionsschule'}</h2>
|
<h2 id="sufw-booking-title">${project === 'perspektivwerk' ? 'PerspektivWerk' : 'Produktionsschule'}</h2>
|
||||||
<p>Wählen Sie einen Tag. Freie Termine sind mit „frei“ gekennzeichnet.</p>
|
<p>Wählen Sie einen Tag. Freie Termine sind mit „frei“ gekennzeichnet.</p>
|
||||||
</header>
|
</header>
|
||||||
@@ -73,7 +276,7 @@ function renderComponent(container) {
|
|||||||
</div>
|
</div>
|
||||||
<section class="sufw-booking__slots" aria-labelledby="sufw-slot-title">
|
<section class="sufw-booking__slots" aria-labelledby="sufw-slot-title">
|
||||||
<h3 id="sufw-slot-title">Termine am ${selectedLabel}</h3>
|
<h3 id="sufw-slot-title">Termine am ${selectedLabel}</h3>
|
||||||
${slots.length ? `<ul>${slots.map((slot) => `<li><button type="button" class="sufw-booking__slot" data-slot-id="${slot.id}" ${slot.status === 'booked' ? 'disabled aria-disabled="true"' : ''}><strong>${slot.start} Uhr</strong><span>${slot.title}</span><em>${slot.status === 'available' ? 'Verfügbar' : 'Belegt'}</em></button></li>`).join('')}</ul>` : '<p class="sufw-booking__empty-state">Für diesen Tag liegen in der Vorschau keine Termine vor.</p>'}
|
${slots.length ? `<ul>${slots.map((slot) => `<li><button type="button" class="sufw-booking__slot" data-slot-id="${slot.id}" ${slot.status === 'booked' ? 'disabled aria-disabled="true"' : ''}><strong>${slot.start} Uhr</strong><span>${slot.title}</span><em>${slot.status === 'available' ? 'Verfügbar' : 'Belegt'}</em></button></li>`).join('')}</ul>` : '<p class="sufw-booking__empty-state">Für diesen Tag liegen keine Termine vor.</p>'}
|
||||||
<p class="sufw-booking__status" role="status" aria-live="polite"></p>
|
<p class="sufw-booking__status" role="status" aria-live="polite"></p>
|
||||||
</section>
|
</section>
|
||||||
</section>`;
|
</section>`;
|
||||||
@@ -89,11 +292,11 @@ function renderComponent(container) {
|
|||||||
selectedDate = button.dataset.date ?? '';
|
selectedDate = button.dataset.date ?? '';
|
||||||
render();
|
render();
|
||||||
}));
|
}));
|
||||||
container.querySelectorAll('[data-slot-id]').forEach((button) => button.addEventListener('click', () => {
|
container.querySelectorAll('[data-slot-id]').forEach((button) => button.addEventListener('click', () => {
|
||||||
const status = container.querySelector('.sufw-booking__status');
|
const slot = demoSlots.find((entry) => entry.id === button.dataset.slotId);
|
||||||
if (status)
|
if (slot)
|
||||||
status.textContent = 'Vorschau: Die eigentliche Buchungsmaske wird im nächsten Schritt ergänzt.';
|
openBookingDialog(container, slot);
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,329 @@
|
|||||||
.sufw-booking{--sufw-booking-green:#08752a;--sufw-booking-text:#202020;--sufw-booking-muted:#5a5a5a;--sufw-booking-line:#c7c7c7;--sufw-booking-pale:#f3f6f3;box-sizing:border-box;max-width:860px;margin:2rem auto;padding:1.25rem;color:var(--sufw-booking-text);background:#fff;border:1px solid var(--sufw-booking-line);font:1rem/1.5 Arial,"Helvetica Neue",sans-serif}.sufw-booking *{box-sizing:border-box}.sufw-booking__header h2,.sufw-booking__slots h3{margin:.15rem 0 .5rem;color:var(--sufw-booking-green);font-size:1.4rem}.sufw-booking__header p{margin:.3rem 0}.sufw-booking__eyebrow{color:var(--sufw-booking-green);font-size:.875rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em}.sufw-booking__legend{display:flex;gap:1rem;flex-wrap:wrap;margin:1.25rem 0;font-size:.9rem}.sufw-booking__marker{display:inline-block;width:.8rem;height:.8rem;margin-right:.35rem;border-radius:50%}.sufw-booking__marker--available{background:var(--sufw-booking-green)}.sufw-booking__marker--booked{background:#535353}.sufw-booking__month-nav{display:grid;grid-template-columns:3rem 1fr 3rem;align-items:center;margin-top:1rem;text-align:center}.sufw-booking__month-nav h3{margin:0;font-size:1.1rem;text-transform:capitalize}.sufw-booking__nav,.sufw-booking__day,.sufw-booking__slot{font:inherit}.sufw-booking__nav{min-width:2.75rem;min-height:2.75rem;border:1px solid var(--sufw-booking-green);color:var(--sufw-booking-green);background:#fff;font-size:1.7rem;cursor:pointer}.sufw-booking__nav:hover,.sufw-booking__nav:focus-visible{background:var(--sufw-booking-pale)}.sufw-booking__weekdays,.sufw-booking__calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:.3rem}.sufw-booking__weekdays{margin-top:1rem;text-align:center;font-weight:700;font-size:.8rem}.sufw-booking__day{display:grid;place-items:center;gap:.1rem;min-height:3.8rem;padding:.25rem;border:1px solid transparent;background:#fff;color:var(--sufw-booking-text);cursor:pointer}.sufw-booking__day:hover{border-color:var(--sufw-booking-green);background:var(--sufw-booking-pale)}.sufw-booking__day--available{background:#dff3e4;border-color:var(--sufw-booking-green)}.sufw-booking__day--booked{background:#ececec;border-color:#777}.sufw-booking__day.is-selected{outline:3px solid #1f4fbc;outline-offset:1px}.sufw-booking__day small{font-size:.7rem}.sufw-booking__empty{min-height:3.8rem}.sufw-booking__slots{margin-top:1.5rem;padding-top:1.25rem;border-top:1px solid var(--sufw-booking-line)}.sufw-booking__slots ul{padding:0;margin:0;list-style:none}.sufw-booking__slot{display:grid;grid-template-columns:5rem 1fr auto;gap:.7rem;width:100%;margin:.45rem 0;padding:.8rem;text-align:left;color:var(--sufw-booking-text);background:#fff;border:1px solid var(--sufw-booking-green);cursor:pointer}.sufw-booking__slot:hover,.sufw-booking__slot:focus-visible{background:var(--sufw-booking-pale)}.sufw-booking__slot em{color:var(--sufw-booking-green);font-style:normal;font-weight:700}.sufw-booking__slot:disabled{border-color:#777;background:#eee;color:#555;cursor:not-allowed}.sufw-booking__slot:disabled em{color:#555}.sufw-booking__empty-state,.sufw-booking__status{margin:.7rem 0}.sufw-booking__status{font-weight:700}@media (max-width:520px){.sufw-booking{margin:1rem 0;padding:1rem}.sufw-booking__weekdays{font-size:.7rem}.sufw-booking__day{min-height:3.4rem;padding:.15rem}.sufw-booking__slot{grid-template-columns:1fr;gap:.15rem}.sufw-booking__slot strong{font-size:1.1rem}}
|
.sufw-booking {
|
||||||
|
--sufw-booking-green: #08752a;
|
||||||
|
--sufw-booking-text: #202020;
|
||||||
|
--sufw-booking-muted: #5a5a5a;
|
||||||
|
--sufw-booking-line: #c7c7c7;
|
||||||
|
--sufw-booking-pale: #f3f6f3;
|
||||||
|
box-sizing: border-box;
|
||||||
|
max-width: 860px;
|
||||||
|
margin: 2rem auto;
|
||||||
|
padding: 1.25rem;
|
||||||
|
color: var(--sufw-booking-text);
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid var(--sufw-booking-line);
|
||||||
|
font: 1rem/1.5 Arial, "Helvetica Neue", sans-serif;
|
||||||
|
}
|
||||||
|
.sufw-booking * {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.sufw-booking__header h2,
|
||||||
|
.sufw-booking__slots h3 {
|
||||||
|
margin: 0.15rem 0 0.5rem;
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
font-size: 1.4rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__header p {
|
||||||
|
margin: 0.3rem 0;
|
||||||
|
}
|
||||||
|
.sufw-booking__eyebrow {
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
.sufw-booking__legend {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin: 1.25rem 0;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__marker {
|
||||||
|
display: inline-block;
|
||||||
|
width: 0.8rem;
|
||||||
|
height: 0.8rem;
|
||||||
|
margin-right: 0.35rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.sufw-booking__marker--available {
|
||||||
|
background: var(--sufw-booking-green);
|
||||||
|
}
|
||||||
|
.sufw-booking__marker--booked {
|
||||||
|
background: #535353;
|
||||||
|
}
|
||||||
|
.sufw-booking__month-nav {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 3rem 1fr 3rem;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.sufw-booking__month-nav h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
.sufw-booking__nav,
|
||||||
|
.sufw-booking__day,
|
||||||
|
.sufw-booking__slot {
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
.sufw-booking__nav {
|
||||||
|
min-width: 2.75rem;
|
||||||
|
min-height: 2.75rem;
|
||||||
|
border: 1px solid var(--sufw-booking-green);
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
background: #fff;
|
||||||
|
font-size: 1.7rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.sufw-booking__nav:hover,
|
||||||
|
.sufw-booking__nav:focus-visible {
|
||||||
|
background: var(--sufw-booking-pale);
|
||||||
|
}
|
||||||
|
.sufw-booking__weekdays,
|
||||||
|
.sufw-booking__calendar {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||||||
|
gap: 0.3rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__weekdays {
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__day {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
gap: 0.1rem;
|
||||||
|
min-height: 3.8rem;
|
||||||
|
padding: 0.25rem;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
background: #fff;
|
||||||
|
color: var(--sufw-booking-text);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.sufw-booking__day:hover {
|
||||||
|
border-color: var(--sufw-booking-green);
|
||||||
|
background: var(--sufw-booking-pale);
|
||||||
|
}
|
||||||
|
.sufw-booking__day--available {
|
||||||
|
background: #dff3e4;
|
||||||
|
border-color: var(--sufw-booking-green);
|
||||||
|
}
|
||||||
|
.sufw-booking__day--booked {
|
||||||
|
background: #ececec;
|
||||||
|
border-color: #777;
|
||||||
|
}
|
||||||
|
.sufw-booking__day.is-selected {
|
||||||
|
outline: 3px solid #1f4fbc;
|
||||||
|
outline-offset: 1px;
|
||||||
|
}
|
||||||
|
.sufw-booking__day small {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__empty {
|
||||||
|
min-height: 3.8rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__slots {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
padding-top: 1.25rem;
|
||||||
|
border-top: 1px solid var(--sufw-booking-line);
|
||||||
|
}
|
||||||
|
.sufw-booking__slots ul {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 5rem 1fr auto;
|
||||||
|
gap: 0.7rem;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0.45rem 0;
|
||||||
|
padding: 0.8rem;
|
||||||
|
text-align: left;
|
||||||
|
color: var(--sufw-booking-text);
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid var(--sufw-booking-green);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot:hover,
|
||||||
|
.sufw-booking__slot:focus-visible {
|
||||||
|
background: var(--sufw-booking-pale);
|
||||||
|
}
|
||||||
|
.sufw-booking__slot em {
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot:disabled {
|
||||||
|
border-color: #777;
|
||||||
|
background: #eee;
|
||||||
|
color: #555;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot:disabled em {
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
.sufw-booking__empty-state,
|
||||||
|
.sufw-booking__status {
|
||||||
|
margin: 0.7rem 0;
|
||||||
|
}
|
||||||
|
.sufw-booking__status {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.sufw-booking__dialog {
|
||||||
|
width: min(42rem, calc(100% - 2rem));
|
||||||
|
max-height: calc(100vh - 2rem);
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
color: var(--sufw-booking-text);
|
||||||
|
box-shadow: 0 0.75rem 2.5rem rgba(0, 0, 0, 0.35);
|
||||||
|
font: 1rem/1.5 Arial, "Helvetica Neue", sans-serif;
|
||||||
|
}
|
||||||
|
.sufw-booking__dialog::backdrop {
|
||||||
|
background: rgba(0, 0, 0, 0.62);
|
||||||
|
}
|
||||||
|
.sufw-booking__form {
|
||||||
|
display: grid;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1.25rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-header {
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
border-bottom: 1px solid var(--sufw-booking-line);
|
||||||
|
}
|
||||||
|
.sufw-booking__form-header h2 {
|
||||||
|
margin: 0.15rem 0 0.5rem;
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__appointment,
|
||||||
|
.sufw-booking__required,
|
||||||
|
.sufw-booking__prototype-note {
|
||||||
|
margin: 0.35rem 0;
|
||||||
|
}
|
||||||
|
.sufw-booking__required {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__optional {
|
||||||
|
color: var(--sufw-booking-muted);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__form label {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.35rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.sufw-booking__form input,
|
||||||
|
.sufw-booking__form textarea {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.65rem;
|
||||||
|
border: 1px solid #767676;
|
||||||
|
color: var(--sufw-booking-text);
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
.sufw-booking__form input:focus-visible,
|
||||||
|
.sufw-booking__form textarea:focus-visible,
|
||||||
|
.sufw-booking__form button:focus-visible {
|
||||||
|
outline: 3px solid #1f4fbc;
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
.sufw-booking__consent {
|
||||||
|
grid-template-columns: auto 1fr;
|
||||||
|
align-items: start;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
}
|
||||||
|
.sufw-booking__consent input {
|
||||||
|
width: 1.1rem !important;
|
||||||
|
height: 1.1rem;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-errors:empty {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-errors {
|
||||||
|
padding: 0.75rem;
|
||||||
|
border-left: 4px solid #a31111;
|
||||||
|
background: #fff1f1;
|
||||||
|
color: #6c0808;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-errors ul {
|
||||||
|
margin: 0;
|
||||||
|
padding-left: 1.25rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__prototype-note {
|
||||||
|
padding: 0.75rem;
|
||||||
|
background: var(--sufw-booking-pale);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-status {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.75rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions button {
|
||||||
|
padding: 0.7rem 1rem;
|
||||||
|
border: 1px solid var(--sufw-booking-green);
|
||||||
|
background-color: #08752a;
|
||||||
|
color: #fff;
|
||||||
|
font: inherit;
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions button:hover:not(:disabled) {
|
||||||
|
border-color: #05571f;
|
||||||
|
background-color: #05571f;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions button:disabled {
|
||||||
|
border-color: #777;
|
||||||
|
background-color: #d8d8d8;
|
||||||
|
color: #555;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions .sufw-booking__secondary {
|
||||||
|
background-color: #fff;
|
||||||
|
color: var(--sufw-booking-green);
|
||||||
|
}
|
||||||
|
@media (max-width: 520px) {
|
||||||
|
.sufw-booking {
|
||||||
|
margin: 1rem 0;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__weekdays {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__day {
|
||||||
|
min-height: 3.4rem;
|
||||||
|
padding: 0.15rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 0.15rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__slot strong {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
.sufw-booking__form-actions button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,41 @@
|
|||||||
/* Browsernatives ES-Modul; wird ohne TypeScript-Compiler ausgeliefert. */
|
/* Browsernatives ES-Modul; wird ohne TypeScript-Compiler ausgeliefert. */
|
||||||
const demoSlots = [
|
const demoSlots = [
|
||||||
{ id: 'pw-2026-08-25-1000', project: 'perspektivwerk', date: '2026-08-25', start: '10:00', title: 'Erstgespräch', status: 'available' },
|
{ id: 'pw-2026-08-24-0900', project: 'perspektivwerk', date: '2026-08-24', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
{ id: 'pw-2026-08-25-1300', project: 'perspektivwerk', date: '2026-08-25', start: '13:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
{ id: 'pw-2026-08-24-1100', project: 'perspektivwerk', date: '2026-08-24', start: '11:00', title: 'Erstgespräch', status: 'available' },
|
||||||
{ id: 'pw-2026-08-25-1500', project: 'perspektivwerk', date: '2026-08-25', start: '15:00', title: 'Erstgespräch', status: 'available' },
|
{ id: 'pw-2026-08-24-1400', project: 'perspektivwerk', date: '2026-08-24', start: '14:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
||||||
{ id: 'pw-2026-08-27-0900', project: 'perspektivwerk', date: '2026-08-27', start: '09:00', title: 'Psy Modul', status: 'available' },
|
{ id: 'pw-2026-08-18-1000', project: 'perspektivwerk', date: '2026-08-18', start: '10:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-18-1300', project: 'perspektivwerk', date: '2026-08-18', start: '13:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-08-18-1500', project: 'perspektivwerk', date: '2026-08-18', start: '15:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-26-0900', project: 'perspektivwerk', date: '2026-08-26', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-26-1100', project: 'perspektivwerk', date: '2026-08-26', start: '11:00', title: 'Psy Modul', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-08-26-1400', project: 'perspektivwerk', date: '2026-08-26', start: '14:00', title: 'Soz. Päd. Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-20-0900', project: 'perspektivwerk', date: '2026-08-20', start: '09:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-20-1100', project: 'perspektivwerk', date: '2026-08-20', start: '11:00', title: 'Erstgespräch', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-08-20-1500', project: 'perspektivwerk', date: '2026-08-20', start: '15:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-28-0900', project: 'perspektivwerk', date: '2026-08-28', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-28-1100', project: 'perspektivwerk', date: '2026-08-28', start: '11:00', title: 'Soz. Päd. Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-08-28-1400', project: 'perspektivwerk', date: '2026-08-28', start: '14:00', title: 'Erstgespräch', status: 'booked' },
|
||||||
{ id: 'pw-2026-08-31-0800', project: 'perspektivwerk', date: '2026-08-31', start: '08:00', title: 'Praxis Modul', status: 'available' },
|
{ id: 'pw-2026-08-31-0800', project: 'perspektivwerk', date: '2026-08-31', start: '08:00', title: 'Praxis Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-02-0900', project: 'perspektivwerk', date: '2026-09-02', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-02-1100', project: 'perspektivwerk', date: '2026-09-02', start: '11:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-09-02-1400', project: 'perspektivwerk', date: '2026-09-02', start: '14:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-07-0900', project: 'perspektivwerk', date: '2026-09-07', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-07-1300', project: 'perspektivwerk', date: '2026-09-07', start: '13:00', title: 'Soz. Päd. Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-10-0900', project: 'perspektivwerk', date: '2026-09-10', start: '09:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-10-1100', project: 'perspektivwerk', date: '2026-09-10', start: '11:00', title: 'Erstgespräch', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-09-10-1500', project: 'perspektivwerk', date: '2026-09-10', start: '15:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-15-0900', project: 'perspektivwerk', date: '2026-09-15', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-15-1100', project: 'perspektivwerk', date: '2026-09-15', start: '11:00', title: 'Soz. Päd. Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-15-1400', project: 'perspektivwerk', date: '2026-09-15', start: '14:00', title: 'Psy Modul', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-09-18-0900', project: 'perspektivwerk', date: '2026-09-18', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-18-1300', project: 'perspektivwerk', date: '2026-09-18', start: '13:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-09-22-1000', project: 'perspektivwerk', date: '2026-09-22', start: '10:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-22-1400', project: 'perspektivwerk', date: '2026-09-22', start: '14:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-25-0900', project: 'perspektivwerk', date: '2026-09-25', start: '09:00', title: 'Soz. Päd. Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-25-1100', project: 'perspektivwerk', date: '2026-09-25', start: '11:00', title: 'Erstgespräch', status: 'booked' },
|
||||||
|
{ id: 'pw-2026-09-29-0900', project: 'perspektivwerk', date: '2026-09-29', start: '09:00', title: 'Erstgespräch', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-29-1100', project: 'perspektivwerk', date: '2026-09-29', start: '11:00', title: 'Psy Modul', status: 'available' },
|
||||||
|
{ id: 'pw-2026-09-29-1400', project: 'perspektivwerk', date: '2026-09-29', start: '14:00', title: 'Soz. Päd. Modul', status: 'booked' },
|
||||||
{ id: 'ps-2026-08-25-1000', project: 'produktionsschule', date: '2026-08-25', start: '10:00', title: 'Kennenlerntermin', status: 'available' },
|
{ id: 'ps-2026-08-25-1000', project: 'produktionsschule', date: '2026-08-25', start: '10:00', title: 'Kennenlerntermin', status: 'available' },
|
||||||
{ id: 'ps-2026-08-25-1300', project: 'produktionsschule', date: '2026-08-25', start: '13:00', title: 'Kennenlerntermin', status: 'booked' },
|
{ id: 'ps-2026-08-25-1300', project: 'produktionsschule', date: '2026-08-25', start: '13:00', title: 'Kennenlerntermin', status: 'booked' },
|
||||||
{ id: 'ps-2026-08-31-0800', project: 'produktionsschule', date: '2026-08-31', start: '08:00', title: 'Probearbeiten', status: 'available' }
|
{ id: 'ps-2026-08-31-0800', project: 'produktionsschule', date: '2026-08-31', start: '08:00', title: 'Probearbeiten', status: 'available' }
|
||||||
@@ -12,14 +43,47 @@ const demoSlots = [
|
|||||||
export function getSlotsForDate(project, date) {
|
export function getSlotsForDate(project, date) {
|
||||||
return demoSlots.filter((slot) => slot.project === project && slot.date === date);
|
return demoSlots.filter((slot) => slot.project === project && slot.date === date);
|
||||||
}
|
}
|
||||||
|
export function validateBookingField(fieldName, value) {
|
||||||
|
const text = typeof value === 'string' ? value.trim() : '';
|
||||||
|
if (fieldName === 'name')
|
||||||
|
return text ? '' : 'Bitte geben Sie Ihren Namen ein.';
|
||||||
|
if (fieldName === 'email')
|
||||||
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text) ? '' : 'Bitte geben Sie eine gültige E-Mail-Adresse ein.';
|
||||||
|
if (fieldName === 'phone')
|
||||||
|
return !text || /^[0-9+()\-/\s]{6,}$/.test(text) ? '' : 'Bitte geben Sie eine gültige Telefonnummer ein.';
|
||||||
|
if (fieldName === 'age')
|
||||||
|
return !text || (/^\d+$/.test(text) && Number(text) >= 12 && Number(text) <= 112) ? '' : 'Bitte geben Sie ein Alter zwischen 12 und 112 Jahren ein.';
|
||||||
|
if (fieldName === 'message')
|
||||||
|
return text.length <= 2000 ? '' : 'Die Nachricht darf höchstens 2.000 Zeichen enthalten.';
|
||||||
|
if (fieldName === 'caseWorker')
|
||||||
|
return text.length <= 160 ? '' : 'Die Angabe darf höchstens 160 Zeichen enthalten.';
|
||||||
|
if (fieldName === 'privacy')
|
||||||
|
return value ? '' : 'Bitte bestätigen Sie die Datenschutzhinweise.';
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
export function validateBookingForm({ name = '', email = '', phone = '', age = '', message = '', caseWorker = '', privacyAccepted = false }) {
|
||||||
|
const values = { name, email, phone, age, message, caseWorker, privacy: privacyAccepted };
|
||||||
|
return Object.fromEntries(Object.entries(values)
|
||||||
|
.map(([fieldName, value]) => [fieldName, validateBookingField(fieldName, value)])
|
||||||
|
.filter(([, error]) => error));
|
||||||
|
}
|
||||||
|
export function canSubmitBookingForm(privacyAccepted) {
|
||||||
|
return privacyAccepted;
|
||||||
|
}
|
||||||
|
export function bookingConfirmationMessage(appointmentTitle) {
|
||||||
|
return `Ihre Terminanfrage für ${appointmentTitle} wurde erfolgreich übermittelt.`;
|
||||||
|
}
|
||||||
const dateFormatter = new Intl.DateTimeFormat('de-DE', { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' });
|
const dateFormatter = new Intl.DateTimeFormat('de-DE', { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' });
|
||||||
const monthFormatter = new Intl.DateTimeFormat('de-DE', { month: 'long', year: 'numeric' });
|
const monthFormatter = new Intl.DateTimeFormat('de-DE', { month: 'long', year: 'numeric' });
|
||||||
const weekdays = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'];
|
const weekdays = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'];
|
||||||
function parseDate(value) {
|
function parseDate(value) {
|
||||||
return new Date(`${value}T12:00:00`);
|
return new Date(`${value}T12:00:00`);
|
||||||
}
|
}
|
||||||
function formatDateKey(date) {
|
export function formatDateKey(date) {
|
||||||
return date.toISOString().slice(0, 10);
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
}
|
}
|
||||||
function createMonthDates(month) {
|
function createMonthDates(month) {
|
||||||
const first = new Date(month.getFullYear(), month.getMonth(), 1);
|
const first = new Date(month.getFullYear(), month.getMonth(), 1);
|
||||||
@@ -35,6 +99,145 @@ function monthForProject(project) {
|
|||||||
const firstSlot = demoSlots.find((slot) => slot.project === project);
|
const firstSlot = demoSlots.find((slot) => slot.project === project);
|
||||||
return firstSlot ? new Date(parseDate(firstSlot.date).getFullYear(), parseDate(firstSlot.date).getMonth(), 1) : new Date();
|
return firstSlot ? new Date(parseDate(firstSlot.date).getFullYear(), parseDate(firstSlot.date).getMonth(), 1) : new Date();
|
||||||
}
|
}
|
||||||
|
function escapeHtml(value) {
|
||||||
|
return value.replace(/[&<>'"]/g, (character) => ({ '&': '&', '<': '<', '>': '>', "'": ''', '"': '"' })[character]);
|
||||||
|
}
|
||||||
|
function showFieldError(form, fieldName, error) {
|
||||||
|
const field = form.elements.namedItem(fieldName);
|
||||||
|
const errorId = `sufw-booking-${fieldName}-error`;
|
||||||
|
let message = form.querySelector(`#${errorId}`);
|
||||||
|
if (!message) {
|
||||||
|
message = document.createElement('span');
|
||||||
|
message.id = errorId;
|
||||||
|
message.className = 'sufw-booking__field-error';
|
||||||
|
message.setAttribute('role', 'alert');
|
||||||
|
message.style.display = 'block';
|
||||||
|
message.style.marginTop = '.35rem';
|
||||||
|
message.style.color = '#6c0808';
|
||||||
|
message.style.fontWeight = '400';
|
||||||
|
const host = fieldName === 'privacy' ? field.closest('label') : field;
|
||||||
|
host.insertAdjacentElement('afterend', message);
|
||||||
|
field.setAttribute('aria-describedby', errorId);
|
||||||
|
}
|
||||||
|
message.textContent = error;
|
||||||
|
message.hidden = !error;
|
||||||
|
field.setAttribute('aria-invalid', error ? 'true' : 'false');
|
||||||
|
}
|
||||||
|
function openConfirmationDialog(container, slot) {
|
||||||
|
const projectTitle = slot.project === 'perspektivwerk' ? 'PerspektivWerk' : 'Produktionsschule';
|
||||||
|
const dialog = document.createElement('dialog');
|
||||||
|
dialog.className = 'sufw-booking__dialog';
|
||||||
|
dialog.setAttribute('aria-labelledby', 'sufw-booking-confirmation-title');
|
||||||
|
dialog.innerHTML = `
|
||||||
|
<section class="sufw-booking__form">
|
||||||
|
<header class="sufw-booking__form-header">
|
||||||
|
<p class="sufw-booking__eyebrow">Termin angefragt</p>
|
||||||
|
<h2 id="sufw-booking-confirmation-title">Vielen Dank für Ihre Anfrage</h2>
|
||||||
|
<p>${escapeHtml(bookingConfirmationMessage(slot.title))}</p>
|
||||||
|
</header>
|
||||||
|
<p class="sufw-booking__appointment"><strong>${escapeHtml(projectTitle)}</strong><br>${escapeHtml(dateFormatter.format(parseDate(slot.date)))} · ${escapeHtml(slot.start)} Uhr · ${escapeHtml(slot.title)}</p>
|
||||||
|
<p>Wir senden Ihnen eine E-Mail zur Bestätigung Ihres Termins.</p>
|
||||||
|
<div class="sufw-booking__form-actions"><button type="button" data-close-confirmation>Schließen</button></div>
|
||||||
|
</section>`;
|
||||||
|
dialog.querySelector('[data-close-confirmation]').addEventListener('click', () => dialog.close());
|
||||||
|
dialog.addEventListener('close', () => dialog.remove());
|
||||||
|
container.append(dialog);
|
||||||
|
if (typeof dialog.showModal === 'function') {
|
||||||
|
dialog.showModal();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dialog.setAttribute('open', '');
|
||||||
|
dialog.querySelector('[data-close-confirmation]').focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function openBookingDialog(container, slot) {
|
||||||
|
const projectTitle = slot.project === 'perspektivwerk' ? 'PerspektivWerk' : 'Produktionsschule';
|
||||||
|
const dialog = document.createElement('dialog');
|
||||||
|
dialog.className = 'sufw-booking__dialog';
|
||||||
|
dialog.setAttribute('aria-labelledby', 'sufw-booking-form-title');
|
||||||
|
dialog.innerHTML = `
|
||||||
|
<form class="sufw-booking__form" novalidate>
|
||||||
|
<header class="sufw-booking__form-header">
|
||||||
|
<p class="sufw-booking__eyebrow">Termin anfragen</p>
|
||||||
|
<h2 id="sufw-booking-form-title">Ihre Angaben</h2>
|
||||||
|
<p class="sufw-booking__appointment"><strong>${escapeHtml(projectTitle)}</strong><br>${escapeHtml(dateFormatter.format(parseDate(slot.date)))} · ${escapeHtml(slot.start)} Uhr · ${escapeHtml(slot.title)}</p>
|
||||||
|
</header>
|
||||||
|
<p class="sufw-booking__required"><span aria-hidden="true">*</span> Pflichtfeld</p>
|
||||||
|
<div class="sufw-booking__form-grid">
|
||||||
|
<label>Vor- und Nachname <span aria-hidden="true">*</span><input name="name" type="text" autocomplete="name" required></label>
|
||||||
|
<label>E-Mail-Adresse <span aria-hidden="true">*</span><input name="email" type="email" autocomplete="email" required></label>
|
||||||
|
<label>Telefonnummer <span class="sufw-booking__optional">freiwillig</span><input name="phone" type="tel" autocomplete="tel"></label>
|
||||||
|
<label>Alter <span class="sufw-booking__optional">freiwillig</span><input name="age" type="number" min="12" max="112" inputmode="numeric"></label>
|
||||||
|
</div>
|
||||||
|
<label>Nachricht <span class="sufw-booking__optional">freiwillig</span><textarea name="message" rows="4"></textarea></label>
|
||||||
|
<label>Ansprechperson bei Agentur für Arbeit oder Jobcenter <span class="sufw-booking__optional">freiwillig</span><input name="caseWorker" type="text"></label>
|
||||||
|
<label class="sufw-booking__consent"><input name="privacy" type="checkbox" value="accepted" required><span>Ich habe die Datenschutzhinweise nach Art. 13 DSGVO gelesen und stimme der Verarbeitung meiner Angaben zur Terminanfrage zu. <span aria-hidden="true">*</span></span></label>
|
||||||
|
<div class="sufw-booking__form-actions"><button type="button" class="sufw-booking__secondary" data-close-dialog>Abbrechen</button><button type="submit" data-submit-booking disabled>Terminanfrage absenden</button></div>
|
||||||
|
</form>`;
|
||||||
|
const form = dialog.querySelector('form');
|
||||||
|
const privacy = form.elements.namedItem('privacy');
|
||||||
|
const submitButton = dialog.querySelector('[data-submit-booking]');
|
||||||
|
const actions = dialog.querySelector('.sufw-booking__form-actions');
|
||||||
|
dialog.style.overflowY = 'auto';
|
||||||
|
actions.style.position = 'sticky';
|
||||||
|
actions.style.bottom = '0';
|
||||||
|
actions.style.zIndex = '2';
|
||||||
|
actions.style.display = 'flex';
|
||||||
|
actions.style.visibility = 'visible';
|
||||||
|
actions.style.opacity = '1';
|
||||||
|
actions.style.backgroundColor = '#fff';
|
||||||
|
actions.style.paddingTop = '.75rem';
|
||||||
|
const fieldNames = ['name', 'email', 'phone', 'age', 'message', 'caseWorker', 'privacy'];
|
||||||
|
const validateField = (fieldName) => {
|
||||||
|
const field = form.elements.namedItem(fieldName);
|
||||||
|
const value = fieldName === 'privacy' ? field.checked : field.value;
|
||||||
|
const error = validateBookingField(fieldName, value);
|
||||||
|
showFieldError(form, fieldName, error);
|
||||||
|
return error;
|
||||||
|
};
|
||||||
|
const updateSubmitButton = () => {
|
||||||
|
submitButton.disabled = !canSubmitBookingForm(privacy.checked);
|
||||||
|
submitButton.hidden = false;
|
||||||
|
submitButton.style.display = 'inline-block';
|
||||||
|
submitButton.style.visibility = 'visible';
|
||||||
|
submitButton.style.opacity = '1';
|
||||||
|
submitButton.style.position = 'relative';
|
||||||
|
submitButton.style.zIndex = '3';
|
||||||
|
submitButton.style.minHeight = '2.75rem';
|
||||||
|
};
|
||||||
|
fieldNames.forEach((fieldName) => {
|
||||||
|
const field = form.elements.namedItem(fieldName);
|
||||||
|
const eventName = fieldName === 'privacy' ? 'change' : 'input';
|
||||||
|
field.addEventListener(eventName, () => validateField(fieldName));
|
||||||
|
if (fieldName !== 'privacy')
|
||||||
|
field.addEventListener('blur', () => validateField(fieldName));
|
||||||
|
});
|
||||||
|
privacy.addEventListener('change', updateSubmitButton);
|
||||||
|
updateSubmitButton();
|
||||||
|
form.addEventListener('submit', (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
const errors = Object.fromEntries(fieldNames
|
||||||
|
.map((fieldName) => [fieldName, validateField(fieldName)])
|
||||||
|
.filter(([, error]) => error));
|
||||||
|
if (Object.keys(errors).length) {
|
||||||
|
const firstInvalid = form.elements.namedItem(Object.keys(errors)[0]);
|
||||||
|
firstInvalid.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialog.close();
|
||||||
|
openConfirmationDialog(container, slot);
|
||||||
|
});
|
||||||
|
dialog.querySelector('[data-close-dialog]').addEventListener('click', () => dialog.close());
|
||||||
|
dialog.addEventListener('close', () => dialog.remove());
|
||||||
|
container.append(dialog);
|
||||||
|
if (typeof dialog.showModal === 'function') {
|
||||||
|
dialog.showModal();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dialog.setAttribute('open', '');
|
||||||
|
dialog.querySelector('input[name="name"]').focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
function renderComponent(container) {
|
function renderComponent(container) {
|
||||||
const configuredProject = container.dataset.project;
|
const configuredProject = container.dataset.project;
|
||||||
const project = configuredProject === 'produktionsschule' ? 'produktionsschule' : 'perspektivwerk';
|
const project = configuredProject === 'produktionsschule' ? 'produktionsschule' : 'perspektivwerk';
|
||||||
@@ -46,7 +249,7 @@ function renderComponent(container) {
|
|||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<section class="sufw-booking" aria-labelledby="sufw-booking-title">
|
<section class="sufw-booking" aria-labelledby="sufw-booking-title">
|
||||||
<header class="sufw-booking__header">
|
<header class="sufw-booking__header">
|
||||||
<p class="sufw-booking__eyebrow">Terminbuchung – Vorschau</p>
|
<p class="sufw-booking__eyebrow">Terminbuchung</p>
|
||||||
<h2 id="sufw-booking-title">${project === 'perspektivwerk' ? 'PerspektivWerk' : 'Produktionsschule'}</h2>
|
<h2 id="sufw-booking-title">${project === 'perspektivwerk' ? 'PerspektivWerk' : 'Produktionsschule'}</h2>
|
||||||
<p>Wählen Sie einen Tag. Freie Termine sind mit „frei“ gekennzeichnet.</p>
|
<p>Wählen Sie einen Tag. Freie Termine sind mit „frei“ gekennzeichnet.</p>
|
||||||
</header>
|
</header>
|
||||||
@@ -73,7 +276,7 @@ function renderComponent(container) {
|
|||||||
</div>
|
</div>
|
||||||
<section class="sufw-booking__slots" aria-labelledby="sufw-slot-title">
|
<section class="sufw-booking__slots" aria-labelledby="sufw-slot-title">
|
||||||
<h3 id="sufw-slot-title">Termine am ${selectedLabel}</h3>
|
<h3 id="sufw-slot-title">Termine am ${selectedLabel}</h3>
|
||||||
${slots.length ? `<ul>${slots.map((slot) => `<li><button type="button" class="sufw-booking__slot" data-slot-id="${slot.id}" ${slot.status === 'booked' ? 'disabled aria-disabled="true"' : ''}><strong>${slot.start} Uhr</strong><span>${slot.title}</span><em>${slot.status === 'available' ? 'Verfügbar' : 'Belegt'}</em></button></li>`).join('')}</ul>` : '<p class="sufw-booking__empty-state">Für diesen Tag liegen in der Vorschau keine Termine vor.</p>'}
|
${slots.length ? `<ul>${slots.map((slot) => `<li><button type="button" class="sufw-booking__slot" data-slot-id="${slot.id}" ${slot.status === 'booked' ? 'disabled aria-disabled="true"' : ''}><strong>${slot.start} Uhr</strong><span>${slot.title}</span><em>${slot.status === 'available' ? 'Verfügbar' : 'Belegt'}</em></button></li>`).join('')}</ul>` : '<p class="sufw-booking__empty-state">Für diesen Tag liegen keine Termine vor.</p>'}
|
||||||
<p class="sufw-booking__status" role="status" aria-live="polite"></p>
|
<p class="sufw-booking__status" role="status" aria-live="polite"></p>
|
||||||
</section>
|
</section>
|
||||||
</section>`;
|
</section>`;
|
||||||
@@ -89,11 +292,11 @@ function renderComponent(container) {
|
|||||||
selectedDate = button.dataset.date ?? '';
|
selectedDate = button.dataset.date ?? '';
|
||||||
render();
|
render();
|
||||||
}));
|
}));
|
||||||
container.querySelectorAll('[data-slot-id]').forEach((button) => button.addEventListener('click', () => {
|
container.querySelectorAll('[data-slot-id]').forEach((button) => button.addEventListener('click', () => {
|
||||||
const status = container.querySelector('.sufw-booking__status');
|
const slot = demoSlots.find((entry) => entry.id === button.dataset.slotId);
|
||||||
if (status)
|
if (slot)
|
||||||
status.textContent = 'Vorschau: Die eigentliche Buchungsmaske wird im nächsten Schritt ergänzt.';
|
openBookingDialog(container, slot);
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,20 @@ Describe 'Perspektivwerk static route' {
|
|||||||
(Get-FileHash -LiteralPath $bookingStylesPath).Hash | Should Be (Get-FileHash -LiteralPath $contaoBookingStylesPath).Hash
|
(Get-FileHash -LiteralPath $bookingStylesPath).Hash | Should Be (Get-FileHash -LiteralPath $contaoBookingStylesPath).Hash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
It 'keeps the enabled submit button visibly rendered' {
|
||||||
|
$script = Get-Content -LiteralPath $contaoBookingScriptPath -Raw
|
||||||
|
|
||||||
|
$script | Should Match "submitButton\.style\.visibility = 'visible'"
|
||||||
|
$script | Should Match "actions\.style\.position = 'sticky'"
|
||||||
|
}
|
||||||
|
|
||||||
|
It 'defines colours for the booking form action buttons' {
|
||||||
|
$styles = Get-Content -LiteralPath $contaoBookingStylesPath -Raw
|
||||||
|
|
||||||
|
$styles | Should Match '\.sufw-booking__form-actions button\s*\{[^}]*background-color:\s*#08752a'
|
||||||
|
$styles | Should Match '\.sufw-booking__form-actions button\s*\{[^}]*color:\s*#fff'
|
||||||
|
}
|
||||||
|
|
||||||
It 'routes /perspektivwerk to the static entry point before the Contao fallback' {
|
It 'routes /perspektivwerk to the static entry point before the Contao fallback' {
|
||||||
$htaccess = Get-Content -LiteralPath $htaccessPath -Raw
|
$htaccess = Get-Content -LiteralPath $htaccessPath -Raw
|
||||||
$staticRouteIndex = $htaccess.IndexOf('RewriteRule ^perspektivwerk/?$ perspektivwerk/index.html [L]')
|
$staticRouteIndex = $htaccess.IndexOf('RewriteRule ^perspektivwerk/?$ perspektivwerk/index.html [L]')
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import test from 'node:test';
|
import test from 'node:test';
|
||||||
|
|
||||||
import { getSlotsForDate } from '../public/booking/booking.js';
|
import { bookingConfirmationMessage, canSubmitBookingForm, formatDateKey, getSlotsForDate, validateBookingField, validateBookingForm } from '../public/booking/booking.js';
|
||||||
|
|
||||||
test('liefert für einen Beispieltag verfügbare und belegte Slots', () => {
|
test('liefert für einen Beispieltag verfügbare und belegte Slots', () => {
|
||||||
const slots = getSlotsForDate('perspektivwerk', '2026-08-25');
|
const slots = getSlotsForDate('perspektivwerk', '2026-08-25');
|
||||||
@@ -14,3 +14,70 @@ test('liefert für einen Beispieltag verfügbare und belegte Slots', () => {
|
|||||||
test('liefert für einen Tag ohne Termin keine Slots', () => {
|
test('liefert für einen Tag ohne Termin keine Slots', () => {
|
||||||
assert.deepEqual(getSlotsForDate('produktionsschule', '2026-08-20'), []);
|
assert.deepEqual(getSlotsForDate('produktionsschule', '2026-08-20'), []);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('verschiebt Kalendertage in der Sommerzeit nicht auf den Vortag', () => {
|
||||||
|
process.env.TZ = 'Europe/Berlin';
|
||||||
|
|
||||||
|
assert.equal(formatDateKey(new Date(2026, 7, 24)), '2026-08-24');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('liefert Termine im aktuellen und folgenden Monat', () => {
|
||||||
|
assert.ok(getSlotsForDate('perspektivwerk', '2026-08-24').length >= 2);
|
||||||
|
assert.ok(getSlotsForDate('perspektivwerk', '2026-08-28').length >= 2);
|
||||||
|
assert.ok(getSlotsForDate('perspektivwerk', '2026-09-02').length >= 2);
|
||||||
|
assert.ok(getSlotsForDate('perspektivwerk', '2026-09-15').length >= 2);
|
||||||
|
assert.ok(getSlotsForDate('perspektivwerk', '2026-09-29').length >= 2);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('validiert die Pflichtangaben der Buchungsmaske', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
validateBookingForm({ name: '', email: 'ungültig', privacyAccepted: false }),
|
||||||
|
{
|
||||||
|
name: 'Bitte geben Sie Ihren Namen ein.',
|
||||||
|
email: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.',
|
||||||
|
privacy: 'Bitte bestätigen Sie die Datenschutzhinweise.'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('akzeptiert die vollständigen Pflichtangaben der Buchungsmaske', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
validateBookingForm({ name: 'Max Mustermann', email: 'max@example.org', privacyAccepted: true }),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('lehnt ein eingegebenes Alter außerhalb von 12 bis 112 ab', () => {
|
||||||
|
assert.equal(
|
||||||
|
validateBookingForm({ name: 'Max Mustermann', email: 'max@example.org', age: '11', privacyAccepted: true }).age,
|
||||||
|
'Bitte geben Sie ein Alter zwischen 12 und 112 Jahren ein.'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
validateBookingForm({ name: 'Max Mustermann', email: 'max@example.org', age: '113', privacyAccepted: true }).age,
|
||||||
|
'Bitte geben Sie ein Alter zwischen 12 und 112 Jahren ein.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('akzeptiert ein leeres oder gültiges optionales Alter', () => {
|
||||||
|
assert.deepEqual(validateBookingForm({ name: 'Max Mustermann', email: 'max@example.org', age: '', privacyAccepted: true }), {});
|
||||||
|
assert.deepEqual(validateBookingForm({ name: 'Max Mustermann', email: 'max@example.org', age: '12', privacyAccepted: true }), {});
|
||||||
|
assert.deepEqual(validateBookingForm({ name: 'Max Mustermann', email: 'max@example.org', age: '112', privacyAccepted: true }), {});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('validiert optionale Telefonnummern direkt am Feld', () => {
|
||||||
|
assert.equal(validateBookingField('phone', 'abc'), 'Bitte geben Sie eine gültige Telefonnummer ein.');
|
||||||
|
assert.equal(validateBookingField('phone', '+49 351 123456'), '');
|
||||||
|
assert.equal(validateBookingField('phone', ''), '');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('gibt den Absenden-Button erst nach DSGVO-Einwilligung frei', () => {
|
||||||
|
assert.equal(canSubmitBookingForm(false), false);
|
||||||
|
assert.equal(canSubmitBookingForm(true), true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('zeigt nach dem Absenden eine Bestätigung ohne Mockup-Hinweis', () => {
|
||||||
|
const message = bookingConfirmationMessage('Erstgespräch');
|
||||||
|
|
||||||
|
assert.match(message, /erfolgreich übermittelt/);
|
||||||
|
assert.doesNotMatch(message, /Vorschau|Mockup/i);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user