mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
comprobando presupuestos
This commit is contained in:
@ -65,7 +65,7 @@ class PresupuestoCliente {
|
||||
this.btnSave.on('click', this.#savePresupuesto.bind(this));
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
$(".calcular-presupuesto").on('change', ()=>{});
|
||||
$(".calcular-presupuesto").on('change', () => { });
|
||||
this.#cargarPresupuesto();
|
||||
const successMessage = sessionStorage.getItem('message');
|
||||
if (successMessage) {
|
||||
@ -73,10 +73,10 @@ class PresupuestoCliente {
|
||||
sessionStorage.removeItem('message');
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -103,13 +103,13 @@ class PresupuestoCliente {
|
||||
if (datos_to_check.direcciones) {
|
||||
delete datos_to_check.direcciones;
|
||||
}
|
||||
if(datos_to_check.posPaginasColor){
|
||||
if (datos_to_check.posPaginasColor) {
|
||||
delete datos_to_check.posPaginasColor;
|
||||
}
|
||||
|
||||
if (Object.values(datos_to_check).every(this.#isValidDataForm)) {
|
||||
try {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
$('#loader').modal('show');
|
||||
}, 0);
|
||||
|
||||
@ -238,13 +238,12 @@ class PresupuestoCliente {
|
||||
{},
|
||||
(response) => {
|
||||
$('#loader').modal('hide');
|
||||
console.log(response);
|
||||
if (this.datos["confirmar"] || window.location.href.includes("add")) {
|
||||
if(response.status){
|
||||
if (response.status) {
|
||||
sessionStorage.setItem('message', response.message);
|
||||
window.location.href = response.url + '/' + response.status;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
popErrorAlert("No se ha podido guardar el presupuesto. Por favor, póngase en contacto con el departamento comercial.");
|
||||
}
|
||||
}
|
||||
@ -272,29 +271,35 @@ class PresupuestoCliente {
|
||||
, "sk-alert-2", false);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
popAlert2Hide();
|
||||
}
|
||||
|
||||
if (response.tiradas && response.tiradas.length) {
|
||||
|
||||
let tiradas = {...response.tiradas};
|
||||
tiradas = Object.keys(tiradas).map((key) => tiradas[key]);
|
||||
tiradas.sort((a, b) => a - b);
|
||||
this.divTiradasPrecios.empty();
|
||||
|
||||
for (let i = 0; i < response.tiradas.length; i++) {
|
||||
for (let i = 0; i < tiradas.length; i++) {
|
||||
new tarjetaTiradasPrecio(
|
||||
this.divTiradasPrecios,
|
||||
('precio-tiradas-' + response.tiradas[i]),
|
||||
response.tiradas[i],
|
||||
(parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2),
|
||||
tiradas[i],
|
||||
(parseFloat(response.precio_u[i]) * parseInt(tiradas[i])).toFixed(2),
|
||||
response.precio_u[i]
|
||||
);
|
||||
|
||||
if (this.actualizarTiradasEnvio)
|
||||
this.direcciones.insertTirada(response.tiradas[i]);
|
||||
this.direcciones.insertTirada(tiradas[i]);
|
||||
|
||||
this.lc.val(parseFloat(response.info.lomo_cubierta).toFixed(2));
|
||||
this.lsc.val(parseFloat(response.info.lomo_sobrecubierta).toFixed(2));
|
||||
}
|
||||
this.lc.val(parseFloat(response.info.lomo_cubierta).toFixed(2));
|
||||
this.lsc.val(parseFloat(response.info.lomo_sobrecubierta).toFixed(2));
|
||||
setTimeout(() => {
|
||||
$(`#containerTiradasEnvios .tirada-envio input[tirada="${response.tiradas[0]}"]`).trigger('click');
|
||||
}, 0);
|
||||
}
|
||||
// DEBUG
|
||||
//console.log(response);
|
||||
@ -350,6 +355,7 @@ class PresupuestoCliente {
|
||||
paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(),
|
||||
|
||||
tipo: this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
|
||||
prototipo: this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
|
||||
|
||||
isColor: this.datosGenerales.getIsColor() ? 1 : 0,
|
||||
isHq: this.disenioInterior.getIsHq() ? 1 : 0,
|
||||
@ -362,6 +368,7 @@ class PresupuestoCliente {
|
||||
|
||||
cubierta: {
|
||||
tipoCubierta: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'),
|
||||
lomoRedondo: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id').includes('Redondo') ? 1 : 0,
|
||||
papelCubierta: this.disenioCubierta.getPapel(),
|
||||
gramajeCubierta: this.disenioCubierta.getGramaje(),
|
||||
cabezada: this.disenioCubierta.getCabezada(),
|
||||
@ -429,16 +436,30 @@ class PresupuestoCliente {
|
||||
{},
|
||||
{},
|
||||
(response) => {
|
||||
if (response.status === 1) {
|
||||
this.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
/*this.disenioInterior.cargarDatos(response);
|
||||
this.disenioCubierta.cargarDatos(response);
|
||||
this.direcciones.cargarDatos(response);
|
||||
*/
|
||||
}
|
||||
console.log(response);
|
||||
$('#loader').modal('hide');
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
|
||||
setTimeout(() => {
|
||||
if (response.status === 1) {
|
||||
|
||||
this.lc.val(parseFloat(response.data.lc).toFixed(2));
|
||||
this.lsc.val(parseFloat(response.data.lsc).toFixed(2));
|
||||
|
||||
this.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
this.direcciones.handleChangeCliente();
|
||||
this.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);
|
||||
this.disenioCubierta.cargarDatos(response.data.cubierta, response.data.guardas, response.data.sobrecubierta);
|
||||
this.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
||||
|
||||
setTimeout(() => {
|
||||
this.checkForm({ target: { id: 'tirada' } });
|
||||
this.validationStepper.next();
|
||||
this.validationStepper.next();
|
||||
this.validationStepper.next();
|
||||
this.validationStepper.next();
|
||||
$('#loader').modal('hide');
|
||||
}, 0);
|
||||
}
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
}, 0);
|
||||
},
|
||||
() => {
|
||||
$('#loader').modal('hide');
|
||||
|
||||
Reference in New Issue
Block a user