funcionando crear editar y todo lo demas

This commit is contained in:
2025-01-03 16:45:56 +01:00
parent 012723d955
commit 9b6cc84d4f
2 changed files with 11 additions and 4 deletions

View File

@ -88,6 +88,7 @@
href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
<link rel="stylesheet"
href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/presupuestoCliente.css') ?>">
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>

View File

@ -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;