From 7b0c7c8e56fb027c729c953b0b87dab72156f661 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Mon, 15 Sep 2025 23:42:46 +0900 Subject: (김준회) 임시 견적요청 및 AVL detail 관련 수정사항 처리 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/avl/table/avl-table-columns.tsx | 213 ++++++++++++++++-------------------- 1 file changed, 95 insertions(+), 118 deletions(-) (limited to 'lib/avl/table/avl-table-columns.tsx') diff --git a/lib/avl/table/avl-table-columns.tsx b/lib/avl/table/avl-table-columns.tsx index 8caf012e..72c59aa9 100644 --- a/lib/avl/table/avl-table-columns.tsx +++ b/lib/avl/table/avl-table-columns.tsx @@ -2,9 +2,8 @@ import { Checkbox } from "@/components/ui/checkbox" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { Eye, Edit, Trash2, History } from "lucide-react" -import { type ColumnDef, TableMeta } from "@tanstack/react-table" +import { type ColumnDef } from "@tanstack/react-table" import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header" -import { EditableCell } from "@/components/data-table/editable-cell" import { AvlListItem } from "../types" interface GetColumnsProps { @@ -12,18 +11,12 @@ interface GetColumnsProps { onRowSelect?: (id: number, selected: boolean) => void } -// 수정 여부 확인 헬퍼 함수 -const getIsModified = (table: any, rowId: string, fieldName: string) => { - const pendingChanges = table.options.meta?.getPendingChanges?.() || {} - return String(rowId) in pendingChanges && fieldName in pendingChanges[String(rowId)] -} - // 테이블 메타 타입 확장 declare module "@tanstack/react-table" { interface TableMeta { - onCellUpdate?: (id: string, field: keyof TData, newValue: any) => Promise + onCellUpdate?: (id: string, field: keyof TData, newValue: string | boolean) => Promise onCellCancel?: (id: string, field: keyof TData) => void - onAction?: (action: string, data?: any) => void + onAction?: (action: string, data?: Partial) => void onSaveEmptyRow?: (tempId: string) => Promise onCancelEmptyRow?: (tempId: string) => void isEmptyRow?: (id: string) => boolean @@ -35,7 +28,7 @@ export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): const columns: ColumnDef[] = [ // 기본 정보 그룹 { - header: "기본 정보", + header: "AVL 정보", columns: [ { id: "select", @@ -69,25 +62,12 @@ export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): header: ({ column }) => ( ), - cell: ({ getValue, row, table }) => { + cell: ({ getValue }) => { const value = getValue() as boolean - const isModified = getIsModified(table, row.id, "isTemplate") return ( - { - table.options.meta?.onCellUpdate?.(row.id, "isTemplate", newValue === "true") - }} - onCancel={() => { - table.options.meta?.onCellCancel?.(row.id, "isTemplate") - }} - /> +
+ {value ? "표준 AVL" : "프로젝트 AVL"} +
) }, size: 120, @@ -97,25 +77,12 @@ export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): header: ({ column }) => ( ), - cell: ({ getValue, row, table }) => { + cell: ({ getValue }) => { const value = getValue() as string - const isModified = getIsModified(table, row.id, "constructionSector") return ( - { - table.options.meta?.onCellUpdate?.(row.id, "constructionSector", newValue) - }} - onCancel={() => { - table.options.meta?.onCellCancel?.(row.id, "constructionSector") - }} - /> +
+ {value} +
) }, size: 100, @@ -125,20 +92,12 @@ export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): header: ({ column }) => ( ), - cell: ({ getValue, row, table }) => { + cell: ({ getValue }) => { const value = getValue() as string - const isModified = getIsModified(table, row.id, "projectCode") return ( - { - table.options.meta?.onCellUpdate?.(row.id, "projectCode", newValue) - }} - onCancel={() => { - table.options.meta?.onCellCancel?.(row.id, "projectCode") - }} - /> +
+ {value} +
) }, size: 140, @@ -148,20 +107,12 @@ export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): header: ({ column }) => ( ), - cell: ({ getValue, row, table }) => { + cell: ({ getValue }) => { const value = getValue() as string - const isModified = getIsModified(table, row.id, "shipType") return ( - { - table.options.meta?.onCellUpdate?.(row.id, "shipType", newValue) - }} - onCancel={() => { - table.options.meta?.onCellCancel?.(row.id, "shipType") - }} - /> +
+ {value} +
) }, size: 100, @@ -171,20 +122,12 @@ export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): header: ({ column }) => ( ), - cell: ({ getValue, row, table }) => { + cell: ({ getValue }) => { const value = getValue() as string - const isModified = getIsModified(table, row.id, "avlKind") return ( - { - table.options.meta?.onCellUpdate?.(row.id, "avlKind", newValue) - }} - onCancel={() => { - table.options.meta?.onCellCancel?.(row.id, "avlKind") - }} - /> +
+ {value} +
) }, size: 120, @@ -194,25 +137,12 @@ export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): header: ({ column }) => ( ), - cell: ({ getValue, row, table }) => { + cell: ({ getValue }) => { const value = getValue() as string - const isModified = getIsModified(table, row.id, "htDivision") return ( - { - table.options.meta?.onCellUpdate?.(row.id, "htDivision", newValue) - }} - onCancel={() => { - table.options.meta?.onCellCancel?.(row.id, "htDivision") - }} - /> +
+ {value} +
) }, size: 80, @@ -246,9 +176,52 @@ export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): ], }, + // 집계 그룹 + { + header: "등록정보", + columns: [ + { + accessorKey: "PKG", + header: ({ column }) => ( + + ), + }, + { + accessorKey: "materialGroup", + header: ({ column }) => ( + + ), + }, + { + accessorKey: "vendor", + header: ({ column }) => ( + + ), + }, + { + accessorKey: "Tier", + header: ({ column }) => ( + + ), + }, + { + accessorKey: "ownerSuggestion", + header: ({ column }) => ( + + ), + }, + { + accessorKey: "shiSuggestion", + header: ({ column }) => ( + + ), + }, + ], + }, + // 등록 정보 그룹 { - header: "등록 정보", + header: "작성정보", columns: [ { accessorKey: "createdAt", @@ -261,10 +234,32 @@ export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): }, size: 100, }, + { + accessorKey: "createdBy", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const date = getValue() as string + return
{date}
+ }, + size: 100, + }, { accessorKey: "updatedAt", header: ({ column }) => ( - + + ), + cell: ({ getValue }) => { + const date = getValue() as string + return
{date}
+ }, + size: 100, + }, + { + accessorKey: "updatedBy", + header: ({ column }) => ( + ), cell: ({ getValue }) => { const date = getValue() as string @@ -320,24 +315,6 @@ export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): > - - ) }, -- cgit v1.2.3