Presupuestador_web/client/src/app/quotes/components/useQuoteDataTableColumns.tsx

71 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-06-29 19:39:25 +00:00
import { IListQuotes_Response_DTO } from "@shared/contexts";
import { ColumnDef } from "@tanstack/react-table";
import { DataTablaRowActionFunction, DataTableRowActions } from "@/components";
import { Badge } from "@/ui";
import { useMemo } from "react";
export const useQuoteDataTableColumns = (
actions: DataTablaRowActionFunction<IListQuotes_Response_DTO>
2024-06-29 19:39:25 +00:00
): ColumnDef<IListQuotes_Response_DTO>[] => {
const customerColumns: ColumnDef<IListQuotes_Response_DTO>[] = useMemo(
() => [
/*{
id: "complete_name",
header: "Nombre",
accessorFn: (row) => (
<div className="flex items-center justify-between space-x-4">
<div className="flex items-center space-x-4">
<Avatar>
<AvatarImage src={row.photo_url} />
<AvatarFallback>
{acronym(`${row.first_name} ${row.last_name}`)}
</AvatarFallback>
</Avatar>
<div>
<p className="text-base font-semibold">{`${row.first_name} ${row.last_name}`}</p>
<p className="mt-1">{row.job_title}</p>
</div>
</div>
</div>
),
enableSorting: true,
sortingFn: "alphanumeric",
enableHiding: false,
cell: ({ renderValue }) => (
<span className="w-full">
<>{renderValue()}</>
</span>
),
},*/
{
id: "state",
accessorKey: "state",
header: "Estado",
cell: ({ renderValue }) => (
<Badge variant={"destructive"}>
<>{renderValue()}</>
</Badge>
),
},
{
id: "client",
accessorKey: "client",
header: "Cliente",
enableSorting: false,
sortingFn: "alphanumeric",
},
{
id: "actions",
header: "Acciones",
cell: (context) => {
return <DataTableRowActions rowContext={context} actions={actions} />;
2024-06-29 19:39:25 +00:00
},
},
],
[actions]
);
return customerColumns;
};