diff --git a/src/modules/registratura/components/registry-entry-detail.tsx b/src/modules/registratura/components/registry-entry-detail.tsx index ccc07bc..1bfdcf1 100644 --- a/src/modules/registratura/components/registry-entry-detail.tsx +++ b/src/modules/registratura/components/registry-entry-detail.tsx @@ -948,6 +948,7 @@ function ExternalStatusSection({ if (!tracking) return null; const [checking, setChecking] = useState(false); + const [toggling, setToggling] = useState(false); const [checkResult, setCheckResult] = useState<{ changed: boolean; error: string | null; @@ -1001,6 +1002,26 @@ function ExternalStatusSection({ return `acum ${days}z`; }; + const handleToggleActive = useCallback(async () => { + setToggling(true); + try { + const updated = { ...liveTracking, active: !liveTracking.active }; + await fetch("/api/registratura", { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + id: entry.id, + updates: { externalStatusTracking: updated }, + }), + }); + setLiveTracking(updated); + } catch { + // Best effort + } finally { + setToggling(false); + } + }, [entry.id, liveTracking]); + const t = liveTracking; return ( @@ -1022,6 +1043,19 @@ function ExternalStatusSection({ Modifica + {t.active && (