// * Packages
import { Row } from "@tanstack/react-table";
import { Building2Icon, CheckIcon, XIcon } from "lucide-react";
// * Components shadcn
import { Badge } from "@/components/ui/badge";
// * Other
import DataTable from "@/back/Components/Table/DataTable";
import DataTableFilterButton from "@/back/Components/Table/DataTableFilterButton";
import { Resource } from "@/back/types/global";
import { CompanyModel } from "@/back/types/others";
import { GetFormatedDate, GetTranslation, Views } from "@/lib/utils";
import useTrans from "@/hooks/use-translations";
import str from "@/hooks/use-string";
interface Props {
companies: Resource;
}
const getColumns = () => {
return [
{
accessorKey: "name",
header: ({ column }: { column: { id: string } }) => (
),
cell: ({ row }: { row: Row }) => {
return row.getValue("name");
},
},
{
accessorKey: "published",
header: ({ column }: { column: { id: string } }) => (
),
cell: ({ row }: { row: Row }) => (
{row.getValue("published") ? (
) : (
)}
{str(
GetTranslation(
row.getValue("published") ? "back.yes" : "back.no",
),
)
.ucFirst()
.value()}
),
},
{
accessorKey: "updated_at",
header: ({ column }: { column: { id: string } }) => (
),
cell: ({ row }: { row: Row }) => (
{GetFormatedDate(row.getValue("updated_at"))}
),
},
];
};
export default function AssociatedCompaniesList(props: Props) {
const { companies } = props;
const columns = getColumns();
return (
<>
{str(
useTrans("back.associated_model", {
params: {
model: useTrans("models.classes.company", {
choice: 2,
}),
},
choice: 2,
}),
)
.ucFirst()
.value()}
>
);
}