diff options
| author | joonhoekim <26rote@gmail.com> | 2025-12-01 19:52:06 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-12-01 19:52:06 +0900 |
| commit | 44b74ff4170090673b6eeacd8c528e0abf47b7aa (patch) | |
| tree | 3f3824b4e2cb24536c1677188b4cae5b8909d3da /lib/rfqs/tbe-table/vendor-contact/vendor-contact-table.tsx | |
| parent | 4953e770929b82ef77da074f77071ebd0f428529 (diff) | |
(김준회) deprecated code 정리
Diffstat (limited to 'lib/rfqs/tbe-table/vendor-contact/vendor-contact-table.tsx')
| -rw-r--r-- | lib/rfqs/tbe-table/vendor-contact/vendor-contact-table.tsx | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/lib/rfqs/tbe-table/vendor-contact/vendor-contact-table.tsx b/lib/rfqs/tbe-table/vendor-contact/vendor-contact-table.tsx deleted file mode 100644 index c079da02..00000000 --- a/lib/rfqs/tbe-table/vendor-contact/vendor-contact-table.tsx +++ /dev/null @@ -1,89 +0,0 @@ -'use client' - -import * as React from "react" -import { ClientDataTable } from "@/components/client-data-table/data-table" -import { getColumns } from "./vendor-contact-table-column" -import { DataTableAdvancedFilterField } from "@/types/table" -import { Loader2 } from "lucide-react" -import { useToast } from "@/hooks/use-toast" -import { getVendorContactsByVendorId } from "../../service" - -export interface VendorData { - id: number - contactName: string - contactPosition: string | null - contactEmail: string - contactPhone: string | null - isPrimary: boolean | null - createdAt: Date - updatedAt: Date -} - -interface VendorContactsTableProps { - vendorId: number -} - -export function VendorContactsTable({ vendorId }: VendorContactsTableProps) { - const { toast } = useToast() - - const columns = React.useMemo( - () => getColumns(), - [] - ) - - const [vendorContacts, setVendorContacts] = React.useState<VendorData[]>([]) - const [isLoading, setIsLoading] = React.useState(false) - - React.useEffect(() => { - async function loadVendorContacts() { - setIsLoading(true) - try { - const result = await getVendorContactsByVendorId(vendorId) - if (result.success && result.data) { - // undefined 체크 추가 및 타입 캐스팅 - setVendorContacts(result.data as VendorData[]) - } else { - throw new Error(result.error || "Unknown error occurred") - } - } catch (error) { - console.error("협력업체 연락처 로드 오류:", error) - toast({ - title: "Error", - description: "Failed to load vendor contacts", - variant: "destructive", - }) - } finally { - setIsLoading(false) - } - } - loadVendorContacts() - }, [toast, vendorId]) - - const advancedFilterFields: DataTableAdvancedFilterField<VendorData>[] = [ - { id: "contactName", label: "Contact Name", type: "text" }, - { id: "contactPosition", label: "Posiotion", type: "text" }, - { id: "contactEmail", label: "Email", type: "text" }, - { id: "contactPhone", label: "Phone", type: "text" }, - - - ] - - // If loading, show a flex container that fills the parent and centers the spinner - if (isLoading) { - return ( - <div className="flex h-full w-full items-center justify-center"> - <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" /> - </div> - ) - } - - // Otherwise, show the table - return ( - <ClientDataTable - data={vendorContacts} - columns={columns} - advancedFilterFields={advancedFilterFields} - > - </ClientDataTable> - ) -}
\ No newline at end of file |
