mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
hecho el guardar de los envios, lineas y servicios
This commit is contained in:
@ -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'] ?? "";
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
<dt class="col-5 fw-normal text-end">Total</dt>
|
||||
<dd id="totalAntesDescuento" class="col-6 text-end"></dd>
|
||||
<dt class="col-5 py-1 fw-normal text-end">Descuento</dt>
|
||||
<dd id="dd" class="col-3 text-end py-1"><input id="total_descuentoPercent" type="number" value="" class="update-totales form-control" style="width:100% !important;">%</dd>
|
||||
<dd id="dd" class="col-3 text-end py-1"><input id="total_descuentoPercent" type="number" value="" class="update-totales form-control" style="width:100% !important;"></dd>
|
||||
<dd id="descuentoTotal" class="col-3 py-1 text-end"></dd>
|
||||
<dt class="col-5 text-end">Total presupuesto</dt>
|
||||
<dd id="totalDespuesDecuento" class="col-6 fw-semibold text-end"></dd>
|
||||
|
||||
@ -116,9 +116,11 @@ class PresupuestoAdminEdit {
|
||||
}
|
||||
|
||||
|
||||
guardarPresupuesto() {
|
||||
async guardarPresupuesto() {
|
||||
|
||||
this.servicios.guardar();
|
||||
await this.servicios.guardar();
|
||||
await this.envios.guardarEnvios();
|
||||
await this.lineasPresupuesto.guardarLineasPresupuesto();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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");
|
||||
|
||||
}
|
||||
|
||||
@ -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)
|
||||
});*/
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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}),
|
||||
|
||||
Reference in New Issue
Block a user