260115_02_ENH : 로그인 오류 수정 및 템플릿 생성 연동 완료
This commit is contained in:
53
src/components/table-column/ProjectTableColumn.tsx
Normal file
53
src/components/table-column/ProjectTableColumn.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
import {ProjectInfo} from "@/types/project";
|
||||
import {ColumnDef} from "@tanstack/react-table";
|
||||
import {Badge} from "@/components/ui/badge";
|
||||
import {cn, formatKst} from "@/lib/utils";
|
||||
import {PROJECT_STATUS_CLASS, PROJECT_STATUS_LABEL} from "@/const/projectConst";
|
||||
import {ItrntUserInfo} from "@/types/user";
|
||||
|
||||
export const getProjectColumns = (users:ItrntUserInfo[]): ColumnDef<ProjectInfo>[] => [
|
||||
{
|
||||
accessorKey: "prjctIdx",
|
||||
header: "No",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "prjctCd",
|
||||
header: "프로젝트 코드",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "prjctName",
|
||||
header: "프로젝트 명",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "prjctStatus",
|
||||
header: "진행 상태",
|
||||
cell: ({row}) => (
|
||||
<Badge className={cn("w-15 h-7 my-1.5", PROJECT_STATUS_CLASS[row.original.prjctStatus])}>
|
||||
{PROJECT_STATUS_LABEL[row.original.prjctStatus]}
|
||||
</Badge>
|
||||
) ,
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "ownerDept",
|
||||
header: "담당 그룹",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "ownerFw",
|
||||
header: "담당 실사",
|
||||
enableSorting: true,
|
||||
cell: ({row}) => (
|
||||
users.find(u => u.userId === row.original.ownerFw)?.userNm ?? ""
|
||||
) ,
|
||||
},
|
||||
{
|
||||
accessorKey: "regDt",
|
||||
header: "등록일",
|
||||
cell: ({row}) => (formatKst(row.original.regDt ?? "", "date")),
|
||||
enableSorting: true,
|
||||
}
|
||||
];
|
||||
80
src/components/table-column/UserTableColumn.tsx
Normal file
80
src/components/table-column/UserTableColumn.tsx
Normal file
@@ -0,0 +1,80 @@
|
||||
import {ColumnDef} from "@tanstack/react-table";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Pencil, Trash2} from "lucide-react";
|
||||
import {UserInfo} from "@/types/user";
|
||||
import {formatKst} from "@/lib/utils";
|
||||
import {MultiSelectOption} from "@/components/ui/multi-select";
|
||||
|
||||
|
||||
|
||||
export type UserColumnsActions = {
|
||||
onEdit: (userId: string) => void
|
||||
onDelete: (userId: string) => void
|
||||
}
|
||||
|
||||
export const getUserColumns = (actions: UserColumnsActions, userRoleArray:MultiSelectOption[]): ColumnDef<UserInfo>[] => [
|
||||
{
|
||||
accessorKey: "userId",
|
||||
header: "아이디",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "userCmpn",
|
||||
header: "소속",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "userName",
|
||||
header: "이름",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "userRole",
|
||||
header: "권한",
|
||||
cell: ({row}) => {
|
||||
const role = userRoleArray.filter((r) => r.value === String(row.original.userRole));
|
||||
return role.length > 0 ? role[0].label : String(row.original.userRole);
|
||||
},
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "regDt",
|
||||
header: "등록일",
|
||||
cell: ({row}) => (formatKst(row.original.regDt ?? "", "date")),
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "memo",
|
||||
header: "메모",
|
||||
enableSorting: false,
|
||||
},
|
||||
{
|
||||
id: "actions",
|
||||
header: "관리",
|
||||
cell: ({ row }) => (
|
||||
<div
|
||||
className="flex items-center justify-center gap-2"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => actions.onEdit(row.original.userId)}
|
||||
aria-label="수정"
|
||||
>
|
||||
<Pencil className="w-4 h-4" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => actions.onDelete(row.original.userId)}
|
||||
aria-label="삭제"
|
||||
>
|
||||
<Trash2 className="w-4 h-4 text-destructive" />
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
enableSorting: false,
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user