From 4d1883b459ebe07f7c32e83cbb922b537a160c1d Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Mon, 30 Mar 2026 09:52:59 +0300 Subject: [PATCH] feat(registratura): add manual toggle for monitoring (Opreste/Reactiveaza) Co-Authored-By: Claude Opus 4.6 (1M context) --- .../components/registry-entry-detail.tsx | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) 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 && (