- Rollen "Beraterin" und "Esoterik-Leitung", neue Rechte consulting.own/manage/settings; "nur eigene" wird im Server geprüft - Admin: Meine Termine (Anfragen bestätigen, bis zu 3 Gegenvorschläge aus freien Zeiten, ablehnen, Notiz, Absage mit Erstattung), Profil (mit Hinweis gegen Heilversprechen), Angebote (Freigabe durch den Shop), Wochenplan und Ausnahmen; Beraterinnen freigeben/pausieren, Provision; alle Termine; Einstellungen (Fristen, Stornoregeln, Preisgrenzen, Menü) - Shop: Portal /beratung mit Filtern und nächstem freien Termin, Profilseite mit Buchung (Angebot, Video/Audio, freie Zeiten in der Zeitzone der Kundin, Anliegen, 18+ und Hinweis), Bezahlseite (Rechnungsadresse, Zahlart, Widerrufs-Zustimmung bei Terminen in 14 Tagen), Meine Termine (Vorschlag annehmen, bezahlen, Raum, .ics, Absage) - Buchung als Bestellung mit Beratungs-Position und Rechnung; gebucht bei Zahlungseingang, Storno erstattet nach Regeln - Zeitplaner: Anfragen verfallen nach 48 h, unbezahlte Termine nach 24 h, Erinnerungen 24 h/1 h, Erinnerung an offene Anfragen - 13 Mailvorlagen (Gruppe Beratung), .ics-Anhang; Mail-Anhänge allgemein möglich - Call-Raum mit LiveKit (selbst gehostet, eigener Container im Host-Netz, Schlüssel erzeugt der Shop), Token nur für den Termin (10 Min. vorher bis 15 Min. nach Ende), Kamera-/Mikrotest, Audio-only, Bildschirm teilen, Chat - Esoterik-Rubrik: "Kartenlegen" im Menü und in der Rubrik; Konto löschen sagt offene Termine ab Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
81 lines
4.5 KiB
TypeScript
81 lines
4.5 KiB
TypeScript
import Link from "next/link";
|
|
import { notFound } from "next/navigation";
|
|
import { db } from "@/lib/db";
|
|
import { can, getCurrentUser } from "@/lib/auth";
|
|
import { NOTICE, freeSlots, getConsultingSettings } from "@/lib/consulting";
|
|
import { Icon } from "@/components/Icon";
|
|
import { Alert } from "@/components/shop/Blocks";
|
|
import { BookingForm } from "@/components/shop/BookingForm";
|
|
|
|
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }) {
|
|
const a = await db.advisor.findUnique({ where: { slug: (await params).slug } });
|
|
return { title: a ? `${a.displayName} · Kartenlegen` : "Beratung", description: a?.tagline };
|
|
}
|
|
|
|
export default async function AdvisorPage({ params }: { params: Promise<{ slug: string }> }) {
|
|
const { slug } = await params;
|
|
const [user, settings] = await Promise.all([getCurrentUser(), getConsultingSettings()]);
|
|
const a = await db.advisor.findUnique({
|
|
where: { slug },
|
|
include: { offers: { where: { active: true, approved: true }, orderBy: [{ sort: "asc" }, { price: "asc" }] }, rules: true, exceptions: true },
|
|
});
|
|
// Nicht freigegebene Profile sieht nur das Team (zur Vorschau) und die Beraterin selbst
|
|
const preview = a && a.status !== "approved" && (a.userId === user?.id || can(user, "consulting.manage"));
|
|
if (!a || (a.status !== "approved" && !preview)) notFound();
|
|
const slots: Record<string, { date: string; slots: string[] }[]> = {};
|
|
for (const o of a.offers) {
|
|
const map = await freeSlots(a, o, { days: 35 });
|
|
slots[o.id] = [...map.entries()].map(([date, list]) => ({ date, slots: list.map((d) => d.toISOString()) }));
|
|
}
|
|
return (
|
|
<main className="sm-container sm-page sm-consult">
|
|
<nav aria-label="Du bist hier">
|
|
<ol className="sm-crumbs">
|
|
<li><Link href="/">Start</Link></li>
|
|
<li><Link href="/beratung">{settings.navLabel}</Link></li>
|
|
<li aria-current="page">{a.displayName}</li>
|
|
</ol>
|
|
</nav>
|
|
{preview && <div style={{ margin: "var(--space-4) 0" }}><Alert title="Vorschau: Dieses Profil ist noch nicht im Shop zu sehen." /></div>}
|
|
<div className="sm-profile">
|
|
<div className="sm-profile__about">
|
|
<div className="sm-profile__head">
|
|
{a.photo ? (
|
|
// eslint-disable-next-line @next/next/no-img-element
|
|
<img src={a.photo} alt="" />
|
|
) : (
|
|
<span className="sm-advisor__ph" aria-hidden="true">{a.displayName.charAt(0)}</span>
|
|
)}
|
|
<div>
|
|
<h1 className="display-lg">{a.displayName}</h1>
|
|
{a.tagline && <p className="body sm-muted">{a.tagline}</p>}
|
|
</div>
|
|
</div>
|
|
<div className="sm-advisor__chips">{[...a.topics, ...a.methods].map((t) => <span key={t} className="sm-chip sm-chip--sm">{t}</span>)}</div>
|
|
{a.languages.length > 0 && <p className="body-sm sm-muted">Sprachen: {a.languages.join(", ")}</p>}
|
|
{a.bio && <div className="body" style={{ whiteSpace: "pre-line", marginTop: "var(--space-5)" }}>{a.bio}</div>}
|
|
<p className="sm-consult__notice" style={{ marginTop: "var(--space-6)" }}><Icon name="info" /> {NOTICE}</p>
|
|
<details className="sm-acc">
|
|
<summary>So läuft es ab</summary>
|
|
<div className="sm-acc__body">
|
|
Du fragst einen Wunschtermin an, das ist kostenlos. {a.displayName} bestätigt ihn oder schlägt andere Zeiten vor. Erst dann bezahlst du, und der Termin ist fest. Zur Legung öffnest du 10 Minuten vorher unter „Meine Termine“ den Raum, direkt im Browser mit Kamera und Mikrofon (oder nur Mikrofon). Es wird nichts aufgezeichnet. Bis {settings.refundHours} Stunden vorher kannst du kostenlos absagen.
|
|
</div>
|
|
</details>
|
|
</div>
|
|
<aside className="sm-profile__book">
|
|
<h2 className="display-sm" style={{ marginBottom: "var(--space-4)" }}>Termin anfragen</h2>
|
|
<BookingForm
|
|
advisorId={a.id}
|
|
advisorName={a.displayName}
|
|
offers={a.offers.map((o) => ({ id: o.id, name: o.name, description: o.description, duration: o.duration, price: o.price, mode: o.mode }))}
|
|
slots={slots}
|
|
loggedIn={Boolean(user)}
|
|
loginHref={`/konto/anmelden?weiter=/beratung/${a.slug}`}
|
|
user={user ? { firstName: user.firstName, lastName: user.lastName, phone: user.phone } : undefined}
|
|
notice={`Mir ist bewusst: ${NOTICE.replace(" Buchung ab 18 Jahren.", "")}`}
|
|
/>
|
|
</aside>
|
|
</div>
|
|
</main>
|
|
);
|
|
}
|