ADD: changed to rect router

This commit is contained in:
hwinkel
2026-03-10 21:49:01 +01:00
parent 44e79e657f
commit 4bc57b2c4e
102 changed files with 5067 additions and 4824 deletions
+49
View File
@@ -0,0 +1,49 @@
import { Link, useNavigate } from "react-router";
import { CompanyForm } from "@/components/company/company-form";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ChevronLeft } from "lucide-react";
export default function NewCompanyPage() {
const navigate = useNavigate();
async function handleSubmit(data: Record<string, unknown>) {
const res = await fetch("/api/companies", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data),
});
if (res.ok) {
const company = await res.json();
navigate(`/companies/${company.id}`);
}
}
return (
<div>
<Link
to="/companies"
className="inline-flex items-center gap-1 text-sm text-gray-500 hover:text-gray-700 mb-6"
>
<ChevronLeft className="h-4 w-4" /> Zurück zu Mandanten
</Link>
<div className="mb-8">
<h1 className="text-2xl font-bold text-gray-900">Neuer Mandant</h1>
<p className="text-gray-500 mt-1">Legen Sie einen neuen Mandanten an</p>
</div>
<Card>
<CardHeader>
<CardTitle>Mandantendaten</CardTitle>
</CardHeader>
<CardContent>
<CompanyForm
onSubmit={handleSubmit}
submitLabel="Mandant anlegen"
/>
</CardContent>
</Card>
</div>
);
}