Skip to content

Commit 3242d18

Browse files
feat(Employee): add action dropdown menu with copy name and show employee details options
1 parent 150c20b commit 3242d18

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

resources/js/pages/employees/column.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
import { DataTableColumnHeader } from '@/components/data-table-column-header';
2+
import DropdownMenuCopyButton from '@/components/ui-helpers/dropdown-menu-copy-button';
23
import { Badge } from '@/components/ui/badge';
4+
import { Button } from '@/components/ui/button';
5+
import {
6+
DropdownMenu,
7+
DropdownMenuContent,
8+
DropdownMenuItem,
9+
DropdownMenuLabel,
10+
DropdownMenuSeparator,
11+
DropdownMenuTrigger,
12+
} from '@/components/ui/dropdown-menu';
313
import { normalizeString } from '@/lib/utils';
14+
import employee_info from '@/routes/employee_info';
415
import { TableEmployeeInfo } from '@/types/application/employee';
16+
import { Link } from '@inertiajs/react';
517
import { ColumnDef } from '@tanstack/react-table';
618
import { format } from 'date-fns';
19+
import { MoreHorizontal } from 'lucide-react';
720

821
export const column: ColumnDef<TableEmployeeInfo>[] = [
922
{
@@ -51,4 +64,31 @@ export const column: ColumnDef<TableEmployeeInfo>[] = [
5164
cell: ({ row }) => format(row.original.updated_at, 'PPpp'),
5265
enableSorting: true,
5366
},
67+
68+
{
69+
id: 'actions',
70+
cell: ({ row }) => (
71+
<DropdownMenu>
72+
<DropdownMenuTrigger asChild>
73+
<Button variant="ghost" className="h-8 w-8 p-0">
74+
<span className="sr-only">Open menu</span>
75+
<MoreHorizontal className="h-4 w-4" />
76+
</Button>
77+
</DropdownMenuTrigger>
78+
<DropdownMenuContent align="end">
79+
<DropdownMenuLabel>Actions</DropdownMenuLabel>
80+
<DropdownMenuItem asChild>
81+
<DropdownMenuCopyButton content={row.original.full_name}>Copy Name</DropdownMenuCopyButton>
82+
</DropdownMenuItem>
83+
84+
<DropdownMenuSeparator />
85+
<DropdownMenuItem asChild>
86+
<Link href={employee_info.show(row.original.id)} prefetch>
87+
Show
88+
</Link>
89+
</DropdownMenuItem>
90+
</DropdownMenuContent>
91+
</DropdownMenu>
92+
),
93+
},
5494
];

0 commit comments

Comments
 (0)