diff --git a/ci4/app/Controllers/Presupuestos/Presupuestodirecciones.php b/ci4/app/Controllers/Presupuestos/Presupuestodirecciones.php index 300e68ef..ddbe042a 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestodirecciones.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestodirecciones.php @@ -44,7 +44,7 @@ class Presupuestodirecciones extends \App\Controllers\BaseResourceController $att = $reqData['att'] ?? ""; $email = $reqData['email'] ?? ""; $direccion = $reqData['direccion'] ?? ""; - $pais_id = $reqData['paisId'] ?? -1; + $pais_id = $reqData['pais_id'] ?? -1; $provincia = $reqData['provincia'] ?? ""; $municipio = $reqData['municipio'] ?? ""; $cp = $reqData['cp'] ?? ""; diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_resumenPresupuestoItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_resumenPresupuestoItems.php index e0ffa2e0..e80d1eab 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_resumenPresupuestoItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_resumenPresupuestoItems.php @@ -59,7 +59,7 @@
Total
Descuento
-
%
+
Total presupuesto
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js index 500de09e..2d363c1f 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js @@ -116,9 +116,11 @@ class PresupuestoAdminEdit { } - guardarPresupuesto() { + async guardarPresupuesto() { - this.servicios.guardar(); + await this.servicios.guardar(); + await this.envios.guardarEnvios(); + await this.lineasPresupuesto.guardarLineasPresupuesto(); } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/envios.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/envios.js index 45a30ded..e4126ce3 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/envios.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/envios.js @@ -231,18 +231,18 @@ class Envios { } - guardarEnvios() { - /* TO-DO - var id = $('#presupuesto_id').val() + async guardarEnvios() { + + var id = window.location.pathname.split('/').pop(); - $.post(window.routes_envios.dataTableOfPresupuestoDirecciones, + await $.post('/presupuestodirecciones/datatable', Object.assign({ tipo: "clear_lineas", presupuesto_id: id }, window.token_ajax)) .done(function (data) { - $('#tableOfDireccionesEnvio').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) { + $('#tableOfDireccionesEnvio').DataTable().rows().every(async function (rowIdx, tableLoop, rowLoop) { var data = this.data(); - $.post('/presupuestos/presupuestodirecciones/add', - Object.assign({ + await $.post('/presupuestos/presupuestodirecciones/add', + { presupuesto_id: id, tarifa_id: data.tarifa_id, cantidad: data.cantidad, @@ -250,7 +250,7 @@ class Envios { att: data.att, email: data.email, direccion: data.direccion, - paisId: data.paisId, + pais_id: data.pais_id, provincia: data.provincia, municipio: data.municipio, cp: data.cp, @@ -260,13 +260,12 @@ class Envios { proveedor: data.proveedor, proveedor_id: data.proveedor_id, entregaPieCalle: data.entregaPieCalle - }, window.token_ajax)) + }) }); - }) - */ } + async updateTiradaBase() { const self = this; @@ -581,7 +580,7 @@ class Envios { update_resumen: true, update_tiradas_alternativas: true }); - + $('#addressForm').modal("hide"); } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js index 68593edc..d5799ac0 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js @@ -484,9 +484,10 @@ class LineasPresupuesto { }); } - guardarLineasPresupuesto() { + async guardarLineasPresupuesto() { - data = []; + let data = []; + const presupuesto_id = window.location.href.split('/').pop(); this.table.rows().every(function (rowIdx, tableLoop, rowLoop) { @@ -509,7 +510,7 @@ class LineasPresupuesto { if (t_maq_str.length == 3) t_maq = (+t_maq_str[0]) * 3600 + (+t_maq_str[1]) * 60 + (+t_maq_str[2]); - linea_data = { + let linea_data = { presupuesto_id: presupuesto_id, tipo: rowData.row_id, paginas: (rowData.row_id == 'lp_guardas') ? (($('#tipo_impresion_id').val() == 1 || $('#tipo_impresion_id').val() == 3) ? 8 : 4) : rowData.paginas, @@ -611,31 +612,26 @@ class LineasPresupuesto { data.push(linea_data) }); - /* + var datos = { tipo: 'lineasPresupuesto', datos: data, presupuesto_id: presupuesto_id, } - datos = Object.assign(datos, window.token_ajax); - + await $.ajax({ type: 'post', - url: window.routes_lp.updateDataOfPresupuestoAdmin, - + url: '/presupuestoadmin/datatable_2', data: datos, dataType: 'json', success: function (response) { token = response[window.csrf_token]; - yeniden(token); } }).fail(function (jqXHR, textStatus, error) { // Handle error here console.log(jqXHR) - });*/ - - + }); } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js index 5cc499d5..9e67db07 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/servicios.js @@ -430,6 +430,7 @@ class ServiciosAcabado { datos.push(this.data()); }); const domain = window.location.origin; + const id = window.location.href.split('/').pop(); await fetch(domain + "/presupuestos/presupuestoacabados/edit/" + id , { method: "POST", body: JSON.stringify({datos: datos}), @@ -647,6 +648,7 @@ class ServiciosPreimpresion { datos.push(this.data()); }); const domain = window.location.origin; + const id = window.location.href.split('/').pop(); await fetch(domain + "/presupuestos/presupuestopreimpresiones/edit/" + id , { method: "POST", body: JSON.stringify({datos: datos}), @@ -1028,6 +1030,7 @@ class ServiciosEncuadernacion { datos.push(this.data()); }); const domain = window.location.origin; + const id = window.location.href.split('/').pop(); await fetch(domain + "/presupuestos/presupuestoencuadernaciones/edit/" + id , { method: "POST", body: JSON.stringify({datos: datos}), @@ -1366,6 +1369,7 @@ class ServiciosManipulado { datos.push(this.data()); }); const domain = window.location.origin; + const id = window.location.href.split('/').pop(); await fetch(domain + "/presupuestos/presupuestomanipulados/edit/" + id , { method: "POST", body: JSON.stringify({datos: datos}), @@ -1523,6 +1527,7 @@ class ServiciosExtra { datos.push(this.data()); }); const domain = window.location.origin; + const id = window.location.href.split('/').pop(); await fetch(domain + "/presupuestos/presupuestoserviciosextra/edit/" + id , { method: "POST", body: JSON.stringify({datos: datos}),