summaryrefslogtreecommitdiff
path: root/lib/vendor-pool/table
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-09-24 19:07:45 +0900
committerjoonhoekim <26rote@gmail.com>2025-09-24 19:07:45 +0900
commit146dd77da407438023d6fe6f18c0ebb8b6915765 (patch)
treeb13f65d5b177aa245ef4fba997bba636440afa97 /lib/vendor-pool/table
parentd704d85094ba1e98bc5727161e1600e6f86cda3a (diff)
(김준회) nonsap 기준정보 기반 국가 선택기 컴포넌트 구현 및 AVL, Vendor-Pool 적용
Diffstat (limited to 'lib/vendor-pool/table')
-rw-r--r--lib/vendor-pool/table/vendor-pool-table-columns.tsx29
1 files changed, 19 insertions, 10 deletions
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",