Commit 3d2b5c1f83a1781e74fd897e37acb62baead242e
1 parent
f1c447c302
Exists in
develop
Fix
Al cerrar modal confirmacion
Showing
2 changed files
with
12 additions
and
4 deletions
 
Show diff stats
src/app/shared/confirmacion/confirmacion.component.ts
src/app/shared/header-publicidad/header-publicidad.component.ts
| ... | ... | @@ -21,6 +21,7 @@ export class HeaderPublicidadComponent implements OnInit { | 
| 21 | 21 | urlImagenes = `${APP_SETTINGS.apiImagenes}/imagenes/`; | 
| 22 | 22 | publicidades: IPublicidad[] = []; | 
| 23 | 23 | modalRef: BsModalRef; | 
| 24 | + modalSinonimo: BsModalRef; | |
| 24 | 25 | |
| 25 | 26 | constructor( | 
| 26 | 27 | private publicidadService: PublicidadService, | 
| ... | ... | @@ -59,6 +60,7 @@ export class HeaderPublicidadComponent implements OnInit { | 
| 59 | 60 | } | 
| 60 | 61 | |
| 61 | 62 | openModalPromos(articulo: IArticulo) { | 
| 63 | + if (this.modalRef) return; | |
| 62 | 64 | this.modalRef = this.modalService.show(PromocionComponent, | 
| 63 | 65 | { | 
| 64 | 66 | initialState: { | 
| ... | ... | @@ -69,6 +71,7 @@ export class HeaderPublicidadComponent implements OnInit { | 
| 69 | 71 | } | 
| 70 | 72 | |
| 71 | 73 | openModalConfirmacion(articulo: IArticulo) { | 
| 74 | + if (this.modalRef) return; | |
| 72 | 75 | this.articuloService.setArticulosSinImagen([articulo]); | 
| 73 | 76 | this.modalRef = this.modalService.show(ConfirmacionComponent, | 
| 74 | 77 | { | 
| ... | ... | @@ -80,9 +83,12 @@ export class HeaderPublicidadComponent implements OnInit { | 
| 80 | 83 | footerConfirmation: articulo.PreVen, | 
| 81 | 84 | footerClose: `volver` | 
| 82 | 85 | }, | 
| 86 | + ignoreBackdropClick: true, | |
| 83 | 87 | class: 'modal-dialog-centered' | 
| 84 | 88 | }); | 
| 85 | - this.modalRef.content.onClose.subscribe(() => { | |
| 89 | + this.modalRef.content.onClose.subscribe((res) => { | |
| 90 | + this.modalRef = null; | |
| 91 | + if (!res) return; | |
| 86 | 92 | this.sinonimoService.getSinonimos(articulo.CodSec, articulo.CodArt) | 
| 87 | 93 | .subscribe((res: ISinonimo[]) => { | 
| 88 | 94 | if (res.length) { | 
| ... | ... | @@ -103,14 +109,15 @@ export class HeaderPublicidadComponent implements OnInit { | 
| 103 | 109 | } | 
| 104 | 110 | |
| 105 | 111 | openModalSinonimos(sinonimosData: ISinonimo[], articulo: IArticulo) { | 
| 106 | - const modalSinonimo = this.modalService.show(SinonimoComponent, { | |
| 112 | + if (this.modalSinonimo) return; | |
| 113 | + this.modalSinonimo = this.modalService.show(SinonimoComponent, { | |
| 107 | 114 | initialState: { | 
| 108 | 115 | sinonimos: sinonimosData, | 
| 109 | 116 | articulo | 
| 110 | 117 | }, | 
| 111 | 118 | class: 'modal-dialog-centered' | 
| 112 | 119 | }); | 
| 113 | - modalSinonimo.content.onClose | |
| 120 | + this.modalSinonimo.content.onClose | |
| 114 | 121 | .subscribe((res: any) => { | 
| 115 | 122 | for (const a of articulo.productos) { | 
| 116 | 123 | for (const aRes of res.articulos) { |