260811_01_ENH: 폰트 추가 및 html보기, 프리티어 적용
This commit is contained in:
@@ -5,62 +5,80 @@ import { formatKst } from "@kri/common";
|
||||
import {cn} from "@/lib/utils";
|
||||
import {PROJECT_STATUS_CLASS, PROJECT_STATUS_LABEL} from "@/const/projectConst";
|
||||
import {ItrntUserInfo} from "@/types/user";
|
||||
import type {MouseEvent} from "react";
|
||||
|
||||
export const getProjectColumns = (
|
||||
users:ItrntUserInfo[],
|
||||
groupCodeLabelMap: Map<string, string> = new Map(),
|
||||
): ColumnDef<ProjectInfo>[] => [
|
||||
{
|
||||
accessorKey: "prjctIdx",
|
||||
header: "No",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "prjctCd",
|
||||
header: "프로젝트 코드",
|
||||
enableSorting: true,
|
||||
meta: {
|
||||
maxWidth: 180
|
||||
onNavigateToInfo?: (projectInfo: ProjectInfo) => void,
|
||||
): ColumnDef<ProjectInfo>[] => {
|
||||
// 진행 상태/담당 그룹/담당 실사/등록일 셀은 행 클릭(list/manage)과 분기해 project/info로 이동시킨다.
|
||||
const handleInfoCellClick = (e: MouseEvent, projectInfo: ProjectInfo) => {
|
||||
if (!onNavigateToInfo) return;
|
||||
e.stopPropagation();
|
||||
onNavigateToInfo(projectInfo);
|
||||
};
|
||||
const infoCellClass = "flex h-full w-full items-center cursor-pointer";
|
||||
|
||||
return [
|
||||
{
|
||||
accessorKey: "prjctIdx",
|
||||
header: "No",
|
||||
enableSorting: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "prjctName",
|
||||
header: "프로젝트 명",
|
||||
enableSorting: true,
|
||||
meta: {
|
||||
maxWidth: 1000
|
||||
{
|
||||
accessorKey: "prjctCd",
|
||||
header: "프로젝트 코드",
|
||||
enableSorting: true,
|
||||
meta: {
|
||||
maxWidth: 180
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
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,
|
||||
cell: ({row}) => (
|
||||
groupCodeLabelMap.get(row.original.ownerDept) ?? row.original.ownerDept
|
||||
),
|
||||
},
|
||||
{
|
||||
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,
|
||||
}
|
||||
];
|
||||
{
|
||||
accessorKey: "prjctName",
|
||||
header: "프로젝트 명",
|
||||
enableSorting: true,
|
||||
meta: {
|
||||
maxWidth: 1000
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "prjctStatus",
|
||||
header: "진행 상태",
|
||||
cell: ({row}) => (
|
||||
<div className={infoCellClass} onClick={(e) => handleInfoCellClick(e, row.original)}>
|
||||
<Badge className={cn("w-15 h-7 my-1.5", PROJECT_STATUS_CLASS[row.original.prjctStatus])}>
|
||||
{PROJECT_STATUS_LABEL[row.original.prjctStatus]}
|
||||
</Badge>
|
||||
</div>
|
||||
) ,
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "ownerDept",
|
||||
header: "담당 그룹",
|
||||
enableSorting: true,
|
||||
cell: ({row}) => (
|
||||
<div className={infoCellClass} onClick={(e) => handleInfoCellClick(e, row.original)}>
|
||||
{groupCodeLabelMap.get(row.original.ownerDept) ?? row.original.ownerDept}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "ownerFw",
|
||||
header: "담당 실사",
|
||||
enableSorting: true,
|
||||
cell: ({row}) => (
|
||||
<div className={infoCellClass} onClick={(e) => handleInfoCellClick(e, row.original)}>
|
||||
{users.find(u => u.userId === row.original.ownerFw)?.userNm ?? ""}
|
||||
</div>
|
||||
) ,
|
||||
},
|
||||
{
|
||||
accessorKey: "regDt",
|
||||
header: "등록일",
|
||||
cell: ({row}) => (formatKst(row.original.regDt ?? "", "date")),
|
||||
enableSorting: true,
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user