mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
falta preview resumen
This commit is contained in:
@ -2,6 +2,7 @@ import DatosGenerales from './datosGenerales.js';
|
||||
import DisenioInterior from './disenioInterior.js';
|
||||
import DisenioCubierta from './disenioCubierta.js';
|
||||
import Direcciones from './direcciones.js';
|
||||
import Resumen from './resumen.js';
|
||||
import Ajax from '../../components/ajax.js';
|
||||
|
||||
|
||||
@ -26,6 +27,7 @@ class PresupuestoCliente {
|
||||
this.disenioInterior = new DisenioInterior($("#interior-libro"), this.clientePresupuestoWizard, this.validationStepper);
|
||||
this.disenioCubierta = new DisenioCubierta($("#cubierta-libro"), this.clientePresupuestoWizard, this.validationStepper);
|
||||
this.direcciones = new Direcciones($("#direcciones-libro"), this.clientePresupuestoWizard, this.validationStepper);
|
||||
this.resumen = new Resumen($("#resumen-libro"), this.datosGenerales, this.disenioInterior, this.disenioCubierta, this.direcciones);
|
||||
|
||||
this.divTiradasPrecios = $("#divTiradasPrecio");
|
||||
|
||||
@ -34,6 +36,8 @@ class PresupuestoCliente {
|
||||
{}, this.datos,
|
||||
this.#procesarPresupuesto.bind(this),
|
||||
() => { $('#loader').hide(); });
|
||||
|
||||
this.actualizarTiradasEnvio = false;
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +53,7 @@ class PresupuestoCliente {
|
||||
document.querySelector('.select2-search__field').focus();
|
||||
});
|
||||
|
||||
this.validationStepper._element.addEventListener('shown.bs-stepper', this.buttonsHandler.bind(this));
|
||||
this.validationStepper._element.addEventListener('shown.bs-stepper', this.stepperHandler.bind(this));
|
||||
|
||||
this.datosGenerales.init();
|
||||
this.disenioInterior.init();
|
||||
@ -63,9 +67,27 @@ class PresupuestoCliente {
|
||||
|
||||
checkForm(event) {
|
||||
|
||||
if (event.target.id === 'divDirecciones') {
|
||||
this.actualizarTiradasEnvio = false;
|
||||
if(this.direcciones.direcciones.length == 1 && this.direcciones.direcciones[0].getEntregaPalets() == false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.actualizarTiradasEnvio = true;
|
||||
this.direcciones.divTiradas.empty();
|
||||
}
|
||||
|
||||
this.#getDatos();
|
||||
|
||||
if (Object.values(this.datos).every(this.#isValidDataForm)) {
|
||||
this.divTiradasPrecios.empty();
|
||||
|
||||
let datos_to_check = this.datos;
|
||||
if (datos_to_check.direcciones) {
|
||||
delete datos_to_check.direcciones;
|
||||
}
|
||||
|
||||
if (Object.values(datos_to_check).every(this.#isValidDataForm)) {
|
||||
try {
|
||||
$('#loader').show();
|
||||
|
||||
@ -97,24 +119,25 @@ class PresupuestoCliente {
|
||||
const newOption2 = new Option("148 x 210", "1", true, true);
|
||||
papelFormatoId.append(newOption2).trigger('change');
|
||||
|
||||
|
||||
$("#paginasColor").val("6");
|
||||
$("#paginasColor").trigger('change');
|
||||
|
||||
$("#fresado").trigger("click");
|
||||
|
||||
|
||||
$("#colorEstandar").trigger("click");
|
||||
$("#colorPremium").trigger("click");
|
||||
$("#offsetBlanco").trigger("click");
|
||||
|
||||
setTimeout(function () {
|
||||
$("#gramaje80").trigger("click");
|
||||
$("#gramaje90").trigger("click");
|
||||
}, 0);
|
||||
|
||||
setTimeout(function () {
|
||||
$("#tapaDura").trigger("click");
|
||||
}, 0);
|
||||
|
||||
/*
|
||||
|
||||
setTimeout(function () {
|
||||
$("#btnNext").trigger("click");
|
||||
}, 0);
|
||||
@ -127,14 +150,17 @@ class PresupuestoCliente {
|
||||
|
||||
|
||||
setTimeout(function () {
|
||||
$("#unidadesEnvio").val("100");
|
||||
}, 0);*/
|
||||
$("#unidadesEnvio").val("50");
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
||||
buttonsHandler() {
|
||||
switch (this.validationStepper._currentIndex + 1) {
|
||||
case 0:
|
||||
stepperHandler() {
|
||||
|
||||
const element = $('.fv-plugins-bootstrap5.fv-plugins-framework.active');
|
||||
|
||||
switch (element.attr('id')) {
|
||||
case 'datos-generales':
|
||||
this.btnPrev.addClass('d-none');
|
||||
this.btnNext.removeClass('d-none');
|
||||
this.btnPrint.addClass('d-none');
|
||||
@ -142,13 +168,27 @@ class PresupuestoCliente {
|
||||
this.btnConfirm.addClass('d-none');
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 'interior-libro':
|
||||
case 'cubierta-libro':
|
||||
case 'direcciones-libro':
|
||||
this.btnPrev.removeClass('d-none');
|
||||
this.btnNext.removeClass('d-none');
|
||||
this.btnPrint.addClass('d-none');
|
||||
this.btnSave.addClass('d-none');
|
||||
this.btnConfirm.addClass('d-none');
|
||||
break;
|
||||
|
||||
case 'resumen-libro':
|
||||
this.btnPrev.removeClass('d-none');
|
||||
this.btnNext.addClass('d-none');
|
||||
this.btnPrint.removeClass('d-none');
|
||||
this.btnSave.removeClass('d-none');
|
||||
this.btnConfirm.removeClass('d-none');
|
||||
this.resumen.generate();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,10 +206,13 @@ class PresupuestoCliente {
|
||||
this.divTiradasPrecios,
|
||||
('precio-tiradas-' + response.tiradas[i]),
|
||||
response.tiradas[i],
|
||||
(parseFloat(response.precio_u[i])*parseInt(response.tiradas[i])).toFixed(2),
|
||||
(parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2),
|
||||
response.precio_u[i]
|
||||
);
|
||||
|
||||
if (this.actualizarTiradasEnvio)
|
||||
this.direcciones.insertTirada(response.tiradas[i]);
|
||||
|
||||
}
|
||||
}
|
||||
// DEBUG
|
||||
@ -204,8 +247,9 @@ class PresupuestoCliente {
|
||||
|
||||
|
||||
#prevtStep() {
|
||||
if (this.validationStepper._currentIndex >= 1 && this.validationStepper._currentIndex <= 4)
|
||||
if (this.validationStepper._currentIndex >= 1 && this.validationStepper._currentIndex <= 4){
|
||||
this.validationStepper.previous();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -220,12 +264,12 @@ class PresupuestoCliente {
|
||||
paginas: this.datosGenerales.paginas.val(),
|
||||
paginasColor: this.datosGenerales.paginasColor.val(),
|
||||
paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(),
|
||||
papelInteriorDiferente: this.datosGenerales.papelDiferente.is(':checked');
|
||||
|
||||
papelInteriorDiferente: this.datosGenerales.papelDiferente.is(':checked') ? 1 : 0,
|
||||
|
||||
tipo: this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
|
||||
|
||||
isColor: this.datosGenerales.getIsColor(),
|
||||
isHq: this.disenioInterior.getIsHq(),
|
||||
|
||||
isColor: this.datosGenerales.getIsColor() ? 1 : 0,
|
||||
isHq: this.disenioInterior.getIsHq() ? 1 : 0,
|
||||
|
||||
interior: {
|
||||
papelInterior: this.disenioInterior.getPapel(),
|
||||
@ -245,31 +289,31 @@ class PresupuestoCliente {
|
||||
sobrecubierta: this.disenioCubierta.getSobrecubierta(),
|
||||
faja: this.disenioCubierta.getFaja(),
|
||||
|
||||
excluirRotativa: this.datosGenerales.excluirRotativa.is(':checked'),
|
||||
excluirRotativa: this.datosGenerales.excluirRotativa.is(':checked') ? 1 : 0,
|
||||
ivaReducido: this.datosGenerales.ivaReducido.find('option:selected').val(),
|
||||
servicios: {
|
||||
'prototipo' : this.datosGenerales.prototipo.is(':checked'),
|
||||
'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
|
||||
},
|
||||
};
|
||||
|
||||
if(this.datos.tipo == "cosido"){
|
||||
if (this.datos.tipo == "cosido") {
|
||||
this.datos.paginasCuadernillo = this.datosGenerales.paginasCuadernillo.val();
|
||||
}
|
||||
let solapasCubierta = this.disenioCubierta.getSolapasCubierta();
|
||||
if (solapasCubierta !== null && solapasCubierta !== undefined) {
|
||||
|
||||
if (solapasCubierta === false)
|
||||
this.datos.cubierta.solapas = false;
|
||||
this.datos.cubierta.solapas = 0;
|
||||
else {
|
||||
this.datos.cubierta.solapas = true;
|
||||
this.datos.cubierta.solapas = 1;
|
||||
this.datos.cubierta.tamanioSolapas = solapasCubierta;
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.datos.cubierta.solapas = false;
|
||||
else {
|
||||
this.datos.cubierta.solapas = 0;
|
||||
}
|
||||
|
||||
if(this.direcciones.direcciones.length > 0){
|
||||
if (this.direcciones.direcciones.length > 0) {
|
||||
this.datos.direcciones = this.direcciones.direcciones;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user