Commit 0a7146ac4fd84440d41fa3135ead29188e55fdeb
Exists in
develop
Merge branch 'develop' into 'develop'
Develop See merge request !97
Showing
6 changed files
Show diff stats
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
| ... | ... | @@ -129,25 +129,32 @@ export class SeleccionArticulosComponent implements OnInit, AfterViewInit, OnDes |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | openModalPromos(articulo: IArticulo) { |
| 132 | + if (this.modalRef) return; | |
| 132 | 133 | this.articuloService.setArticulosSinImagen([articulo]); |
| 133 | 134 | this.modalRef = this.modalService.show(PromocionComponent, { |
| 134 | 135 | initialState: { articulosPromo: [articulo] }, |
| 135 | - class: 'modal-dialog-centered' | |
| 136 | + class: 'modal-dialog-centered', | |
| 137 | + ignoreBackdropClick: true, | |
| 136 | 138 | }); |
| 139 | + this.modalRef.content.onClose | |
| 140 | + .subscribe(() => this.modalRef = null); | |
| 137 | 141 | this.mediaPantalla(); |
| 138 | 142 | } |
| 139 | 143 | |
| 140 | 144 | openModalSinonimos(sinonimosData: ISinonimo[], articulo: IArticulo) { |
| 145 | + if (this.modalRef) return; | |
| 141 | 146 | this.modalRef = this.modalService.show(SinonimoComponent, { |
| 142 | 147 | initialState: { |
| 143 | 148 | sinonimos: sinonimosData, |
| 144 | 149 | articulo |
| 145 | 150 | }, |
| 146 | - class: 'modal-dialog-centered' | |
| 151 | + class: 'modal-dialog-centered', | |
| 152 | + ignoreBackdropClick: true, | |
| 147 | 153 | }); |
| 148 | 154 | |
| 149 | 155 | this.modalRef.content.onClose |
| 150 | 156 | .subscribe((res: any) => { |
| 157 | + this.modalRef = null; | |
| 151 | 158 | for (const a of articulo.productos) { |
| 152 | 159 | for (const aRes of res.articulos) { |
| 153 | 160 | if (a.idSinonimo === aRes.ID_SIN) { |
src/app/services/articulo/articulo.service.ts
| ... | ... | @@ -57,7 +57,7 @@ export class ArticuloService { |
| 57 | 57 | setArticulo(articulo: IArticulo) { |
| 58 | 58 | articulo.cantidad = 1; |
| 59 | 59 | for (const articuloCarrito of this.carrito) { |
| 60 | - if (articuloCarrito.id === articulo.id && !articulo.productos.length) { | |
| 60 | + if (articuloCarrito.id === articulo.id && !articulo.productos) { | |
| 61 | 61 | articuloCarrito.cantidad++; |
| 62 | 62 | this.calcularTotal(); |
| 63 | 63 | return; |
src/app/shared/promocion/promocion.component.ts
| ... | ... | @@ -22,9 +22,11 @@ export class PromocionComponent implements OnInit { |
| 22 | 22 | onClose: Subject<any>; |
| 23 | 23 | urlImagenes = `${APP_SETTINGS.apiImagenes}/imagenes/`; |
| 24 | 24 | loading = true; |
| 25 | + modalSinonimo: BsModalRef; | |
| 26 | + isPromoSelected = false; | |
| 25 | 27 | |
| 26 | 28 | constructor( |
| 27 | - public modalPromocion: BsModalRef, | |
| 29 | + private modalPromocion: BsModalRef, | |
| 28 | 30 | private modalService: BsModalService, |
| 29 | 31 | private articuloService: ArticuloService, |
| 30 | 32 | private promocionService: PromocionService, |
| ... | ... | @@ -39,6 +41,8 @@ export class PromocionComponent implements OnInit { |
| 39 | 41 | } |
| 40 | 42 | |
| 41 | 43 | selectPromo(promo: IArticulo) { |
| 44 | + if (this.isPromoSelected) return; | |
| 45 | + this.isPromoSelected = true; | |
| 42 | 46 | this.sinonimoService.getSinonimos(promo.CodSec, promo.CodArt) |
| 43 | 47 | .subscribe((res: ISinonimo[]) => { |
| 44 | 48 | if (res.length) { |
| ... | ... | @@ -52,6 +56,7 @@ export class PromocionComponent implements OnInit { |
| 52 | 56 | } else { |
| 53 | 57 | promo.cantidad = 1; |
| 54 | 58 | this.articuloService.setArticulo(promo); |
| 59 | + this.onClose.next(); | |
| 55 | 60 | this.modalPromocion.hide(); |
| 56 | 61 | } |
| 57 | 62 | }, err => console.error(err)); |
| ... | ... | @@ -59,16 +64,24 @@ export class PromocionComponent implements OnInit { |
| 59 | 64 | } |
| 60 | 65 | |
| 61 | 66 | openModalSinonimos(sinonimosData: ISinonimo[], articulo: IArticulo) { |
| 62 | - const modalSinonimo = this.modalService.show(SinonimoComponent, { | |
| 67 | + if (this.modalSinonimo) return; | |
| 68 | + this.modalSinonimo = this.modalService.show(SinonimoComponent, { | |
| 63 | 69 | initialState: { |
| 64 | 70 | sinonimos: sinonimosData, |
| 65 | 71 | articulo |
| 66 | 72 | }, |
| 67 | - class: 'modal-dialog-centered' | |
| 73 | + class: 'modal-dialog-centered', | |
| 74 | + ignoreBackdropClick: true, | |
| 68 | 75 | }); |
| 69 | 76 | |
| 70 | - modalSinonimo.content.onClose | |
| 77 | + this.modalSinonimo.content.onClose | |
| 71 | 78 | .subscribe((res: any) => { |
| 79 | + this.modalSinonimo = null; | |
| 80 | + if (!res) { | |
| 81 | + this.onClose.next(); | |
| 82 | + this.modalPromocion.hide(); | |
| 83 | + return; | |
| 84 | + } | |
| 72 | 85 | for (const a of articulo.productos) { |
| 73 | 86 | for (const aRes of res.articulos) { |
| 74 | 87 | if (a.idSinonimo === aRes.ID_SIN) { |
| ... | ... | @@ -84,6 +97,7 @@ export class PromocionComponent implements OnInit { |
| 84 | 97 | } |
| 85 | 98 | } |
| 86 | 99 | this.articuloService.setArticulo(articulo); |
| 100 | + this.onClose.next(); | |
| 87 | 101 | this.modalPromocion.hide(); |
| 88 | 102 | }); |
| 89 | 103 | } |
src/app/shared/sinonimo/sinonimo.component.ts
| ... | ... | @@ -17,6 +17,7 @@ export class SinonimoComponent implements OnInit { |
| 17 | 17 | onClose: Subject<any>; |
| 18 | 18 | articulosSelected: IArticulo[] = []; |
| 19 | 19 | articulo: IArticulo; |
| 20 | + isSinonimoSelected = false; | |
| 20 | 21 | |
| 21 | 22 | constructor( |
| 22 | 23 | private modalRef: BsModalRef, |
| ... | ... | @@ -50,6 +51,8 @@ export class SinonimoComponent implements OnInit { |
| 50 | 51 | |
| 51 | 52 | continue() { |
| 52 | 53 | if (!this.isValid) return; |
| 54 | + if (this.isSinonimoSelected) return; | |
| 55 | + this.isSinonimoSelected = true; | |
| 53 | 56 | const ID_SINS = []; |
| 54 | 57 | const observables = []; |
| 55 | 58 | |
| ... | ... | @@ -82,6 +85,7 @@ export class SinonimoComponent implements OnInit { |
| 82 | 85 | |
| 83 | 86 | close() { |
| 84 | 87 | this.modalRef.hide(); |
| 88 | + this.onClose.next(); | |
| 85 | 89 | } |
| 86 | 90 | |
| 87 | 91 | } |
src/scss/scroll.scss
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | .scroll-y { |
| 4 | 4 | overflow-y: auto; |
| 5 | + overflow-x: hidden; | |
| 5 | 6 | scrollbar-width: none; |
| 6 | 7 | &::-webkit-scrollbar { |
| 7 | 8 | display: none; |
| ... | ... | @@ -10,6 +11,7 @@ |
| 10 | 11 | |
| 11 | 12 | .scroll-y-visible { |
| 12 | 13 | overflow-y: auto; |
| 14 | + overflow-x: hidden; | |
| 13 | 15 | &::-webkit-scrollbar { |
| 14 | 16 | width: 0.75em; |
| 15 | 17 | } |
| ... | ... | @@ -37,6 +39,7 @@ |
| 37 | 39 | |
| 38 | 40 | .scroll-x { |
| 39 | 41 | overflow-x: auto; |
| 42 | + overflow-y: hidden; | |
| 40 | 43 | scrollbar-width: none; |
| 41 | 44 | &::-webkit-scrollbar { |
| 42 | 45 | display: none; |
src/scss/styles-bootstrap.scss