Commit 80ef1caa553eddd6295b5cf57f42afc69bad1661

Authored by Eric Fernandez

Merge branch 'master' into 'master'

Master(efernandez)

See merge request !17
src/app/comprobantes/comprobantes.component.ts
... ... @@ -74,13 +74,25 @@ export class ComprobantesComponent implements OnInit {
74 74 .saveComprobantes({cabecera: this.cabecera, cuerpo: this.cuerpo})
75 75 .subscribe(data => {
76 76  
77   - this.modal.alert('Comprobante guardado con éxito');
78   - this.saveLoading = false;
79   - this.router.navigateByUrl('/home');
  77 + this.modal.alert('Comprobante guardado con éxito').result.then( () => {
  78 +
  79 + this.saveLoading = false;
  80 + this.router.navigateByUrl('/home');
  81 + });
80 82  
81 83 }, err => {
82 84  
83   - this.modal.alert('Algo salió mal...');
  85 + if (err.status == 510) {
  86 +
  87 + this.modal.alert('Ya existe el comprobante').result.then(() => {
  88 +
  89 + this.router.navigateByUrl('/home');
  90 + });
  91 + } else {
  92 +
  93 + this.modal.alert('Algo salió mal...');
  94 + }
  95 +
84 96 this.saveLoading = false;
85 97 console.log(err);
86 98 });
src/app/modal/modal.service.ts
... ... @@ -12,6 +12,8 @@ export class ModalService {
12 12 modalComponent: ModalAlertComponent;
13 13  
14 14 alert(texto: string) {
15   - return this.modalService.open(ModalAlertComponent).componentInstance.textoModal = texto;
  15 + let modal = this.modalService.open(ModalAlertComponent)
  16 + modal.componentInstance.textoModal = texto;
  17 + return modal;
16 18 }
17 19 }