blob: 0a423f7f28224c485f33cca6351fe1bed1a9f04f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog"
interface SendResultsDialogProps {
isOpen: boolean
onClose: () => void
onConfirm: () => Promise<void>
selectedCount: number
}
export function SendResultsDialog({
isOpen,
onClose,
onConfirm,
selectedCount,
}: SendResultsDialogProps) {
const [isPending, setIsPending] = React.useState(false)
async function handleConfirm() {
setIsPending(true)
try {
await onConfirm()
} finally {
setIsPending(false)
}
}
return (
<Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
<DialogContent>
<DialogHeader>
<DialogTitle>실사 결과 발송</DialogTitle>
<DialogDescription>
선택한 {selectedCount}개 협력업체의 실사 결과를 발송하시겠습니까?
완료된 실사만 결과를 발송할 수 있습니다.
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button
type="button"
variant="outline"
onClick={onClose}
disabled={isPending}
>
취소
</Button>
<Button
type="button"
onClick={handleConfirm}
disabled={isPending}
>
{isPending ? "처리 중..." : "결과 발송"}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
)
}
|