mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/cargar_presu_admin_servicios_solapas' into 'main'
añadido flag cargando para evitar eventos See merge request jjimenez/safekat!515
This commit is contained in:
@ -70,6 +70,8 @@ class DatosLibro {
|
||||
this.fajaSolapasAncho = this.domItem.find('#faja_solapas_ancho');
|
||||
this.div_faja = this.domItem.find('.faja-div');
|
||||
|
||||
this.cargando = false;
|
||||
|
||||
}
|
||||
|
||||
init() {
|
||||
@ -83,6 +85,9 @@ class DatosLibro {
|
||||
|
||||
this.acabadoCubierta.item.on('select2:select', function () {
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
if(self.acabadoCubierta.getVal() == 0){
|
||||
$(document).trigger('remove-servicio-lineas', 'acabadoCubierta');
|
||||
}
|
||||
@ -91,6 +96,10 @@ class DatosLibro {
|
||||
}
|
||||
});
|
||||
this.acabadoSobrecubierta.item.on('select2:select', function () {
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
if(self.acabadoCubierta.getVal() == 0){
|
||||
$(document).trigger('remove-servicio-lineas', 'acabadoSobrecubierta');
|
||||
}
|
||||
@ -99,6 +108,10 @@ class DatosLibro {
|
||||
}
|
||||
});
|
||||
this.acabadoFaja.item.on('select2:select', function () {
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
if(self.acabadoFaja.getVal() == 0){
|
||||
$(document).trigger('remove-servicio-lineas', 'acabadoFaja');
|
||||
}
|
||||
@ -145,16 +158,25 @@ class DatosLibro {
|
||||
if (this.faja.prop('checked')) {
|
||||
this.div_faja.removeClass('d-none');
|
||||
$('#compFaja').val(1).trigger('change');
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_faja');
|
||||
$('.acabado-faja').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.div_faja.addClass('d-none');
|
||||
$('#compFaja').val(0).trigger('change');
|
||||
$('.acabado-faja').addClass('d-none');
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
$(document).trigger('remove-servicio-lineas', 'acabadoFaja');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_faja');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_faja');
|
||||
$('.acabado-faja').addClass('d-none');
|
||||
$(document).trigger('remove-servicio-lineas', 'acabadoFaja');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,6 +199,9 @@ class DatosLibro {
|
||||
|
||||
changeFerro() {
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
if (this.ferro.prop('checked')) {
|
||||
$(document).trigger('add-servicio-lineas', 'ferro');
|
||||
}
|
||||
@ -187,6 +212,9 @@ class DatosLibro {
|
||||
|
||||
changePrototipo() {
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
if (this.prototipo.prop('checked')) {
|
||||
$(document).trigger('add-servicio-lineas', 'prototipo');
|
||||
}
|
||||
@ -198,6 +226,9 @@ class DatosLibro {
|
||||
|
||||
checkRetractilado(event) {
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
switch (event.currentTarget.id) {
|
||||
case 'retractilado':
|
||||
if ($('#' + event.currentTarget.id).prop('checked')) {
|
||||
@ -289,10 +320,14 @@ class DatosLibro {
|
||||
setTimeout(() => {
|
||||
if (this.solapasCubierta.prop('checked')) {
|
||||
$('#div_solapas_ancho').removeClass('d-none');
|
||||
if(this.cargando)
|
||||
return;
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_cubierta');
|
||||
}
|
||||
else {
|
||||
$('#div_solapas_ancho').addClass('d-none');
|
||||
if(this.cargando)
|
||||
return;
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_cubierta');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_cubierta');
|
||||
}
|
||||
@ -304,15 +339,19 @@ class DatosLibro {
|
||||
|
||||
changeAnchoSolapasCubierta() {
|
||||
|
||||
// para que se actualice el comparador
|
||||
$('#compCarasCubierta').trigger('change');
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
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
|
||||
$('#compCarasCubierta').trigger('change');
|
||||
}
|
||||
|
||||
|
||||
@ -320,20 +359,31 @@ class DatosLibro {
|
||||
|
||||
if (this.solapasSobrecubierta.prop('checked')) {
|
||||
this.divSolapasSobrecubierta.removeClass('d-none');
|
||||
if(this.cargando)
|
||||
return;
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_sobrecubierta');
|
||||
}
|
||||
else {
|
||||
this.divSolapasSobrecubierta.addClass('d-none');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_sobrecubierta');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_sobrecubierta');
|
||||
if ($('#compSobrecubierta').length) {
|
||||
$('#compSobrecubierta').val(0).trigger('change');
|
||||
}
|
||||
if(this.cargando)
|
||||
return;
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_sobrecubierta');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_sobrecubierta');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
changeAnchoSolapasSobrecubierta() {
|
||||
|
||||
|
||||
// para que se actualice el comparador
|
||||
$('#compSobrecubierta').trigger('change');
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
if (this.checkSolapasGrandes('sobrecubierta')) {
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_grandes_sobrecubierta');
|
||||
@ -341,25 +391,25 @@ class DatosLibro {
|
||||
else {
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_sobrecubierta');
|
||||
}
|
||||
|
||||
// para que se actualice el comparador
|
||||
$('#compSobrecubierta').trigger('change');
|
||||
}
|
||||
|
||||
|
||||
changeAnchoSolapasFaja() {
|
||||
|
||||
// para que se actualice el comparador
|
||||
if($('#compGramajeFaja').select2('data').length > 0){
|
||||
$('#compGramajeFaja').trigger('change');
|
||||
}
|
||||
|
||||
if(this.cargando)
|
||||
return;
|
||||
|
||||
if (this.checkSolapasGrandes('faja')) {
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_grandes_faja');
|
||||
}
|
||||
else {
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_faja');
|
||||
}
|
||||
|
||||
// para que se actualice el comparador
|
||||
if($('#compGramajeFaja').select2('data').length > 0){
|
||||
$('#compGramajeFaja').trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
checkSolapasGrandes(elemento) {
|
||||
@ -519,6 +569,8 @@ class DatosLibro {
|
||||
|
||||
cargarDatos(datos) {
|
||||
|
||||
this.cargando = true;
|
||||
|
||||
this.paginas.val(datos.paginas);
|
||||
this.tirada.val(datos.tirada);
|
||||
this.calcular_mermas();
|
||||
@ -594,6 +646,8 @@ class DatosLibro {
|
||||
this.ferro.prop('checked', datos.ferro);
|
||||
this.ferroDigital.prop('checked', datos.ferroDigital);
|
||||
this.marcapaginas.prop('checked', datos.marcapaginas);
|
||||
|
||||
this.cargando = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user