From 2284d5fbd8492da1e730982682e338d5c7c414a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Fri, 17 Jan 2025 13:29:10 +0100 Subject: [PATCH] =?UTF-8?q?ahora=20se=20pueden=20abrir=20maquinas=20en=20p?= =?UTF-8?q?esta=C3=B1as?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/safekat/pages/maquinas/maquinasList.js | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/httpdocs/assets/js/safekat/pages/maquinas/maquinasList.js b/httpdocs/assets/js/safekat/pages/maquinas/maquinasList.js index e85d8208..d0d64c72 100644 --- a/httpdocs/assets/js/safekat/pages/maquinas/maquinasList.js +++ b/httpdocs/assets/js/safekat/pages/maquinas/maquinasList.js @@ -28,13 +28,25 @@ class MaquinasList { this.#initTable(); + // Editar en linea la fila // Editar en linea la fila this.tableMaquinas.table.on('click', '.btn-edit-' + this.tableMaquinas.getAlias(), function (e) { - - const dataId = $(this).attr('data-id'); - + + e.preventDefault(); // Previene cualquier comportamiento por defecto del enlace + + const dataId = $(this).closest('tr').find('[data-id]').data('id'); // Obtén el ID dinámico + const dynamicUrl = '/maquinas/edit/' + dataId; + if (!Number.isNaN(Number(dataId))) { - window.location.href = '/maquinas/edit/' + dataId; + if (e.ctrlKey || e.metaKey) { + // Si se presiona Ctrl (o Cmd en Mac), abrir en una nueva pestaña + window.open(dynamicUrl, '_blank'); + } else { + // Navegar normalmente en la misma pestaña + window.location.href = dynamicUrl; + } + } else { + console.error('ID no válido:', dataId); } });