import { useNavigate, useParams } from 'react-router-dom'; import { Modal } from '../components/reusable'; import { CallsView } from '../components/rv'; import { CallDetail } from '../components/dv'; import { useState } from 'react'; import { Button } from '../components/buttons/Button'; import { Plus } from 'lucide-react'; import { DynamicForm } from '../components/forms/DynamicForm'; import { ORDER_BOOKING } from '../api/config'; import { orderBookingClient } from '../api/clients'; export function CallsPage() { const params = useParams(); const instanceId = params.instanceId ? Number(params.instanceId) : undefined; const navigate = useNavigate(); const [isCreating, setIsCreating] = useState(false); const [refreshKey, setRefreshKey] = useState(0); const [activeActivity, setActiveActivity] = useState<{ id: string; name: string } | null>(null); const [isFabOpen, setIsFabOpen] = useState(false); return ( <> { const id = row.instance_id as number | string | undefined; if (id != null) navigate(`/calls/${id}`); }} headerActions={ } /> setIsCreating(false)} title="Log Visit" width="md" > { setIsCreating(false); setRefreshKey(k => k + 1); }} onCancel={() => setIsCreating(false)} /> { navigate(`/calls`); setIsFabOpen(false); }} title={instanceId != null ? `Call #${instanceId}` : undefined} width="lg" > {instanceId != null && ( <>
{isFabOpen && (
)}
)}
setActiveActivity(null)} title={activeActivity?.name} width="md" > {activeActivity && instanceId != null && ( { setActiveActivity(null); setRefreshKey(k => k + 1); }} onCancel={() => setActiveActivity(null)} /> )} ); }