añadido calculo dinamico de ancho maximo de solapas. Añadido servicio especial para solapas grandes. Corregidos algunos bugs

This commit is contained in:
2024-11-29 11:25:38 +01:00
parent 524eb68b1c
commit b314e4a1de
12 changed files with 258 additions and 69 deletions

View File

@ -38,7 +38,7 @@ class DisenioCubierta {
this.divSolapas = this.domItem.find("#divSolapasCubierta");
this.divCarasImpresion = this.domItem.find("#divCarasImpresion");
this.divConfigGuardas = this.domItem.find("#divConfigGuardas");
this.divConfigGuardas = this.domItem.find("#divConfigTapaDura");
this.carasCubierta = this.domItem.find("#carasCubierta");
@ -49,6 +49,7 @@ class DisenioCubierta {
this.sinSolapas = this.domItem.find("#solapasCubiertaNo");
this.conSolapas = this.domItem.find("#solapasCubiertaSi");
this.divTamanioSolapas = this.domItem.find("#divTamanioSolapas");
this.textoSolapasCubierta = this.domItem.find("#textoSolapasCubierta");
this.tamanioSolapasCubierta = $(this.domItem.find("#solapasCubierta"));
this.papelGuardas = this.domItem.find("#papelGuardas");
@ -75,6 +76,7 @@ class DisenioCubierta {
this.faja = this.domItem.find("#addFaja");
this.solapasSobrecubierta = this.domItem.find("#solapasSobrecubierta");
this.textoSolapasSobrecubierta = this.domItem.find("#textoLimitesSolapasSobrecubierta");
this.solapasFaja = this.domItem.find("#solapasFaja");
this.altoFaja = this.domItem.find("#altoFaja");
@ -325,6 +327,7 @@ class DisenioCubierta {
callback: function (input) {
const divGramajeInterior = $('#divGramajeCubierta'); // Selecciona el div
divGramajeInterior.find('.fv-plugins-message-container').remove();
const gramajeSeleccionado = $('.custom-selector-gramaje-cubierta input[type="radio"]:checked');
if (gramajeSeleccionado.length > 0) {

View File

@ -986,7 +986,7 @@ class DisenioInterior {
var radioButton = $('<input>', {
type: 'radio', // Tipo de input
name: 'calcular-presupuesto gramaje-interior',
name: ' calcular-solapas calcular-presupuesto gramaje-interior',
id: 'gramaje_' + valor.gramaje, // ID único
value: 'option1' // Valor del radio button
});
@ -1001,6 +1001,7 @@ class DisenioInterior {
const element = $(event.target);
const gramaje = element[0].id;
this.presupuestoCliente.calcularSolapas(event);
this.presupuestoCliente.checkForm(event);
});
@ -1044,7 +1045,7 @@ class DisenioInterior {
var radioButton = $('<input>', {
type: 'radio', // Tipo de input
name: 'calcular-presupuesto gramaje-interior-color',
name: ' calcular-solapas calcular-presupuesto gramaje-interior-color',
id: 'gramajeColor_' + valor.gramaje, // ID único
value: 'option1' // Valor del radio button
});
@ -1059,6 +1060,7 @@ class DisenioInterior {
const element = $(event.target);
const gramaje = element[0].id;
this.presupuestoCliente.calcularSolapas(event);
this.presupuestoCliente.checkForm(event);
});

View File

@ -11,7 +11,7 @@ import tarjetaTiradasPrecio from './tarjetaTiradasPrecio.js';
class PresupuestoCliente {
constructor() {
this.clientePresupuestoWizard = document.querySelector('#wizard-presupuesto-cliente');
this.validationStepper = new Stepper(this.clientePresupuestoWizard, {
@ -110,6 +110,7 @@ class PresupuestoCliente {
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
$(".calcular-solapas").on('change', this.calcularSolapas.bind(this));
}
@ -154,6 +155,28 @@ class PresupuestoCliente {
return !(noPOD && siPOD);
}
calcularSolapas(){
/* Solapas Max */
this.#getDatos(false, true);
if (Object.values(this.datos).every(this.#isValidDataForm)) {
new Ajax('/presupuestocliente/calcularsolapas',
this.datos,
{},
(response) => {
if (response === null || response === undefined || response === "") {
console.log("Error en el calculo máximo de solapas.");
return;
}
this.disenioCubierta.tamanioSolapasCubierta.attr('max', response);
this.disenioCubierta.solapasSobrecubierta.attr('max', response);
this.disenioCubierta.textoSolapasCubierta.text("Entre 60 y " + response + " mm");
this.disenioCubierta.textoSolapasSobrecubierta.text("Entre 60 y " + response + " mm");
},
() => { }
).post();
}
}
checkForm(event) {
@ -163,6 +186,7 @@ class PresupuestoCliente {
return;
}
if (this.calcularPresupuesto) {
if (event.target.id === 'divDirecciones') {
@ -580,7 +604,7 @@ class PresupuestoCliente {
}
#getDatos(save = false) {
#getDatos(save = false, calcularSolapas = false) {
this.datos = {
@ -590,20 +614,12 @@ class PresupuestoCliente {
tirada: this.datosGenerales.getTiradas(),
paginas: this.datosGenerales.paginas.val(),
paginasColor: this.datosGenerales.paginasColor.val(),
posPaginasColor: this.datosGenerales.posPaginasColor.val(),
pagColorConsecutivas: this.datosGenerales.pagColorConsecutivas.is(':checked') ? 1 : 0,
papelInteriorDiferente: this.datosGenerales.papelDiferente.is(':checked') ? 1 : 0,
paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(),
tipo: this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
prototipo: this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
ferro: this.datosGenerales.ferro.is(':checked') ? 1 : 0,
ferroDigital: this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0,
marcapaginas: this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0,
retractilado: this.datosGenerales.retractilado.is(':checked') ? 1 : 0,
retractilado5: this.datosGenerales.retractilado5.is(':checked') ? 1 : 0,
isColor: this.datosGenerales.getIsColor() ? 1 : 0,
isHq: this.disenioInterior.getIsHq() ? 1 : 0,
@ -612,31 +628,46 @@ class PresupuestoCliente {
gramajeInterior: this.disenioInterior.getGramaje(),
},
}
cubierta: {
tipoCubierta: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'),
papelCubierta: this.disenioCubierta.getPapel(),
gramajeCubierta: this.disenioCubierta.getGramaje(),
cabezada: this.disenioCubierta.getCabezada(),
acabados: this.disenioCubierta.getAcabados(),
carasImpresion: this.disenioCubierta.carasCubierta.val(),
},
if (calcularSolapas) {
return;
}
guardas: this.disenioCubierta.getGuardas(),
sobrecubierta: this.disenioCubierta.getSobrecubierta(),
faja: this.disenioCubierta.getFaja(),
this.datos.posPaginasColor = this.datosGenerales.posPaginasColor.val();
excluirRotativa: this.datosGenerales.excluirRotativa.is(':checked') ? 1 : 0,
ivaReducido: this.datosGenerales.ivaReducido.find('option:selected').val(),
servicios: {
'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
'ferro': this.datosGenerales.ferro.is(':checked') ? 1 : 0,
'ferroDigital': this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0,
'marcapaginas': this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0,
'retractilado': this.datosGenerales.retractilado.is(':checked') ? 1 : 0,
'retractilado5': this.datosGenerales.retractilado5.is(':checked') ? 1 : 0,
},
this.datos.prototipo = this.datosGenerales.prototipo.is(':checked') ? 1 : 0;
this.datos.ferro = this.datosGenerales.ferro.is(':checked') ? 1 : 0;
this.datos.ferroDigital = this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0;
this.datos.marcapaginas = this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0;
this.datos.retractilado = this.datosGenerales.retractilado.is(':checked') ? 1 : 0;
this.datos.retractilado5 = this.datosGenerales.retractilado5.is(':checked') ? 1 : 0;
this.datos.cubierta = {
tipoCubierta: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'),
papelCubierta: this.disenioCubierta.getPapel(),
gramajeCubierta: this.disenioCubierta.getGramaje(),
cabezada: this.disenioCubierta.getCabezada(),
acabados: this.disenioCubierta.getAcabados(),
carasImpresion: this.disenioCubierta.carasCubierta.val(),
};
this.datos.guardas = this.disenioCubierta.getGuardas();
this.datos.sobrecubierta = this.disenioCubierta.getSobrecubierta();
this.datos.faja = this.disenioCubierta.getFaja();
this.datos.excluirRotativa = this.datosGenerales.excluirRotativa.is(':checked') ? 1 : 0;
this.datos.ivaReducido = this.datosGenerales.ivaReducido.find('option:selected').val();
this.datos.servicios = {
'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
'ferro': this.datosGenerales.ferro.is(':checked') ? 1 : 0,
'ferroDigital': this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0,
'marcapaginas': this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0,
'retractilado': this.datosGenerales.retractilado.is(':checked') ? 1 : 0,
'retractilado5': this.datosGenerales.retractilado5.is(':checked') ? 1 : 0,
};
let lomoRedondo = 0;
if (this.disenioCubierta.disenioCubierta.filter('.selected').length > 0)
lomoRedondo = this.disenioCubierta.disenioCubierta.filter('.selected').attr('id').includes('Redondo') ? 1 : 0;
@ -706,7 +737,7 @@ class PresupuestoCliente {
this.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);
this.disenioCubierta.cargarDatos(response.data.cubierta, response.data.guardas, response.data.sobrecubierta);
setTimeout(() => {