summaryrefslogtreecommitdiff
path: root/lib/welding/table/ocr-table-columns.tsx
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-06-11 12:18:38 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-06-11 12:18:38 +0000
commitff902243a658067fae858a615c0629aa2e0a4837 (patch)
tree42d30e986d1cbfb282c644c01730cd053b816b7a /lib/welding/table/ocr-table-columns.tsx
parent42e38f41cb4c0b4bf9c08b71ed087cd7f0c7fc18 (diff)
(대표님) 20250611 21시 15분 OCR 등
Diffstat (limited to 'lib/welding/table/ocr-table-columns.tsx')
-rw-r--r--lib/welding/table/ocr-table-columns.tsx115
1 files changed, 65 insertions, 50 deletions
diff --git a/lib/welding/table/ocr-table-columns.tsx b/lib/welding/table/ocr-table-columns.tsx
index 85830405..d1aefe06 100644
--- a/lib/welding/table/ocr-table-columns.tsx
+++ b/lib/welding/table/ocr-table-columns.tsx
@@ -14,11 +14,11 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
-import { DataTableColumnHeader } from "@/components/data-table/data-table-column-header"
import { toast } from "sonner"
import { formatDate } from "@/lib/utils"
import { OcrRow } from "@/db/schema"
import { type DataTableRowAction } from "@/types/table"
+import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header"
interface GetColumnsProps {
setRowAction: React.Dispatch<React.SetStateAction<DataTableRowAction<OcrRow> | null>>
@@ -56,26 +56,16 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<OcrRow>
{
accessorKey: "reportNo",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="Report No" />
+ <DataTableColumnHeaderSimple column={column} title="Report No" />
),
cell: ({ getValue }) => {
const reportNo = getValue() as string
return (
<div className="flex items-center gap-2">
- <Badge variant="outline" className="font-mono text-xs">
+ {/* <Badge variant="outline" className="font-mono text-xs"> */}
{reportNo || "N/A"}
- </Badge>
- <Button
- variant="ghost"
- size="icon"
- className="size-6"
- onClick={() => {
- navigator.clipboard.writeText(reportNo || "")
- toast.success("Report No copied to clipboard")
- }}
- >
- <Copy className="size-3" />
- </Button>
+ {/* </Badge> */}
+
</div>
)
},
@@ -87,7 +77,7 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<OcrRow>
{
accessorKey: "no",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="No" />
+ <DataTableColumnHeaderSimple column={column} title="No" />
),
cell: ({ getValue }) => {
const no = getValue() as string
@@ -104,7 +94,7 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<OcrRow>
{
accessorKey: "identificationNo",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="Identification No" />
+ <DataTableColumnHeaderSimple column={column} title="Identification No" />
),
cell: ({ getValue }) => {
const identificationNo = getValue() as string
@@ -121,7 +111,7 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<OcrRow>
{
accessorKey: "tagNo",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="Tag No" />
+ <DataTableColumnHeaderSimple column={column} title="Tag No" />
),
cell: ({ getValue }) => {
const tagNo = getValue() as string
@@ -138,7 +128,7 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<OcrRow>
{
accessorKey: "jointNo",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="Joint No" />
+ <DataTableColumnHeaderSimple column={column} title="Joint No" />
),
cell: ({ getValue }) => {
const jointNo = getValue() as string
@@ -155,7 +145,7 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<OcrRow>
{
accessorKey: "jointType",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="Joint Type" />
+ <DataTableColumnHeaderSimple column={column} title="Joint Type" />
),
cell: ({ getValue }) => {
const jointType = getValue() as string
@@ -172,7 +162,7 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<OcrRow>
{
accessorKey: "weldingDate",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="Welding Date" />
+ <DataTableColumnHeaderSimple column={column} title="Welding Date" />
),
cell: ({ getValue }) => {
const weldingDate = getValue() as string
@@ -189,7 +179,7 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<OcrRow>
{
accessorKey: "confidence",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="Confidence" />
+ <DataTableColumnHeaderSimple column={column} title="Confidence" />
),
cell: ({ getValue }) => {
const confidence = parseFloat(getValue() as string) || 0
@@ -209,46 +199,78 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<OcrRow>
},
// Source Table 컬럼
+ // {
+ // accessorKey: "sourceTable",
+ // header: ({ column }) => (
+ // <DataTableColumnHeaderSimple column={column} title="Table" />
+ // ),
+ // cell: ({ getValue }) => {
+ // const sourceTable = getValue() as number
+ // return (
+ // <div className="text-center">
+ // <Badge variant="outline" className="text-xs">
+ // T{sourceTable}
+ // </Badge>
+ // </div>
+ // )
+ // },
+ // enableSorting: true,
+ // },
+
+ // // Source Row 컬럼
+ // {
+ // accessorKey: "sourceRow",
+ // header: ({ column }) => (
+ // <DataTableColumnHeaderSimple column={column} title="Row" />
+ // ),
+ // cell: ({ getValue }) => {
+ // const sourceRow = getValue() as number
+ // return (
+ // <div className="text-center text-sm text-muted-foreground">
+ // {sourceRow}
+ // </div>
+ // )
+ // },
+ // enableSorting: true,
+ // },
+
+
{
- accessorKey: "sourceTable",
+ accessorKey: "userName",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="Table" />
+ <DataTableColumnHeaderSimple column={column} title="User Name" />
),
cell: ({ getValue }) => {
- const sourceTable = getValue() as number
+ const userName = getValue() as string
return (
- <div className="text-center">
- <Badge variant="outline" className="text-xs">
- T{sourceTable}
- </Badge>
+ <div className="text-sm">
+ {userName || "-"}
</div>
)
},
enableSorting: true,
},
- // Source Row 컬럼
{
- accessorKey: "sourceRow",
+ accessorKey: "userEmail",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="Row" />
+ <DataTableColumnHeaderSimple column={column} title="User Email" />
),
cell: ({ getValue }) => {
- const sourceRow = getValue() as number
+ const userEmail = getValue() as string
return (
- <div className="text-center text-sm text-muted-foreground">
- {sourceRow}
+ <div className="text-sm">
+ {userEmail || "-"}
</div>
)
},
enableSorting: true,
},
-
// Created At 컬럼
{
accessorKey: "createdAt",
header: ({ column }) => (
- <DataTableColumnHeader column={column} title="생성일" />
+ <DataTableColumnHeaderSimple column={column} title="생성일" />
),
cell: ({ cell }) => {
const date = cell.getValue() as Date
@@ -276,24 +298,17 @@ export function getColumns({ setRowAction }: GetColumnsProps): ColumnDef<OcrRow>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-40">
- <DropdownMenuItem
+ <DropdownMenuItem
onClick={() => {
- const rowData = row.original
- navigator.clipboard.writeText(JSON.stringify(rowData, null, 2))
- toast.success("Row data copied to clipboard")
+ setRowAction({ type: "update", row })
}}
+ // className="text-destructive focus:text-destructive"
>
- <Copy className="mr-2 size-4" aria-hidden="true" />
- Copy Row Data
+ Update
</DropdownMenuItem>
+
<DropdownMenuSeparator />
- <DropdownMenuItem
- onClick={() => {
- setRowAction({ type: "view", row })
- }}
- >
- View Details
- </DropdownMenuItem>
+
<DropdownMenuItem
onClick={() => {
setRowAction({ type: "delete", row })