import { Form, Head, Link, router } from '@inertiajs/react';
import { useState } from 'react';
import { PageTitle, Panel, controlClass } from '@/components/procurement';
import { Button } from '@/components/ui/button';
type Client = {
id: number;
client_key: string;
code: string;
name: string;
tax_number: string | null;
address: string | null;
email: string | null;
active: boolean;
version: number;
};
function Fields({ client, prefix }: { client?: Client; prefix: string }) {
return (
{(
[
['code', 'Código', 40],
['name', 'Nome da entidade cliente', 180],
['tax_number', 'Identificação fiscal', 40],
['email', 'Email institucional', 254],
] as const
).map(([field, label, max]) => (
))}
);
}
export default function Clients({
clients,
canManage,
filters,
}: {
clients: {
data: Client[];
current_page: number;
last_page: number;
prev_page_url: string | null;
next_page_url: string | null;
};
canManage: boolean;
filters: { search?: string };
}) {
const [createKey, setCreateKey] = useState(() => crypto.randomUUID());
return (
<>