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