diff options
Diffstat (limited to 'lib/vendor-pool/table/vendor-pool-table-columns.tsx')
| -rw-r--r-- | lib/vendor-pool/table/vendor-pool-table-columns.tsx | 29 |
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", |
