pruebas solapas max

This commit is contained in:
2025-01-29 21:16:40 +01:00
parent 2871326989
commit b87a75d1fa
3 changed files with 93 additions and 87 deletions

View File

@ -95,6 +95,24 @@ class DatosLibro {
this.paginas.on('change', this.changePaginas.bind(this));
this.tirada.on('change', this.changeTirada.bind(this));
this.anchoSolapasCubierta.on('focusout', this.checkSolapasMax.bind(this));
this.anchoSolapasSobrecubierta.on('focusout', this.checkSolapasMax.bind(this));
}
}
checkSolapasMax(event) {
const el = event.target;
if (el.value != "") {
if (parseInt(el.value) < parseInt(el.min)) {
el.value = el.min;
}
if (parseInt(el.value) > parseInt(el.max)) {
el.value = el.max;
}
}
else{
el.value = el.min;
}
}
@ -172,8 +190,8 @@ class DatosLibro {
this.checkPaginasPresupuesto();
$(document).trigger('update-presupuesto', {
update_lineas : true,
update_servicios : true,
update_lineas: true,
update_servicios: true,
update_envios: true,
update_resumen: true,
update_tiradas_alternativas: true
@ -199,10 +217,10 @@ class DatosLibro {
$("#label_papelFormatoId").text(
window.language.Presupuestos.papelFormatoId + '*');
}
$(document).trigger('update-presupuesto', {
update_lineas : true,
update_servicios : false,
update_lineas: true,
update_servicios: false,
update_envios: false,
update_resumen: false,
update_tiradas_alternativas: false
@ -228,12 +246,12 @@ class DatosLibro {
this.updateComparador();
}
changeAnchoSolapasCubierta(){
changeAnchoSolapasCubierta() {
if(this.checkSolapasGrandes('cubierta')){
if (this.checkSolapasGrandes('cubierta')) {
$(document).trigger('add-servicio-lineas', 'solapas_grandes_cubierta');
}
else{
else {
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_cubierta');
}
@ -259,12 +277,12 @@ class DatosLibro {
}
changeAnchoSolapasSobrecubierta(){
changeAnchoSolapasSobrecubierta() {
if(this.checkSolapasGrandes('cubierta')){
if (this.checkSolapasGrandes('cubierta')) {
$(document).trigger('add-servicio-lineas', 'solapas_grandes_sobrecubierta');
}
else{
else {
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_sobrecubierta');
}
@ -274,24 +292,24 @@ class DatosLibro {
}
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());
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 if (elemento == 'sobrecubierta') {
ancho_solapas = 2 * parseFloat($('solapas_ancho_sobrecubierta').val());
lomo = parseFloat($('lomo_sobrecubierta').val());
}
else
else
return false;
if (ancho_libro + ancho_solapas + lomo > 630)
if (ancho_libro + ancho_solapas + lomo > 630)
return true;
else
else
return false
}
@ -320,32 +338,32 @@ class DatosLibro {
$('#compPaginasNegrohq').trigger('change');
}
$(document).trigger('update-presupuesto', {
update_lineas : true,
update_servicios : true,
update_lineas: true,
update_servicios: true,
update_envios: true,
update_resumen: true,
update_tiradas_alternativas: true
});
}
}
updateComparador(){
updateComparador() {
if($("#compPaginasNegro").hasClass('d-none')){
if ($("#compPaginasNegro").hasClass('d-none')) {
$('#compPaginasNegrohq').trigger('change');
}
else{
else {
$('#compPaginasNegro').trigger('change');
}
$('#compCarasCubierta').trigger('change');
if($('#compSobrecubierta').length){
if ($('#compSobrecubierta').length) {
$('#compSobrecubierta').trigger('change');
}
if($('#compCarasGuardas').length){
if ($('#compCarasGuardas').length) {
$('#compCarasGuardas').trigger('change');
}
}
@ -361,13 +379,13 @@ class DatosLibro {
if (url_parts2[url_parts2.length - 2] == 'edit') {
$(document).trigger('update-presupuesto', {
update_lineas : true,
update_servicios : false,
update_lineas: true,
update_servicios: false,
update_envios: false,
update_resumen: false,
update_tiradas_alternativas: false
});
$(document).trigger('ckeck-lineas-envios');
}
}