feat: add client-side validation utilities and debugging tools
Build and Push Docker Image / build (push) Successful in 1m23s

- Implemented client-side validation functions for tax ID, VAT ID, IBAN, BIC, and website URL.
- Added debug logging functionality to assist in development.
- Created a comprehensive validation function for company form data.

feat: initialize database with Prisma migrations

- Added a server-side script to run Prisma migrations and check database health.
- Ensured safe initialization of the database to prevent concurrent migrations.

feat: comprehensive server-side error logging

- Developed an error logging system that captures detailed error context, including request details and stack traces.
- Implemented logging functions for different error types (route, action, database, API, startup).

fix: validate user ID existence in audit logs

- Updated the logging function to validate that the user ID exists in the database before logging actions.

fix: update schemas for optional fields and validation

- Modified schemas to allow for nullable fields and refined validation logic for tax ID, VAT ID, IBAN, and BIC.

feat: enhance error boundary for better debugging

- Improved error boundary to log detailed error information in development mode.
- Added a debug panel to the main application layout for real-time error tracking.

feat: implement company deletion functionality in admin routes

- Added a new API route for deleting companies with appropriate logging.
- Integrated delete confirmation in the admin interface for better user experience.

fix: handle API errors gracefully

- Wrapped API actions in try-catch blocks to log errors and return appropriate responses.

feat: generate and save invoice PDFs

- Implemented functionality to generate and save invoice PDFs upon status updates.
- Added a new column in the database for storing the URL of the generated PDF.

chore: update Docker image reference

- Changed the Docker image reference to point to the new Git repository.

chore: update package dependencies

- Added @radix-ui/react-tooltip for enhanced UI components.
- Updated package-lock.json to reflect new dependencies.
This commit is contained in:
hwinkel
2026-05-03 08:46:58 +02:00
parent c3e7a97c8a
commit b22e5baa5c
26 changed files with 1573 additions and 134 deletions
+46 -2
View File
@@ -2,7 +2,8 @@ import { Link, useLoaderData } from "react-router";
import { requireAdmin } from "@/session.server";
import prisma from "@/lib/prisma.server";
import { Badge } from "@/components/ui/badge";
import { Building2, Archive } from "lucide-react";
import { Building2, Archive, Trash2 } from "lucide-react";
import { useState } from "react";
export async function loader({ request }: { request: Request }) {
await requireAdmin(request);
@@ -68,6 +69,37 @@ function MandantenTabelle({
title: string;
archived?: boolean;
}) {
const [deleteConfirm, setDeleteConfirm] = useState<string | null>(null);
const [isDeleting, setIsDeleting] = useState(false);
const handleDelete = async (companyId: string, companyName: string) => {
if (deleteConfirm !== companyId) {
setDeleteConfirm(companyId);
return;
}
setIsDeleting(true);
try {
const response = await fetch(`/api/admin/companies/${companyId}/delete`, {
method: "DELETE",
});
if (response.ok) {
// Reload the page to refresh the list
window.location.reload();
} else {
const error = await response.json();
alert(`Fehler beim Löschen: ${error.error || response.statusText}`);
setDeleteConfirm(null);
}
} catch (error) {
alert(`Fehler beim Löschen: ${error}`);
setDeleteConfirm(null);
} finally {
setIsDeleting(false);
}
};
if (companies.length === 0) return null;
return (
@@ -113,13 +145,25 @@ function MandantenTabelle({
</td>
<td className="px-4 py-3 text-right text-slate-600">{company._count.invoices}</td>
<td className="px-4 py-3 text-right text-slate-600">{company._count.customers}</td>
<td className="px-4 py-3 text-right">
<td className="px-4 py-3 text-right space-x-2 flex justify-end">
<Link
to={`/companies/${company.id}`}
className="text-indigo-600 hover:text-indigo-800 font-medium text-xs"
>
Öffnen
</Link>
<button
onClick={() => handleDelete(company.id, company.name)}
disabled={isDeleting}
className={`text-xs font-medium flex items-center gap-1 px-2 py-1 rounded transition-colors ${
deleteConfirm === company.id
? "bg-red-100 text-red-700 hover:bg-red-200"
: "text-slate-500 hover:text-red-600"
} ${isDeleting ? "opacity-50 cursor-not-allowed" : ""}`}
>
<Trash2 className="w-3.5 h-3.5" />
{deleteConfirm === company.id ? "Bestätigen?" : "Löschen"}
</button>
</td>
</tr>
))}