Commit 280e1410ba0fb353dd666d2584c57047b0fdbec9
1 parent
7a4c13c468
Exists in
master
agrego modal
Showing
1 changed file
with
8 additions
and
6 deletions
Show diff stats
src/app/comprobantes/comprobantes.component.ts
| ... | ... | @@ -3,6 +3,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; |
| 3 | 3 | import { BusquedaComprobanteComponent } from '../busqueda-comprobante/busqueda-comprobante.component'; |
| 4 | 4 | import { ComprobanteService } from './comprobantes.service'; |
| 5 | 5 | import { Router } from '@angular/router'; |
| 6 | +import { ModalService } from '../modal/modal.service'; | |
| 6 | 7 | |
| 7 | 8 | @Component({ |
| 8 | 9 | templateUrl: './comprobantes.component.html', |
| ... | ... | @@ -14,7 +15,8 @@ export class ComprobantesComponent implements OnInit { |
| 14 | 15 | constructor( |
| 15 | 16 | private modalService: NgbModal, |
| 16 | 17 | public comprobanteService: ComprobanteService, |
| 17 | - public router: Router) { } | |
| 18 | + public router: Router, | |
| 19 | + private modal: ModalService) { } | |
| 18 | 20 | |
| 19 | 21 | ngOnInit() { } |
| 20 | 22 | |
| ... | ... | @@ -57,12 +59,12 @@ export class ComprobantesComponent implements OnInit { |
| 57 | 59 | guardarComprobante() { |
| 58 | 60 | |
| 59 | 61 | if (this.getCantidadArticulosByEstado('pendiente')) { |
| 60 | - alert('No deben quedar articulos pendientes'); | |
| 62 | + this.modal.alert('No deben quedar articulos pendientes'); | |
| 61 | 63 | return; |
| 62 | 64 | } |
| 63 | 65 | |
| 64 | 66 | if (!this.cuerpo.length) { |
| 65 | - alert('Debe seleccionar un comprobante'); | |
| 67 | + this.modal.alert('Debe seleccionar un comprobante'); | |
| 66 | 68 | return; |
| 67 | 69 | } |
| 68 | 70 | |
| ... | ... | @@ -72,13 +74,13 @@ export class ComprobantesComponent implements OnInit { |
| 72 | 74 | .saveComprobantes({cabecera: this.cabecera, cuerpo: this.cuerpo}) |
| 73 | 75 | .subscribe(data => { |
| 74 | 76 | |
| 75 | - alert('Comprobante guardado con éxito'); | |
| 77 | + this.modal.alert('Comprobante guardado con éxito'); | |
| 76 | 78 | this.saveLoading = false; |
| 77 | 79 | this.router.navigateByUrl('/home'); |
| 78 | 80 | |
| 79 | 81 | }, err => { |
| 80 | 82 | |
| 81 | - alert('Algo salió mal...'); | |
| 83 | + this.modal.alert('Algo salió mal...'); | |
| 82 | 84 | this.saveLoading = false; |
| 83 | 85 | console.log(err); |
| 84 | 86 | }); |
| ... | ... | @@ -101,7 +103,7 @@ export class ComprobantesComponent implements OnInit { |
| 101 | 103 | |
| 102 | 104 | inputArticulo(articulo) { |
| 103 | 105 | if (articulo.tempRecibido > 999999) { |
| 104 | - alert('Cantidad máxima superada'); | |
| 106 | + this.modal.alert('Cantidad máxima superada'); | |
| 105 | 107 | return; |
| 106 | 108 | } |
| 107 | 109 | articulo.input = false; |