diff options
Diffstat (limited to 'lib/site-visit/site-visit-detail-dialog.tsx')
| -rw-r--r-- | lib/site-visit/site-visit-detail-dialog.tsx | 67 |
1 files changed, 2 insertions, 65 deletions
diff --git a/lib/site-visit/site-visit-detail-dialog.tsx b/lib/site-visit/site-visit-detail-dialog.tsx index 74e749c4..634d2aef 100644 --- a/lib/site-visit/site-visit-detail-dialog.tsx +++ b/lib/site-visit/site-visit-detail-dialog.tsx @@ -7,7 +7,6 @@ import { FileText, Download } from "lucide-react" import { toast } from "sonner" import { Button } from "@/components/ui/button" -import { Input } from "@/components/ui/input" import { Dialog, DialogContent, @@ -59,7 +58,6 @@ interface SiteVisitRequest { // 협력업체 정보 vendorInfo?: { id: number - country?: string siteVisitRequestId: number factoryName: string factoryLocation: string @@ -103,40 +101,6 @@ export function SiteVisitDetailDialog({ onOpenChange, selectedRequest, }: SiteVisitDetailDialogProps) { - const vendorCountry = (selectedRequest?.vendorInfo as any)?.country || "" - const isDomestic = vendorCountry === "KR" - - const [factoryLocation, setFactoryLocation] = React.useState( - selectedRequest?.vendorInfo?.factoryLocation || "" - ) - const [factoryAddress, setFactoryAddress] = React.useState( - selectedRequest?.vendorInfo?.factoryAddress || "" - ) - - React.useEffect(() => { - setFactoryLocation(selectedRequest?.vendorInfo?.factoryLocation || "") - setFactoryAddress(selectedRequest?.vendorInfo?.factoryAddress || "") - }, [selectedRequest?.vendorInfo?.factoryLocation, selectedRequest?.vendorInfo?.factoryAddress]) - - React.useEffect(() => { - const handleMessage = (event: MessageEvent) => { - if (!event.data || event.data.type !== "JUSO_SELECTED") return - const { roadAddrPart1, roadAddrPart2, addrDetail } = event.data.payload || {} - const combinedRoad = [roadAddrPart1, roadAddrPart2].filter(Boolean).join(" ").trim() - setFactoryLocation(combinedRoad || factoryLocation) - setFactoryAddress(addrDetail || factoryAddress) - } - window.addEventListener("message", handleMessage) - return () => window.removeEventListener("message", handleMessage) - }, [factoryLocation, factoryAddress]) - - const handleJusoSearch = () => { - window.open( - "/api/juso", - "jusoSearch", - "width=570,height=420,scrollbars=yes,resizable=yes" - ) - } return ( <Dialog open={isOpen} onOpenChange={onOpenChange}> @@ -165,35 +129,8 @@ export function SiteVisitDetailDialog({ <h4 className="font-semibold mb-2">공장 기본 정보</h4> <div className="space-y-2 text-sm"> <div><span className="font-medium">공장명:</span> {selectedRequest.vendorInfo.factoryName}</div> - <div className="flex items-center justify-between gap-2"> - <span className="font-medium">공장위치(도로명):</span> - {isDomestic && ( - <Button - type="button" - variant="secondary" - size="sm" - onClick={handleJusoSearch} - aria-label="도로명 주소 검색" - > - 주소 검색 - </Button> - )} - </div> - <Input - value={factoryLocation} - onChange={(e) => setFactoryLocation(e.target.value)} - readOnly={!isDomestic} - className={!isDomestic ? "" : "bg-muted text-muted-foreground"} - placeholder="도로명 주소" - /> - <div><span className="font-medium">공장주소(상세):</span></div> - <Input - value={factoryAddress} - onChange={(e) => setFactoryAddress(e.target.value)} - readOnly={!isDomestic} - className={!isDomestic ? "" : "bg-muted text-muted-foreground"} - placeholder="상세 주소" - /> + <div><span className="font-medium">공장위치:</span> {selectedRequest.vendorInfo.factoryLocation}</div> + <div><span className="font-medium">공장주소:</span> {selectedRequest.vendorInfo.factoryAddress}</div> </div> </div> |
