'use client'; import { useMutation } from '@tanstack/react-query'; import { ArrowRight, Loader2 } from 'lucide-react'; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { apiFetch } from '@/lib/api/client'; interface BerthStatusSuggestionDialogProps { open: boolean; onOpenChange: (open: boolean) => void; berthId: string; currentStatus: string; suggestedStatus: string; reason: string; onApplied: () => void; } export function BerthStatusSuggestionDialog({ open, onOpenChange, berthId, currentStatus, suggestedStatus, reason, onApplied, }: BerthStatusSuggestionDialogProps) { const applyMutation = useMutation({ mutationFn: () => apiFetch(`/api/v1/berths/${berthId}/status`, { method: 'PATCH', body: JSON.stringify({ status: suggestedStatus, reason }), }), onSuccess: () => { onApplied(); onOpenChange(false); }, }); return ( Suggested Status Change Based on recent activity, a berth status update is recommended.
{currentStatus.replace(/_/g, ' ')} {suggestedStatus.replace(/_/g, ' ')}
{reason && (

{reason}

)}
); }