blob: 28e6963ba942fc34a882ed575e8a58bdfdc2816d (
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
"use client"
import * as React from "react"
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogFooter,
} from "@/components/ui/dialog"
import { Button } from "@/components/ui/button"
import { Avatar } from "@/components/ui/avatar"
import { ScrollArea } from "@/components/ui/scroll-area"
import { ContactItem } from "@/config/vendorInvestigationsColumnsConfig"
interface ContactsDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
investigationId: number | null
contacts: ContactItem[]
}
export function ContactsDialog({
open,
onOpenChange,
investigationId,
contacts,
}: ContactsDialogProps) {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="sm:max-w-md">
<DialogHeader>
<DialogTitle>Vendor Contacts</DialogTitle>
<DialogDescription>
{contacts.length > 0
? `Showing ${contacts.length} contacts for investigation #${investigationId}`
: `No contacts found for investigation #${investigationId}`}
</DialogDescription>
</DialogHeader>
<ScrollArea className="max-h-[60vh] pr-4">
{contacts.length > 0 ? (
<div className="space-y-4">
{contacts.map((contact, index) => (
<div
key={index}
className="flex items-start gap-4 p-3 rounded-lg border"
>
<Avatar className="w-10 h-10">
<span>{contact.contactName?.charAt(0) || "C"}</span>
</Avatar>
<div className="flex-1 space-y-1">
<p className="font-medium">{contact.contactName || "Unnamed"}</p>
{contact.contactEmail && (
<p className="text-sm text-muted-foreground">
{contact.contactEmail}
</p>
)}
{contact.contactPhone && (
<p className="text-sm text-muted-foreground">
{contact.contactPhone}
</p>
)}
{contact.contactPosition && (
<p className="text-sm text-muted-foreground">
Position: {contact.contactPosition}
</p>
)}
</div>
</div>
))}
</div>
) : (
<div className="text-center py-6 text-muted-foreground">
No contacts available
</div>
)}
</ScrollArea>
<DialogFooter>
<Button onClick={() => onOpenChange(false)}>Close</Button>
</DialogFooter>
</DialogContent>
</Dialog>
)
}
|