44e79e657f
Full-stack German accounting & invoice management web application: - Multi-company management (Mandantenverwaltung) with full CRUD - Invoice creation with dynamic line items and automatic tax calculation - Sequential invoice numbering per company (RE-2024-001 format) - §14 UStG compliant PDF invoice generation via @react-pdf/renderer - Customer management (Kundenverwaltung) per company - Tax reports: quarterly USt-Voranmeldung and monthly revenue overview - Email/password authentication via NextAuth.js v5 - Responsive, modern UI with Tailwind CSS and custom shadcn/ui components - Prisma v5 ORM with MySQL/MariaDB schema + demo seed data Stack: Next.js 14 (App Router) · TypeScript · Prisma/MySQL · NextAuth.js https://claude.ai/code/session_01FN53KKxo5ebrGwqFhxzkT9
31 lines
842 B
TypeScript
31 lines
842 B
TypeScript
"use client";
|
|
|
|
import { useRouter } from "next/navigation";
|
|
import { InvoiceForm } from "@/components/invoice/invoice-form";
|
|
|
|
interface Props {
|
|
customers: { id: string; name: string }[];
|
|
companyId: string;
|
|
}
|
|
|
|
export function InvoiceFormClient({ customers, companyId }: Props) {
|
|
const router = useRouter();
|
|
|
|
async function handleSubmit(data: Record<string, unknown>) {
|
|
const res = await fetch("/api/invoices", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify(data),
|
|
});
|
|
|
|
if (res.ok) {
|
|
const invoice = await res.json();
|
|
router.push(`/companies/${companyId}/invoices/${invoice.id}`);
|
|
} else {
|
|
alert("Fehler beim Erstellen der Rechnung.");
|
|
}
|
|
}
|
|
|
|
return <InvoiceForm customers={customers} companyId={companyId} onSubmit={handleSubmit} />;
|
|
}
|