From 6e20d58487c5e20b08e1d1b4ddd4e76f9e922a79 Mon Sep 17 00:00:00 2001 From: Luca <102960244+Luca-Timo@users.noreply.github.com> Date: Sun, 28 Jun 2026 14:34:36 +0200 Subject: [PATCH] fix(workflows): make the dashboard pending-approvals card items clickable too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dedicated Approvals page rows open the underlying document on click, but the identical card on the admin dashboard didn't — so 'clickable approvals' only half worked depending on where you looked. Apply the same treatment: the info area is now a button that navigates to the run entity's detail page (quote -> /admin/quotes/:id, invoice -> /admin/bills/:id, etc.), reusing the workflows.approvals.openEntity tooltip. Confirm/Deny stay separate; items with no mappable entity render as plain text. --- frontend/src/pages/admin/AdminDashboard.tsx | 38 +++++++++++++++++---- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/admin/AdminDashboard.tsx b/frontend/src/pages/admin/AdminDashboard.tsx index 142dc4f3..d03aca71 100644 --- a/frontend/src/pages/admin/AdminDashboard.tsx +++ b/frontend/src/pages/admin/AdminDashboard.tsx @@ -96,6 +96,17 @@ export const AdminDashboard: React.FC = () => { onError: (err: any) => toast.error(err?.response?.data?.error || (t('common.error', 'Something went wrong') as string)), }); + // Admin detail route for an approval's run entity, so clicking opens the + // document under review. Mirrors WorkflowApprovalsPage (`invoice` → /bills). + const approvalEntityHref = (a: { entity_type?: string | null; entity_id?: number | null }): string | null => { + if (!a.entity_type || a.entity_id == null) return null; + const base: Record = { + quote: 'quotes', invoice: 'bills', event: 'events', contract: 'contracts', customer: 'customers', + }; + const seg = base[a.entity_type]; + return seg ? `/admin/${seg}/${a.entity_id}` : null; + }; + const isLoading = statsLoading || eventsLoading; if (isLoading) { @@ -277,14 +288,29 @@ export const AdminDashboard: React.FC = () => {
{pendingApprovals.slice(0, 5).map((a) => { const prompt = (a.payload as any)?.prompt as string | undefined; + const href = approvalEntityHref(a); + const info = ( + <> +

{a.workflow_name}

+

+ {prompt || a.type}{a.entity_type ? ` · ${a.entity_type} #${a.entity_id}` : ''} +

+ + ); return (
-
-

{a.workflow_name}

-

- {prompt || a.type}{a.entity_type ? ` · ${a.entity_type} #${a.entity_id}` : ''} -

-
+ {href ? ( + + ) : ( +
{info}
+ )}