'use client';

import { Button } from '@repo/shadcn/components/ui/button';
import { DataTableSearch } from '@repo/shadcn/table/data-table-search';
import { Plus } from 'lucide-react';
import { useRouter } from 'next/navigation';
import { useTrainingTableFilters } from './use-training-table-filters';

export default function TrainingTableAction() {
  const { searchQuery, setPage, setSearchQuery } = useTrainingTableFilters();
  const router = useRouter();
  return (
    <div className="flex items-center justify-between mt-4 ">
      <div className="flex items-center gap-4 flex-grow">
        <DataTableSearch
          searchKey="nombre"
          searchQuery={searchQuery || ''}
          setSearchQuery={setSearchQuery}
          setPage={setPage}
        />
      </div>{' '}
      <Button
        onClick={() => router.push(`/dashboard/formulario/nuevo`)}
        size="sm"
      >
        <Plus className="h-4 w-4" />
        Nuevo Registro
      </Button>
    </div>
  );
}
