Advertisement
Guest User

Untitled

a guest
Jun 14th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (this.router.url.indexOf('edit') !== -1) {
  2.       this.activatedRoute.params.subscribe(params => {
  3.         this.quotesService.get(params['id'], quote => {
  4.           this.clientControl.setValue(quote.client.name);
  5.           this.projectNameControl.setValue(quote.projectName);
  6.           this.divisionControl.setValue(quote.division.id);
  7.           this.typeControl.setValue(quote.type);
  8.           this.dateControl.setValue(quote.date);
  9.           this.clientContactControl.setValue(quote.clientContact);
  10.           this.regionControl.setValue(quote.region);
  11.           this.priceControl.setValue(quote.price.toString().split('.')[0]);
  12.           if ((quote.price.toString().split('.')[1]) === undefined) {
  13.             this.centsControl.setValue('00');
  14.           } else {
  15.             this.centsControl.setValue(quote.price.toString().split('.')[1]);
  16.           }
  17.           this.commentsControl.setValue(quote.comments);
  18.           this.followUpControl.setValue(quote.followUp);
  19.         }, () => {
  20.           this.snackbarService.showError('Une erreur est survenue. L\'opportunité demandée est introuvable.');
  21.           this.router.navigate(['/opportunities/list']);
  22.         });
  23.       });
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement