import { createSignal } from "solid-js";
import { NewRegister } from "./NewRegister";
import { Registers } from "./Registers";
import { Search } from "./Search";
import { Person } from "../types/Person";

export function Certs() {
    const [person, setPerson] = createSignal<Person | null>(null);
    const [count, setCount] = createSignal(0);

    return (
        <div class="grid grid-cols-[16rem_25rem_1fr]">
            <Search setPerson={setPerson} />
            <NewRegister
                personId={person()?.person_id ?? null}
                onSuccess={() => setCount((x) => x + 1)}
            />
            <Registers person={person()} count={count()} />
        </div>
    );
}
