Commit bedae7b5615bc3dddc6c31b727aceb8734c4d105
1 parent
ab2f9ef4cd
Exists in
develop
Fix
Mostrar modal sin stock en header de publiciadades
Showing
1 changed file
with
17 additions
and
5 deletions
 
Show diff stats
src/app/shared/header-publicidad/header-publicidad.component.ts
| ... | ... | @@ -11,6 +11,7 @@ import { SinonimoService } from 'src/app/services/sinonimo/sinonimo.service'; | 
| 11 | 11 | import { ISinonimo } from 'src/app/interfaces/ISinonimo'; | 
| 12 | 12 | import { SinonimoComponent } from '../sinonimo/sinonimo.component'; | 
| 13 | 13 | import * as _ from 'lodash'; | 
| 14 | +import { NoStockComponent } from 'src/app/modules/seleccion-articulos/no-stock/no-stock.component'; | |
| 14 | 15 | |
| 15 | 16 | @Component({ | 
| 16 | 17 | selector: 'app-header-publicidad', | 
| ... | ... | @@ -49,12 +50,23 @@ export class HeaderPublicidadComponent implements OnInit { | 
| 49 | 50 | getByID(id: number) { | 
| 50 | 51 | this.articuloService.getById(id) | 
| 51 | 52 | .subscribe((res: IArticulo) => { | 
| 52 | - if (res.FPP) { | |
| 53 | - this.openModalPromos(res); | |
| 54 | - return; | |
| 53 | + if (res.ExiVta < 1) { | |
| 54 | + if (this.modalRef) return; | |
| 55 | + this.modalRef = this.modalService.show(NoStockComponent, { | |
| 56 | + class: 'modal-dialog-centered', | |
| 57 | + backdrop: false, | |
| 58 | + ignoreBackdropClick: true, | |
| 59 | + }); | |
| 60 | + this.modalRef.content.onClose | |
| 61 | + .subscribe(() => this.modalRef = null); | |
| 55 | 62 | } else { | 
| 56 | - this.openModalConfirmacion(res); | |
| 57 | - return; | |
| 63 | + if (res.FPP) { | |
| 64 | + this.openModalPromos(res); | |
| 65 | + return; | |
| 66 | + } else { | |
| 67 | + this.openModalConfirmacion(res); | |
| 68 | + return; | |
| 69 | + } | |
| 58 | 70 | } | 
| 59 | 71 | }, err => console.error(err)); | 
| 60 | 72 | } |