import React from 'react'; import { Head, useForm } from '@inertiajs/react'; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; import { Table, TableHeader, TableRow, TableHead, TableBody, TableCell, } from "@/components/ui/table"; import AppLayout from '@/layouts/app-layout'; import type { BreadcrumbItem } from '@/types'; const breadcrumbs: BreadcrumbItem[] = [ { title: 'Clients', href: '/clients', }, ]; export default function Index({ clients }) { const { data, setData, post, reset } = useForm({ first_name: '', last_name: '', company_name: '', phone: '', email: '', }); const handleSubmit = (e) => { e.preventDefault(); post('/clients', { onSuccess: () => reset(), }); }; return (
setData('first_name', e.target.value)} /> setData('last_name', e.target.value)} /> setData('company_name', e.target.value)} /> setData('phone', e.target.value)} /> setData('email', e.target.value)} />
First Name Last Name Company Name Phone Email Actions {clients.map((client) => ( {client.first_name} {client.last_name} {client.company_name} {client.phone} {client.email}
{ e.preventDefault(); if (confirm("Are you sure?")) { Inertia.delete(`/clients/${client.id}`); } }} className="inline" >
))}
); }