falta calcular maximo solapas

This commit is contained in:
2025-01-23 14:26:51 +01:00
parent 98d8d45899
commit 0d3ea391d7
6 changed files with 146 additions and 91 deletions

View File

@ -89,6 +89,9 @@ class DatosLibro {
this.solapasSobrecubierta.on('change', this.changeSolapasSobrecubierta.bind(this));
this.tamanioPersonalizado.on('change', this.changeTipoTamanio.bind(this));
this.anchoSolapasCubierta.on('change', this.changeAnchoSolapasCubierta.bind(this));
this.anchoSolapasSobrecubierta.on('change', this.changeAnchoSolapasSobrecubierta.bind(this));
this.paginas.on('change', this.changePaginas.bind(this));
this.tirada.on('change', this.changeTirada.bind(this));
}
@ -211,25 +214,30 @@ class DatosLibro {
setTimeout(() => {
if (this.solapasCubierta.prop('checked')) {
$('#div_solapas_ancho').removeClass('d-none');
$(document).trigger('add-servicio-lineas', 'solapas');
$(document).trigger('add-servicio-lineas', 'solapas_cubierta');
}
else {
$('#div_solapas_ancho').addClass('d-none');
this.anchoSolapasCubierta.val(60);
$(document).trigger('remove-servicio-lineas', 'solapas');
$(document).trigger('remove-servicio-lineas', 'solapas_cubierta');
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_cubierta');
}
}, 100);
// para que se actualice el comparador
$('paginas').trigger('change');
}
$(document).trigger('update-presupuesto', {
update_lineas : false,
update_servicios : true,
update_envios: false,
update_resumen: false,
update_tiradas_alternativas: false
});
changeAnchoSolapasCubierta(){
if(this.checkSolapasGrandes('cubierta')){
$(document).trigger('add-servicio-lineas', 'solapas_grandes_cubierta');
}
else{
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_cubierta');
}
// para que se actualice el comparador
$('paginas').trigger('change');
}
@ -237,21 +245,53 @@ class DatosLibro {
if (this.solapasSobrecubierta.prop('checked')) {
this.divSolapasSobrecubierta.removeClass('d-none');
$(document).trigger('remove-servicio-lineas', 'solapas');
$(document).trigger('add-servicio-lineas', 'solapas_sobrecubierta');
}
else {
this.divSolapasSobrecubierta.addClass('d-none');
this.anchoSolapasSobrecubierta.val(60);
$(document).trigger('add-servicio-lineas', 'solapas');
$(document).trigger('remove-servicio-lineas', 'solapas_sobrecubierta');
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_sobrecubierta');
if ($('#compSobrecubierta').length) {
$('#compSobrecubierta').val(0).trigger('change');
}
}
$(document).trigger('update-presupuesto', {
update_lineas : false,
update_servicios : true,
update_envios: false,
update_resumen: false,
update_tiradas_alternativas: false
});
}
changeAnchoSolapasSobrecubierta(){
if(this.checkSolapasGrandes('cubierta')){
$(document).trigger('add-servicio-lineas', 'solapas_grandes_sobrecubierta');
}
else{
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_sobrecubierta');
}
// para que se actualice el comparador
$('paginas').trigger('change');
}
checkSolapasGrandes(elemento) {
const ancho_libro = 2 * this.getDimensionLibro().ancho;
let ancho_solapas = 0.0;
let lomo = 0.0;
if(elemento == 'cubierta'){
ancho_solapas = 2 * parseFloat($('solapas_ancho').val());
lomo = parseFloat($('lomo_cubierta').val());
}
else if (elemento == 'sobrecubierta'){
ancho_solapas = 2 * parseFloat($('solapas_ancho_sobrecubierta').val());
lomo = parseFloat($('lomo_sobrecubierta').val());
}
else
return false;
if (ancho_libro + ancho_solapas + lomo > 630)
return true;
else
return false
}
changePaginas() {
@ -393,7 +433,7 @@ class DatosLibro {
if (datos.solapasCubierta) {
this.solapasCubierta.prop('checked', true);
this.anchoSolapasCubierta.val(datos.solapasCubiertaAncho);
this.divSolapasSobrecubierta.removeClass('d-none');
this.divSolapasCubierta.removeClass('d-none');
}
else {
this.solapasCubierta.prop('checked', false);