162 lines
5.7 KiB
TypeScript
162 lines
5.7 KiB
TypeScript
import * as React from "react";
|
|
import { ColumnDef } from "@tanstack/react-table";
|
|
|
|
import { Eye, MoreVertical, SquarePen, Trash2 } from "lucide-react";
|
|
import { cn } from "@/lib/utils";
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuTrigger,
|
|
DropdownMenuItem,
|
|
} from "@/components/ui/dropdown-menu";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { htmlToString } from "@/utils/globals";
|
|
import { Link, useRouter } from "@/i18n/routing";
|
|
import {
|
|
Accordion,
|
|
AccordionContent,
|
|
AccordionItem,
|
|
AccordionTrigger,
|
|
} from "@/components/ui/accordion";
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
DialogTrigger,
|
|
} from "@/components/ui/dialog";
|
|
|
|
const columns: ColumnDef<any>[] = [
|
|
{
|
|
accessorKey: "no",
|
|
header: "No",
|
|
cell: ({ row }) => <span>{row.getValue("no")}</span>,
|
|
},
|
|
// {
|
|
// accessorKey: "title",
|
|
// header: "Judul Perencanaan",
|
|
// cell: ({ row }) => <span>{row.getValue("title")}</span>,
|
|
// },
|
|
{
|
|
accessorKey: "title",
|
|
header: "Judul Perencanaan",
|
|
cell: ({ row }) => {
|
|
const datas = row.original.subPlanningList;
|
|
return (
|
|
<Dialog>
|
|
<DialogTrigger asChild>
|
|
<a className="cursor-pointer">{row.getValue("title")}</a>
|
|
</DialogTrigger>
|
|
<DialogContent size="md">
|
|
<DialogHeader>
|
|
<DialogTitle>Rencanaan Mingguan</DialogTitle>
|
|
</DialogHeader>
|
|
<table>
|
|
<tr>
|
|
<th className="text-left">Judul Perencanaan</th>
|
|
<th>Batas Waktu</th>
|
|
<th>Status</th>
|
|
<th>Aksi</th>
|
|
</tr>
|
|
{datas?.map((data: any) => (
|
|
<tr key={data.id}>
|
|
<th className="text-left font-normal text-sm">
|
|
{data.title}
|
|
</th>
|
|
<th className="font-normal text-sm">{data.date}</th>
|
|
<th className="font-normal text-sm">{data.status}</th>
|
|
<th className="flex justify-center text-sm">
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button
|
|
size="icon"
|
|
className="bg-transparent ring-offset-transparent hover:bg-transparent hover:ring-0 hover:ring-transparent"
|
|
>
|
|
<MoreVertical className="h-4 w-4 text-default-800" />
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent className="p-0" align="end">
|
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
|
<Link
|
|
href={`/curator/task-plan/mediahub/create-weekly/detail/${data.id}`}
|
|
>
|
|
Detail
|
|
</Link>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
|
<Link
|
|
href={`/curator/task-plan/mediahub/create-weekly/edit/${data.id}`}
|
|
>
|
|
Edit
|
|
</Link>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
|
<a className="text-red-600">Delete</a>
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
</th>
|
|
</tr>
|
|
))}
|
|
</table>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
},
|
|
},
|
|
{
|
|
accessorKey: "date",
|
|
header: "Batas Waktu",
|
|
cell: ({ row }) => <span>{row.getValue("date")}</span>,
|
|
},
|
|
|
|
{
|
|
accessorKey: "status",
|
|
header: "Status",
|
|
cell: ({ row }) => <span>{row.getValue("status")}</span>,
|
|
},
|
|
|
|
{
|
|
id: "actions",
|
|
accessorKey: "action",
|
|
header: "Actions",
|
|
enableHiding: false,
|
|
cell: ({ row }) => {
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button
|
|
size="icon"
|
|
className="bg-transparent ring-offset-transparent hover:bg-transparent hover:ring-0 hover:ring-transparent"
|
|
>
|
|
<MoreVertical className="h-4 w-4 text-default-800" />
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent className="p-0" align="end">
|
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
|
<Link
|
|
href={`/curator/task-plan/mediahub/create-monthly/detail/${row.original.id}`}
|
|
>
|
|
Detail
|
|
</Link>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
|
<Link
|
|
href={`/curator/task-plan/mediahub/create-monthly/edit/${row.original.id}`}
|
|
>
|
|
Edit
|
|
</Link>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
|
<a className="text-red-600">Delete</a>
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
);
|
|
},
|
|
},
|
|
];
|
|
|
|
export default columns;
|