mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into 'mod/presupuesto_admin'
Main See merge request jjimenez/safekat!476
This commit is contained in:
@ -28,13 +28,25 @@ class MaquinasList {
|
|||||||
|
|
||||||
this.#initTable();
|
this.#initTable();
|
||||||
|
|
||||||
|
// Editar en linea la fila
|
||||||
// Editar en linea la fila
|
// Editar en linea la fila
|
||||||
this.tableMaquinas.table.on('click', '.btn-edit-' + this.tableMaquinas.getAlias(), function (e) {
|
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))) {
|
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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user