guardado faja datos libro

This commit is contained in:
2025-02-01 10:43:49 +01:00
parent 31f7f92448
commit a75ef4eae6
10 changed files with 96 additions and 39 deletions

View File

@ -9,6 +9,7 @@ class DatosLibro {
this.checkPaginasPresupuesto = functions.checkPaginasPresupuesto;
this.getDimensionLibro = functions.getDimensionLibro;
this.calcularSolapas = functions.calcularSolapas;
this.csrf_token = getToken();
this.csrf_hash = $('#mainContainer').find('input[name="' + this.csrf_token + '"]').val();
@ -101,8 +102,10 @@ class DatosLibro {
this.paginas.on('change', this.changePaginas.bind(this));
this.tirada.on('change', this.changeTirada.bind(this));
this.anchoSolapasCubierta.on('focusout', this.checkSolapaAncho.bind(this));
this.anchoSolapasSobrecubierta.on('focusout', this.checkSolapaAncho.bind(this));
this.anchoSolapasCubierta.on('focusout', this.checkMinMaxInput.bind(this));
this.anchoSolapasSobrecubierta.on('focusout', this.checkMinMaxInput.bind(this));
this.fajaSolapasAncho.on('focusout', this.checkMinMaxInput.bind(this));
this.fajaAlto.on('focusout', this.checkMinMaxInput.bind(this));
this.faja.on('change', this.changeFaja.bind(this));
}
@ -120,7 +123,7 @@ class DatosLibro {
}
}
checkSolapaAncho(event) {
checkMinMaxInput(event) {
const el = event.target;
if (el.value != "") {
@ -200,6 +203,13 @@ class DatosLibro {
this.checkPaginasPresupuesto();
this.calcularSolapas();
if ($('#faja_alto').length > 0 && $('#faja_alto').attr('max') != this.getDimensionLibro().alto) {
$('#faja_alto').attr('max', this.getDimensionLibro().alto);
$('#faja_alto').trigger('change');
$('#faja_alto').closest('.mb-1').find('.form-text').text('Entre 50 y ' + this.getDimensionLibro().alto + ' mm');
}
$(document).trigger('update-presupuesto', {
update_lineas: true,
update_servicios: true,
@ -500,6 +510,13 @@ class DatosLibro {
$('#div_solapas_ancho_sobrecubierta').addClass('d-none');
}
this.faja.prop('checked', datos.fajaColor);
if(datos.fajaColor){
this.div_faja.removeClass('d-none');
this.fajaAlto.val(datos.fajaColorAlto).trigger('change');
this.fajaSolapasAncho.val(datos.fajaColorSolapasAncho).trigger('change');
}
this.acabadoCubierta.setOption(datos.acabadoCubierta.id, datos.acabadoCubierta.text);