From 94a74243f74579d49f531a0d00e647b0f1380e79 Mon Sep 17 00:00:00 2001 From: hreyes Date: Mon, 27 Apr 2026 07:30:01 -0600 Subject: [PATCH] fix/doble-click --- .../dashboard/customs_brokers/data-table.svelte | 11 ++++++++++- .../src/routes/dashboard/customs_brokers/+page.svelte | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/dashboard/customs_brokers/data-table.svelte b/frontend/src/lib/components/dashboard/customs_brokers/data-table.svelte index abbbbaac..e06daaa4 100644 --- a/frontend/src/lib/components/dashboard/customs_brokers/data-table.svelte +++ b/frontend/src/lib/components/dashboard/customs_brokers/data-table.svelte @@ -7,11 +7,19 @@ columns: ColumnDef[]; data: TData[]; onRowClick?: (row: TData) => void; + onRowDoubleClick?: (row: TData) => void; selectedId?: string | number | null; idField?: keyof TData; }; - let { data, columns, onRowClick, selectedId, idField }: DataTableProps = $props(); +let { + data, + columns, + onRowClick, + onRowDoubleClick, + selectedId, + idField +}: DataTableProps = $props(); const table = $derived( createSvelteTable({ @@ -46,6 +54,7 @@ {#each table.getRowModel().rows as row (row.id)} onRowClick?.(row.original)} + ondblclick={() => onRowDoubleClick?.(row.original)} class="cursor-pointer transition-colors hover:bg-muted/50 {selectedId && idField && row.original[idField] === selectedId diff --git a/frontend/src/routes/dashboard/customs_brokers/+page.svelte b/frontend/src/routes/dashboard/customs_brokers/+page.svelte index f54d465c..6e60bdb3 100644 --- a/frontend/src/routes/dashboard/customs_brokers/+page.svelte +++ b/frontend/src/routes/dashboard/customs_brokers/+page.svelte @@ -115,6 +115,10 @@ function selectItem(item: CustomsBroker) { selectedItem = item; } + function handleRowDoubleClick(item: CustomsBroker) { + selectedItem = item; + goto(`/dashboard/customs_brokers/edit/${item.broker_key}`); + } function handleEdit() { if (selectedItem) goto(`/dashboard/customs_brokers/edit/${selectedItem.broker_key}`); } @@ -265,6 +269,7 @@ data={paginatedItems} columns={brokerColumns} onRowClick={selectItem} + onRowDoubleClick={handleRowDoubleClick} selectedId={selectedItem?.broker_key} idField="broker_key" />