Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
0fee6b6ecd
commit
1a4dffa5c6
@@ -167,6 +167,15 @@ function CaseDetail() {
|
||||
<SelectItem value="closed">Closed</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
setSelectedClientId(data.client?.id ?? "");
|
||||
setReassignOpen(true);
|
||||
}}
|
||||
>
|
||||
<ArrowRightLeft className="h-4 w-4 mr-2" /> Reassign client
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={async () => {
|
||||
@@ -183,6 +192,57 @@ function CaseDetail() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Dialog open={reassignOpen} onOpenChange={setReassignOpen}>
|
||||
<DialogContent className="max-w-lg">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Reassign case to a different client</DialogTitle>
|
||||
<DialogDescription>
|
||||
Currently assigned to <span className="font-medium">{data.client?.name ?? "—"}</span>. Pick a new client below.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="space-y-3">
|
||||
<div className="relative">
|
||||
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
|
||||
<Input
|
||||
placeholder="Search clients…"
|
||||
value={clientSearch}
|
||||
onChange={(e) => setClientSearch(e.target.value)}
|
||||
className="pl-8"
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
<div className="max-h-72 overflow-y-auto border rounded-md divide-y">
|
||||
{filteredClients.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground p-3">No clients match.</p>
|
||||
) : (
|
||||
filteredClients.map((c) => (
|
||||
<button
|
||||
key={c.id}
|
||||
type="button"
|
||||
onClick={() => setSelectedClientId(c.id)}
|
||||
className={`w-full text-left px-3 py-2 text-sm hover:bg-muted flex items-center justify-between ${
|
||||
selectedClientId === c.id ? "bg-muted" : ""
|
||||
}`}
|
||||
>
|
||||
<span>{c.name}</span>
|
||||
<span className="text-xs text-muted-foreground uppercase">{c.client_type}</span>
|
||||
</button>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={() => setReassignOpen(false)}>Cancel</Button>
|
||||
<Button
|
||||
onClick={reassignClient}
|
||||
disabled={reassigning || !selectedClientId || selectedClientId === data.client?.id}
|
||||
>
|
||||
{reassigning ? "Reassigning…" : "Reassign"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
{data.description && (
|
||||
<Card className="mb-6 border-border/60">
|
||||
<CardContent className="p-4">
|
||||
|
||||
Reference in New Issue
Block a user