feat(booking): Restzahlung bar oder per Überweisung mit Zahlungserinnerung und Verfügbarkeitsampel
- Buchung: neues Feld balance_method (cash|transfer) inkl. Migration 019, Formularfeld, Validierung (Konto Pflicht bei Überweisung), Anzeige in Buchungsdetail und kopiertem Kundentext. - Auftragsbestätigung: bei Überweisung Bankverbindung der Buchung, Restbetrag mit Zahlungsziel (5 Tage vor Mietbeginn) und Hinweis auf die Erinnerung; bei Barzahlung unverändert "bei der Übergabe in bar fällig". - Zahlungserinnerung als eigene Unterlage (Migration 018): offener Betrag (Restbetrag bei Anzahlung, sonst Gesamtbetrag), Konto der Buchung, Frist, Erzeugen/Mailen über die Buchungsseite, Handbuch und README. - Automatischer Versand: payment_reminder_send_due() im Cron-Lauf, 10 Tage vor Mietbeginn (app.transfer_reminder_days), genau ein Versand pro Termin über payment_reminder_log, kein Doppelversand nach manuellem Mailen. - Startseite: öffentliche Verfügbarkeitsampel für Kühlanhänger ohne Truhen (GET /verfuegbarkeit.json, availability_public_days()), Monatskalender mit Grün (>2 frei), Gelb (1-2) und Rot (ausgebucht); neuer Abschnitt #verfuegbarkeit inkl. Navigation, Footer und noscript-Hinweis. - Aufräumen: payment_reminder_log nach einem Jahr, Cron-Report erweitert.
This commit is contained in:
parent
506d802b33
commit
7445740b90
21 changed files with 911 additions and 46 deletions
|
|
@ -1248,6 +1248,98 @@ button { font: inherit; color: inherit; cursor: pointer; }
|
|||
.reveal { opacity: 1; transform: none; }
|
||||
}
|
||||
|
||||
/* ---------- Verfügbarkeitskalender (Startseite) ---------- */
|
||||
.avail-section { background: var(--ice-50); }
|
||||
.avail-head { max-width: 46rem; }
|
||||
.avail {
|
||||
margin-top: clamp(1.5rem, 3vw, 2.25rem);
|
||||
padding: clamp(1rem, 2.4vw, 1.6rem);
|
||||
background: var(--white);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
.avail__bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
|
||||
.avail__month {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
font-weight: 700;
|
||||
font-size: clamp(1rem, 1.6vw, 1.15rem);
|
||||
color: var(--brand-800);
|
||||
}
|
||||
.avail__nav {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 2.35rem;
|
||||
height: 2.35rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 50%;
|
||||
background: var(--white);
|
||||
color: var(--brand-700);
|
||||
cursor: pointer;
|
||||
transition: background .18s ease, border-color .18s ease;
|
||||
}
|
||||
.avail__nav svg { width: 1.2rem; height: 1.2rem; }
|
||||
.avail__nav:hover:not(:disabled) { background: var(--ice-100); border-color: var(--ice-200); }
|
||||
.avail__nav:disabled { opacity: .35; cursor: default; }
|
||||
.avail__weekdays,
|
||||
.avail__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||||
gap: clamp(.25rem, .8vw, .45rem);
|
||||
}
|
||||
.avail__weekdays {
|
||||
margin-top: 1rem;
|
||||
font-size: .72rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: .04em;
|
||||
text-transform: uppercase;
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
}
|
||||
.avail__grid { margin-top: .35rem; }
|
||||
.avail__day {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: .1rem;
|
||||
aspect-ratio: 1 / 1;
|
||||
min-height: 2.6rem;
|
||||
padding: .2rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--ice-50);
|
||||
font-size: clamp(.78rem, 1.2vw, .95rem);
|
||||
font-weight: 600;
|
||||
color: var(--ink);
|
||||
}
|
||||
.avail__day--empty { border: 0; background: transparent; }
|
||||
.avail__day--past { opacity: .35; }
|
||||
.avail__day small { font-size: .62rem; font-weight: 500; color: inherit; opacity: .8; }
|
||||
.avail__day--free { background: #e8f7ec; border-color: #b7e3c3; color: #1d6b33; }
|
||||
.avail__day--few { background: var(--amber-soft); border-color: #f6d8ab; color: #8a5a12; }
|
||||
.avail__day--full { background: #fdeaea; border-color: #f4c4c4; color: #a32424; }
|
||||
.avail__day--unknown { background: var(--ice-100); color: var(--muted); }
|
||||
.avail__day.is-today { outline: 2px solid var(--brand); outline-offset: 1px; }
|
||||
.avail__note { margin: .85rem 0 0; font-size: .85rem; color: var(--muted); }
|
||||
.avail__legend {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: .5rem 1.25rem;
|
||||
margin: 1rem 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
font-size: .85rem;
|
||||
color: var(--ink-2);
|
||||
}
|
||||
.avail__legend li { display: inline-flex; align-items: center; gap: .4rem; }
|
||||
.avail__dot { width: .8rem; height: .8rem; border-radius: 50%; }
|
||||
.avail__dot--free { background: #4caf6a; }
|
||||
.avail__dot--few { background: var(--amber); }
|
||||
.avail__dot--full { background: #d9534f; }
|
||||
|
||||
@media print {
|
||||
.header, .nav, .hero__scroll, .lightbox, .form-card { display: none !important; }
|
||||
body { color: #000; }
|
||||
|
|
|
|||
|
|
@ -221,4 +221,114 @@
|
|||
});
|
||||
});
|
||||
}
|
||||
/* ---------- Verfügbarkeitskalender (Ampel aus /verfuegbarkeit.json) ---------- */
|
||||
var avail = document.querySelector('[data-avail]');
|
||||
if (avail) {
|
||||
var grid = avail.querySelector('[data-avail-grid]');
|
||||
var label = avail.querySelector('[data-avail-label]');
|
||||
var note = avail.querySelector('[data-avail-note]');
|
||||
var prev = avail.querySelector('[data-avail-prev]');
|
||||
var next = avail.querySelector('[data-avail-next]');
|
||||
var months = []; // [{ key: '2026-06', days: { '2026-06-01': {...} } }]
|
||||
var cursor = 0;
|
||||
var weekdays = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'];
|
||||
var monthNames = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli',
|
||||
'August', 'September', 'Oktober', 'November', 'Dezember'];
|
||||
|
||||
var isoDate = function (date) {
|
||||
return date.getFullYear() + '-' +
|
||||
String(date.getMonth() + 1).padStart(2, '0') + '-' +
|
||||
String(date.getDate()).padStart(2, '0');
|
||||
};
|
||||
|
||||
var render = function () {
|
||||
var month = months[cursor];
|
||||
if (!month || !grid) return;
|
||||
var parts = month.key.split('-');
|
||||
var year = Number(parts[0]);
|
||||
var monthIndex = Number(parts[1]) - 1;
|
||||
var today = isoDate(new Date());
|
||||
if (label) label.textContent = monthNames[monthIndex] + ' ' + year;
|
||||
|
||||
var first = new Date(year, monthIndex, 1);
|
||||
var offset = (first.getDay() + 6) % 7; // Montag = 0
|
||||
var daysInMonth = new Date(year, monthIndex + 1, 0).getDate();
|
||||
var html = '';
|
||||
var i;
|
||||
for (i = 0; i < offset; i++) {
|
||||
html += '<div class="avail__day avail__day--empty"></div>';
|
||||
}
|
||||
for (i = 1; i <= daysInMonth; i++) {
|
||||
var iso = year + '-' + String(monthIndex + 1).padStart(2, '0') + '-' + String(i).padStart(2, '0');
|
||||
var day = month.days[iso];
|
||||
var level = day ? day.level : 'unknown';
|
||||
var classes = 'avail__day avail__day--' + level;
|
||||
if (iso < today) classes += ' avail__day--past';
|
||||
if (iso === today) classes += ' is-today';
|
||||
var hint = '';
|
||||
if (day && level !== 'unknown') {
|
||||
hint = '<small>' + (day.free > 0 ? day.free + ' frei' : 'ausgebucht') + '</small>';
|
||||
}
|
||||
var title = day
|
||||
? (day.free > 0 ? day.free + ' von ' + (day.free + day.booked) + ' Anhängern frei' : 'ausgebucht')
|
||||
: 'keine Angabe';
|
||||
html += '<div class="' + classes + '" title="' + title + '">' + i + hint + '</div>';
|
||||
}
|
||||
grid.innerHTML = html;
|
||||
if (prev) prev.disabled = cursor <= 0;
|
||||
if (next) next.disabled = cursor >= months.length - 1;
|
||||
|
||||
var shown = month.key;
|
||||
if (note) {
|
||||
var freeDays = 0;
|
||||
var bookedDays = 0;
|
||||
Object.keys(month.days).forEach(function (key) {
|
||||
if (month.days[key].level === 'full' && key >= today) bookedDays++;
|
||||
if (month.days[key].level !== 'unknown' && month.days[key].free > 0 && key >= today) freeDays++;
|
||||
});
|
||||
note.textContent = bookedDays === 0
|
||||
? 'In diesem Monat ist noch jeder Tag buchbar.'
|
||||
: freeDays + ' Tage mit freien Anhängern, ' + bookedDays + ' Tage ausgebucht. '
|
||||
+ 'Tagesaktueller Stand, keine Reservierung.';
|
||||
}
|
||||
void shown;
|
||||
};
|
||||
|
||||
var fill = function (payload) {
|
||||
if (!payload || payload.ok === false) throw new Error('unavailable');
|
||||
var byMonth = {};
|
||||
(payload.days || []).forEach(function (day) {
|
||||
var key = String(day.date).slice(0, 7);
|
||||
if (!byMonth[key]) byMonth[key] = {};
|
||||
byMonth[key][day.date] = day;
|
||||
});
|
||||
months = Object.keys(byMonth).sort().map(function (key) {
|
||||
return { key: key, days: byMonth[key] };
|
||||
});
|
||||
if (!months.length) throw new Error('unavailable');
|
||||
var currentKey = isoDate(new Date()).slice(0, 7);
|
||||
cursor = 0;
|
||||
months.forEach(function (month, index) {
|
||||
if (month.key === currentKey) cursor = index;
|
||||
});
|
||||
render();
|
||||
};
|
||||
|
||||
if (prev) prev.addEventListener('click', function () { if (cursor > 0) { cursor--; render(); } });
|
||||
if (next) next.addEventListener('click', function () { if (cursor < months.length - 1) { cursor++; render(); } });
|
||||
|
||||
var start = new Date();
|
||||
var end = new Date();
|
||||
end.setDate(end.getDate() + 75);
|
||||
fetch('/verfuegbarkeit.json?from=' + isoDate(start) + '&to=' + isoDate(end), { headers: { Accept: 'application/json' } })
|
||||
.then(function (response) { return response.json().catch(function () { return {}; }); })
|
||||
.then(fill)
|
||||
.catch(function () {
|
||||
if (label) label.textContent = 'Verfügbarkeit gerade nicht abrufbar';
|
||||
if (note) note.textContent = 'Bitte fragen Sie Ihren Wunschtermin direkt an – wir melden uns mit einer Rückmeldung.';
|
||||
if (prev) prev.disabled = true;
|
||||
if (next) next.disabled = true;
|
||||
});
|
||||
void weekdays;
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<link rel="preload" as="font" type="font/woff2" href="assets/fonts/manrope-latin.woff2" crossorigin>
|
||||
<link rel="preload" as="font" type="font/woff2" href="assets/fonts/inter-latin.woff2" crossorigin>
|
||||
<link rel="preload" as="image" imagesrcset="assets/img/hero-800.webp 800w, assets/img/hero-1280.webp 1280w, assets/img/hero-1920.webp 1920w" imagesizes="100vw">
|
||||
<link rel="stylesheet" href="assets/css/style.css?v=9">
|
||||
<link rel="stylesheet" href="assets/css/style.css?v=10">
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
|
|
@ -98,6 +98,7 @@
|
|||
|
||||
<nav class="nav" id="nav" aria-label="Hauptnavigation">
|
||||
<a href="#anhaenger">Der Anhänger</a>
|
||||
<a href="#verfuegbarkeit">Verfügbarkeit</a>
|
||||
<a href="#ausstattung">Ausstattung</a>
|
||||
<a href="#galerie">Galerie</a>
|
||||
<a href="#preise">Preise</a>
|
||||
|
|
@ -175,6 +176,45 @@
|
|||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ============ Verfügbarkeit ============ -->
|
||||
<section class="section avail-section" id="verfuegbarkeit">
|
||||
<div class="container">
|
||||
<div class="avail-head reveal">
|
||||
<p class="eyebrow">Verfügbarkeit</p>
|
||||
<h2 class="h2">An welchen Tagen ist noch ein Anhänger frei?</h2>
|
||||
<p class="lead">Die Ampel zeigt den aktuellen Stand unserer Kühlanhänger – ohne Truhen, ohne Namen. Grün heißt:
|
||||
mehr als zwei Anhänger frei, gelb: ein bis zwei frei, rot: ausgebucht. Für einen verbindlichen Termin einfach
|
||||
<a href="#anfrage">anfragen</a>.</p>
|
||||
</div>
|
||||
|
||||
<div class="avail reveal" data-avail>
|
||||
<div class="avail__bar">
|
||||
<button class="avail__nav" type="button" data-avail-prev aria-label="Vorheriger Monat">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m14 6-6 6 6 6"/></svg>
|
||||
</button>
|
||||
<p class="avail__month" data-avail-label aria-live="polite">Verfügbarkeit wird geladen …</p>
|
||||
<button class="avail__nav" type="button" data-avail-next aria-label="Nächster Monat">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m10 6 6 6-6 6"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="avail__weekdays" aria-hidden="true">
|
||||
<span>Mo</span><span>Di</span><span>Mi</span><span>Do</span><span>Fr</span><span>Sa</span><span>So</span>
|
||||
</div>
|
||||
<div class="avail__grid" data-avail-grid></div>
|
||||
<p class="avail__note" data-avail-note></p>
|
||||
<ul class="avail__legend">
|
||||
<li><span class="avail__dot avail__dot--free"></span> mehr als 2 frei</li>
|
||||
<li><span class="avail__dot avail__dot--few"></span> 1–2 frei</li>
|
||||
<li><span class="avail__dot avail__dot--full"></span> ausgebucht</li>
|
||||
</ul>
|
||||
<noscript>
|
||||
<p class="avail__note">Bitte fragen Sie Ihren Wunschtermin direkt an – die Verfügbarkeitsanzeige benötigt
|
||||
JavaScript.</p>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ============ Der Anhänger ============ -->
|
||||
<section class="section" id="anhaenger">
|
||||
<div class="container split">
|
||||
|
|
@ -720,6 +760,7 @@
|
|||
<h4>Seite</h4>
|
||||
<ul>
|
||||
<li><a href="#anhaenger">Der Anhänger</a></li>
|
||||
<li><a href="#verfuegbarkeit">Verfügbarkeit</a></li>
|
||||
<li><a href="#preise">Preise</a></li>
|
||||
<li><a href="#technik">Technik</a></li>
|
||||
<li><a href="#anfrage">Terminanfrage</a></li>
|
||||
|
|
@ -778,7 +819,7 @@
|
|||
<img id="lightboxImg" alt="">
|
||||
</div>
|
||||
|
||||
<script src="assets/js/main.js?v=5" defer></script>
|
||||
<script src="assets/js/main.js?v=6" defer></script>
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function () {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* zwischengespeichert, damit niemand veraltete Buchungen sieht.
|
||||
*/
|
||||
|
||||
const VERSION = 'dic-v25';
|
||||
const VERSION = 'dic-v26';
|
||||
const CACHE = VERSION;
|
||||
const BASE = new URL(self.registration.scope).pathname.replace(/\/$/, '');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue