diff --git a/ci4/app/Views/themes/vuexy/form/clientes/plantillaprecios/viewClienteplantillapreciosForm.php b/ci4/app/Views/themes/vuexy/form/clientes/plantillaprecios/viewClienteplantillapreciosForm.php index 5d951a39..4b5541b8 100644 --- a/ci4/app/Views/themes/vuexy/form/clientes/plantillaprecios/viewClienteplantillapreciosForm.php +++ b/ci4/app/Views/themes/vuexy/form/clientes/plantillaprecios/viewClienteplantillapreciosForm.php @@ -88,6 +88,7 @@ href=""> "> + endSection() ?> section('additionalExternalJs') ?> diff --git a/httpdocs/assets/js/safekat/pages/plantillasTarifasCliente/edit.js b/httpdocs/assets/js/safekat/pages/plantillasTarifasCliente/edit.js index a44ae4af..fdabc5ab 100644 --- a/httpdocs/assets/js/safekat/pages/plantillasTarifasCliente/edit.js +++ b/httpdocs/assets/js/safekat/pages/plantillasTarifasCliente/edit.js @@ -295,8 +295,14 @@ class PlantillasTarifasClienteForm { if (index != -1) { self.rows[index] = data; } - if (self.rowsEdited.indexOf(row.id) == -1) - self.rowsEdited.push(row.id); + + + if (self.rowsEdited.some(row => row.id === data.id)) { + const index = self.rowsEdited.findIndex(row => row.id === data.id); + self.rowsEdited[index] = data; + } else { + self.rowsEdited.push(data); + } } }); @@ -364,13 +370,13 @@ class PlantillasTarifasClienteForm { if (this.rowsEdited.length != 0) { - let rowIds = this.rowsEdited.map(row => '#' + this.tablePlantilla.table.row(row).data().id); + let rowIds = this.rowsEdited.map(row => '#' + row.id); let updatedFields = {}; // Iterar sobre las filas editadas y construir el objeto actualizado this.rowsEdited.forEach(row2Edit => { - const row = this.tablePlantilla.table.row(row2Edit).data(); + const row = this.tablePlantilla.table.row('#' + row2Edit.id).data(); updatedFields['tipo'] = updatedFields['tipo'] || {}; updatedFields['tipo'][row.id] = row.tipo;