1
0
Fork 0
fahrPool/web/app/firma/page.tsx

48 lines
1.7 KiB
TypeScript

import { redirect } from "next/navigation";
import { createAdminClient } from "@/lib/supabase/admin";
import { ladeAdminKontext } from "@/lib/firma/admin-kontext";
import { ladeFirmenSmtp, type SmtpAnzeige } from "@/lib/firma/smtp";
import { FirmaEinstellungenForm } from "@/components/firma/FirmaEinstellungenForm";
import { LogoForm } from "@/components/firma/LogoForm";
import { SmtpForm } from "@/components/firma/SmtpForm";
import { Card } from "@/components/ui/Card";
export default async function FirmaPage() {
const kontext = await ladeAdminKontext();
if (!kontext.ok) {
redirect("/dashboard");
}
// Das Passwort verlaesst den Server nie, nur ob eins gesetzt ist.
const zeile = await ladeFirmenSmtp(createAdminClient(), kontext.firma.id);
const smtp: SmtpAnzeige | null = zeile
? {
host: zeile.host,
port: zeile.port,
secure: zeile.secure,
benutzer: zeile.benutzer,
absender_adresse: zeile.absender_adresse,
absender_name: zeile.absender_name,
passwortGesetzt: Boolean(zeile.passwort_verschluesselt),
}
: null;
return (
<div className="mx-auto flex max-w-2xl flex-col gap-6 p-4 md:p-8">
<h1 className="text-xl font-semibold text-asphalt-grey">Firma</h1>
<Card>
<h2 className="mb-4 font-semibold text-asphalt-grey">Allgemein</h2>
<FirmaEinstellungenForm firma={kontext.firma} />
</Card>
<Card>
<h2 className="mb-4 font-semibold text-asphalt-grey">Logo</h2>
<LogoForm hatLogo={Boolean(kontext.firma.logo_pfad)} />
</Card>
<Card>
<h2 className="mb-4 font-semibold text-asphalt-grey">E-Mail-Versand (SMTP)</h2>
<SmtpForm smtp={smtp} />
</Card>
</div>
);
}