diff --git a/frontend/src/lib/components/dashboard/reference_data/sectors/data-table-actions.svelte b/frontend/src/lib/components/dashboard/reference_data/sectors/data-table-actions.svelte index 1f087b36..bf90e548 100644 --- a/frontend/src/lib/components/dashboard/reference_data/sectors/data-table-actions.svelte +++ b/frontend/src/lib/components/dashboard/reference_data/sectors/data-table-actions.svelte @@ -5,7 +5,6 @@ import type { Sector } from "./columns.js"; import CreateEditDialog from "./create-edit-dialog.svelte"; import DetailsDialog from "./details-dialog.svelte"; - import DeleteDialog from "./delete-dialog.svelte"; let { item, @@ -17,7 +16,6 @@ let showDetailsDialog = $state(false); let showEditDialog = $state(false); - let showDeleteDialog = $state(false); function handleCopyId() { navigator.clipboard.writeText(item.key.toString()); @@ -30,10 +28,6 @@ function handleEdit() { showEditDialog = true; } - - function handleDelete() { - showDeleteDialog = true; - } @@ -55,12 +49,9 @@ Ver detalles Editar - - Eliminar - diff --git a/frontend/src/lib/components/dashboard/reference_data/states/columns.ts b/frontend/src/lib/components/dashboard/reference_data/states/columns.ts index eb88329d..1a1b4c35 100644 --- a/frontend/src/lib/components/dashboard/reference_data/states/columns.ts +++ b/frontend/src/lib/components/dashboard/reference_data/states/columns.ts @@ -10,7 +10,7 @@ export type State = { ame_key?: string | null; }; -export function createColumns(onSuccess?: () => void): ColumnDef[] { +export function createColumns(onSuccess?: () => void, readOnly = false): ColumnDef[] { return [ { accessorKey: "m3_key", @@ -74,11 +74,11 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { { id: "actions", cell: ({ row }) => { - return renderComponent(DataTableActions, { item: row.original, onSuccess }); + return renderComponent(DataTableActions, { item: row.original, onSuccess, readOnly }); } } ]; } // Mantener compatibilidad hacia atrĂ¡s -export const columns = createColumns(); +export const columns = createColumns(undefined, true); diff --git a/frontend/src/lib/components/dashboard/reference_data/states/data-table-actions.svelte b/frontend/src/lib/components/dashboard/reference_data/states/data-table-actions.svelte index 1c2746b6..ac13a9de 100644 --- a/frontend/src/lib/components/dashboard/reference_data/states/data-table-actions.svelte +++ b/frontend/src/lib/components/dashboard/reference_data/states/data-table-actions.svelte @@ -9,10 +9,12 @@ let { item, - onSuccess + onSuccess, + readOnly = false }: { item: State; onSuccess?: () => void; + readOnly?: boolean; } = $props(); let showDetailsDialog = $state(false); @@ -54,13 +56,17 @@ Ver detalles - Editar - - Eliminar + {#if !readOnly} + Editar + + Eliminar + {/if} - - +{#if !readOnly} + + +{/if} diff --git a/frontend/src/routes/dashboard/reference_data/states/+page.svelte b/frontend/src/routes/dashboard/reference_data/states/+page.svelte index 9153e117..28188744 100644 --- a/frontend/src/routes/dashboard/reference_data/states/+page.svelte +++ b/frontend/src/routes/dashboard/reference_data/states/+page.svelte @@ -140,7 +140,7 @@ } // Crear columnas con el callback onSuccess - const columns = createColumns(handleSuccess); + const columns = createColumns(handleSuccess, true);