"use client" import * as React from "react" import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog" import { Textarea } from "@/components/ui/textarea" import { Label } from "@/components/ui/label" interface CancelInvestigationDialogProps { isOpen: boolean onClose: () => void onConfirm: () => Promise selectedCount: number } export function CancelInvestigationDialog({ isOpen, onClose, onConfirm, selectedCount, }: CancelInvestigationDialogProps) { const [isPending, setIsPending] = React.useState(false) async function handleConfirm() { setIsPending(true) try { await onConfirm() } finally { setIsPending(false) } } return ( !open && onClose()}> 실사 의뢰 취소 선택한 {selectedCount}개 협력업체의 실사 의뢰를 취소하시겠습니까? 계획 상태인 실사만 취소할 수 있습니다. ) } interface ReRequestInvestigationDialogProps { isOpen: boolean onClose: () => void onConfirm: (reason?: string) => Promise selectedCount: number } export function ReRequestInvestigationDialog({ isOpen, onClose, onConfirm, selectedCount, }: ReRequestInvestigationDialogProps) { const [isPending, setIsPending] = React.useState(false) const [reason, setReason] = React.useState("") async function handleConfirm() { setIsPending(true) try { await onConfirm(reason || undefined) } finally { setIsPending(false) } } // Dialog가 닫힐 때 상태 초기화 React.useEffect(() => { if (!isOpen) { setReason("") } }, [isOpen]) return ( !open && onClose()}> 실사 재의뢰 선택한 {selectedCount}개 협력업체의 실사를 재의뢰하시겠습니까? 취소 상태인 실사만 재의뢰할 수 있습니다.