From c1006f395c5c7d00c9c117d3bd6694c78969faa1 Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Tue, 24 Mar 2026 23:23:48 +0200 Subject: [PATCH] =?UTF-8?q?fix(rgi):=20remove=20wrong=20dueDate=20lock=20?= =?UTF-8?q?=E2=80=94=20always=20show=20download=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dueDate-based lock was incorrect: some documents with future dueDate ARE downloadable. The availability depends on eTerra internal rules, not predictably on dueDate. Now all documents show a download button. If server-side download fails (fileVisibility 404), it redirects to eTerra direct URL which works in the user's browser session. Filters changed to: Solutionate / Confirmate / Toate Co-Authored-By: Claude Opus 4.6 (1M context) --- src/app/(modules)/rgi-test/page.tsx | 68 ++++++++++------------------- 1 file changed, 22 insertions(+), 46 deletions(-) diff --git a/src/app/(modules)/rgi-test/page.tsx b/src/app/(modules)/rgi-test/page.tsx index a5cb90c..a215077 100644 --- a/src/app/(modules)/rgi-test/page.tsx +++ b/src/app/(modules)/rgi-test/page.tsx @@ -260,22 +260,12 @@ function IssuedDocsPanel({ ); } - const isLocked = dueDate > Date.now(); - return (
-
-

- {docs.length} document{docs.length > 1 ? "e" : ""} eliberat - {docs.length > 1 ? "e" : ""} -

- {isLocked && ( - - - Disponibile de la {fmtTs(dueDate)} - - )} -
+

+ {docs.length} document{docs.length > 1 ? "e" : ""} eliberat + {docs.length > 1 ? "e" : ""}: +

{docs.map((doc, i) => (
-
- {isLocked ? ( - - - {fmtTs(dueDate)} - - ) : ( - - )} -
+ ))} @@ -403,16 +384,14 @@ export default function RgiTestPage() { setLoading(false); }, [workspaceId, orgUnitId, year]); - const [filterMode, setFilterMode] = useState<"all" | "ready" | "pending">("ready"); + const [filterMode, setFilterMode] = useState<"all" | "solved" | "confirmed">("solved"); // Client-side filter const filtered = useMemo(() => { if (filterMode === "all") return applications; - const now = Date.now(); return applications.filter((a) => { - if (a.hasSolution !== 1) return false; - if (filterMode === "ready") return a.dueDate <= now; // termen trecut = descarcabil - if (filterMode === "pending") return a.dueDate > now; // termen viitor = blocat + if (filterMode === "solved") return a.hasSolution === 1; + if (filterMode === "confirmed") return a.stateCode === "CONFIRMED"; return true; }); }, [applications, filterMode]); @@ -498,8 +477,8 @@ export default function RgiTestPage() {
{([ - { id: "ready" as const, label: "Descarcabile acum", desc: "solutionate + termen trecut" }, - { id: "pending" as const, label: "In asteptare", desc: "solutionate + termen viitor (blocate)" }, + { id: "solved" as const, label: "Solutionate", desc: "lucrari cu solutie" }, + { id: "confirmed" as const, label: "Confirmate", desc: "solutie confirmata" }, { id: "all" as const, label: "Toate", desc: "" }, ]).map((opt) => (