Beratung: Gegenvorschläge nur zur halben Stunde in den nächsten 14 Tagen; bei offener Überweisung kein zweiter Bezahlknopf
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
14d16a55c8
commit
dcfe85627f
2 changed files with 7 additions and 4 deletions
|
|
@ -17,7 +17,7 @@ export default async function MyAppointments({ searchParams }: { searchParams: P
|
|||
if (!user) redirect("/konto/anmelden?weiter=/konto/termine");
|
||||
const q = await searchParams;
|
||||
const [list, s] = await Promise.all([
|
||||
db.appointment.findMany({ where: { customerId: user.id }, orderBy: { startsAt: "desc" }, include: { advisor: { select: { displayName: true, slug: true, photo: true } }, proposals: { orderBy: { startsAt: "asc" } } } }),
|
||||
db.appointment.findMany({ where: { customerId: user.id }, orderBy: { startsAt: "desc" }, include: { advisor: { select: { displayName: true, slug: true, photo: true } }, proposals: { orderBy: { startsAt: "asc" } }, order: { select: { status: true, paymentStatus: true, paymentMethod: true } } } }),
|
||||
getConsultingSettings(),
|
||||
]);
|
||||
const now = new Date();
|
||||
|
|
@ -68,7 +68,9 @@ export default async function MyAppointments({ searchParams }: { searchParams: P
|
|||
</div>
|
||||
</div>
|
||||
)}
|
||||
{a.status === "confirmed" && (
|
||||
{a.status === "confirmed" && a.order?.status === "PENDING" && ["prepayment", "invoice"].includes(a.order.paymentMethod) ? (
|
||||
<p className="body-sm">Wir warten auf deine Zahlung{a.expiresAt ? ` (bis ${fmtDateTime(a.expiresAt)})` : ""}. Die Zahlungsdaten stehen in deiner Bestellbestätigung. Sobald das Geld da ist, ist der Termin gebucht.</p>
|
||||
) : a.status === "confirmed" && (
|
||||
<div className="sm-btn-row">
|
||||
<Link className="sm-btn sm-btn--primary" href={`/beratung/bezahlen/${a.id}`}>Jetzt bezahlen</Link>
|
||||
{a.expiresAt && <span className="body-sm sm-muted">bis {fmtDateTime(a.expiresAt)}</span>}
|
||||
|
|
|
|||
|
|
@ -29,12 +29,13 @@ export default async function AdvisorDashboard({ searchParams }: { searchParams:
|
|||
// Freie Zeiten für Gegenvorschläge, je Anfrage passend zur Dauer
|
||||
const slotOptions = new Map<string, { label: string; options: { value: string; label: string }[] }[]>();
|
||||
for (const r of requests.filter((r) => r.status === "requested")) {
|
||||
const map = await freeSlots(plan!, { duration: r.duration, buffer: r.offer?.buffer ?? 10 }, { exceptId: r.id, days: 28 });
|
||||
const map = await freeSlots(plan!, { duration: r.duration, buffer: r.offer?.buffer ?? 10 }, { exceptId: r.id, days: 14 });
|
||||
slotOptions.set(
|
||||
r.id,
|
||||
[...map.entries()].slice(0, 21).map(([, slots]) => ({
|
||||
label: new Intl.DateTimeFormat("de-DE", { timeZone: "Europe/Berlin", weekday: "long", day: "2-digit", month: "2-digit" }).format(slots[0]),
|
||||
options: slots.filter((s) => s.getTime() !== r.startsAt.getTime()).map((s) => ({ value: s.toISOString(), label: `${new Intl.DateTimeFormat("de-DE", { timeZone: "Europe/Berlin", weekday: "short", day: "2-digit", month: "2-digit" }).format(s)}, ${fmtTime(s)} Uhr` })),
|
||||
// Halbe Stunden reichen für Vorschläge, sonst wird die Liste unübersichtlich lang
|
||||
options: slots.filter((s) => s.getTime() !== r.startsAt.getTime() && s.getUTCMinutes() % 30 === 0).map((s) => ({ value: s.toISOString(), label: `${new Intl.DateTimeFormat("de-DE", { timeZone: "Europe/Berlin", weekday: "short", day: "2-digit", month: "2-digit" }).format(s)}, ${fmtTime(s)} Uhr` })),
|
||||
})).filter((g) => g.options.length),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue