From 146dd77da407438023d6fe6f18c0ebb8b6915765 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Wed, 24 Sep 2025 19:07:45 +0900
Subject: (김준회) nonsap 기준정보 기반 국가 선택기 컴포넌트 구현 및 AVL,
 Vendor-Pool 적용
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/vendor-pool-table-columns.tsx            | 29 ++++++++++++++--------
 1 file changed, 19 insertions(+), 10 deletions(-)

(limited to 'lib/vendor-pool/table/vendor-pool-table-columns.tsx')

diff --git a/lib/vendor-pool/table/vendor-pool-table-columns.tsx b/lib/vendor-pool/table/vendor-pool-table-columns.tsx
index 1f0c455e..52a0ad28 100644
--- a/lib/vendor-pool/table/vendor-pool-table-columns.tsx
+++ b/lib/vendor-pool/table/vendor-pool-table-columns.tsx
@@ -31,6 +31,7 @@ import { VendorTierSelector } from "@/components/common/selectors/vendor-tier/ve
 import { VendorSelectorDialogSingle } from "@/components/common/vendor/vendor-selector-dialog-single"
 import type { VendorSearchItem } from "@/components/common/vendor/vendor-service"
 import { PlaceOfShippingSelectorDialogSingle } from "@/components/common/selectors/place-of-shipping/place-of-shipping-selector"
+import { NationSelector, NationCode } from "@/components/common/selectors/nation"
 
 export type VendorPoolItem = Omit<VendorPool, 'registrationDate' | 'lastModifiedDate'> & {
   id: string | number // temp-로 시작하는 경우 string, 실제 데이터는 number
@@ -800,24 +801,32 @@ export const columns: ColumnDef<VendorPoolItem>[] = [
       <DataTableColumnHeaderSimple column={column} title={<span className="text-red-600 font-medium">본사 위치 *</span>} />
     ),
     cell: ({ row, table }) => {
-      const value = row.getValue("headquarterLocation")
-      const onSave = async (newValue: any) => {
+      const headquarterLocation = row.original.headquarterLocation as string
+
+      // 현재 선택된 국가명으로부터 국가 코드를 찾기 위해 임시로 null 설정
+      // 실제로는 국가명에서 국가코드를 역추적해야 하지만, 여기서는 단순화
+      const selectedNation: NationCode | undefined = undefined
+
+      const onNationSelect = async (nation: NationCode) => {
+        console.log('선택된 국가:', nation)
+
         if (table.options.meta?.onCellUpdate) {
-          await table.options.meta.onCellUpdate(row.original.id, "headquarterLocation", newValue)
+          // CDNM 값(한국어 국가명)을 저장
+          await table.options.meta.onCellUpdate(row.original.id, "headquarterLocation", nation.CDNM)
         }
       }
 
       return (
-        <EditableCell
-          value={value}
-          type="text"
-          onSave={onSave}
-          placeholder="본사 위치 입력"
-          maxLength={50}
+        <NationSelector
+          selectedNation={selectedNation}
+          onNationSelect={onNationSelect}
+          disabled={false}
+          placeholder={headquarterLocation || "본사 위치 선택"}
+          className="w-full"
         />
       )
     },
-    size: 100,
+    size: 180,
   },
   {
     accessorKey: "manufacturingLocation",
-- 
cgit v1.2.3

