Loading packages/admin-web-angular/src/app/pages/+customers/+customer/+customer-edit/customer-edit.component.html +2 −2 Original line number Diff line number Diff line <toaster-container></toaster-container> <div> <nb-card *ngIf="customer$ | async as customer"> <nb-card *ngIf="_currentCustomer"> <nb-card-header> <div class="d-inline-flex"> <svg viewBox="0 0 24 24" class="control-icon control-icon-left" [routerLink]="['/customers/list/' + customer.id]" [routerLink]="['/customers/list/' + _currentCustomer.id]" > <path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z" Loading packages/admin-web-angular/src/app/pages/+customers/+customer/+customer-edit/customer-edit.component.ts +7 −24 Original line number Diff line number Diff line import { Component, ViewChild, EventEmitter, OnInit } from '@angular/core'; import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { first, map, switchMap, withLatestFrom, catchError, } from 'rxjs/operators'; import { first } from 'rxjs/operators'; import { ToasterService } from 'angular2-toaster'; import { BasicInfoFormComponent } from '../../../../@shared/user/forms'; import { LocationFormComponent } from '../../../../@shared/forms/location'; import { UserRouter } from '@modules/client.common.angular2/routers/user-router.service'; import IGeoLocation from '@modules/server.common/interfaces/IGeoLocation'; import User from '@modules/server.common/entities/User'; import { empty } from 'rxjs'; @Component({ templateUrl: './customer-edit.component.html', Loading @@ -41,19 +34,6 @@ export class CustomerEditComponent implements OnInit { readonly basicInfo = this.form.get('basicInfo') as FormControl; readonly location = this.form.get('location') as FormControl; readonly customerId$ = this._activatedRoute.params.pipe( map((p) => p['id']) ); readonly customer$ = this.customerId$.pipe( catchError((err) => { return empty(); }), switchMap((id) => { return this._customerRouter.get(id).pipe(first()); }) ); private _currentCustomer: User; constructor( Loading @@ -65,9 +45,12 @@ export class CustomerEditComponent implements OnInit { ) {} ngOnInit() { this.customer$ .pipe(withLatestFrom(this.customerId$)) .subscribe(([customer, id]) => { const id = this._activatedRoute.snapshot.params.id; this._customerRouter .get(id) .pipe(first()) .subscribe((customer) => { if (!customer) { this._toasterService.pop( 'error', Loading Loading
packages/admin-web-angular/src/app/pages/+customers/+customer/+customer-edit/customer-edit.component.html +2 −2 Original line number Diff line number Diff line <toaster-container></toaster-container> <div> <nb-card *ngIf="customer$ | async as customer"> <nb-card *ngIf="_currentCustomer"> <nb-card-header> <div class="d-inline-flex"> <svg viewBox="0 0 24 24" class="control-icon control-icon-left" [routerLink]="['/customers/list/' + customer.id]" [routerLink]="['/customers/list/' + _currentCustomer.id]" > <path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z" Loading
packages/admin-web-angular/src/app/pages/+customers/+customer/+customer-edit/customer-edit.component.ts +7 −24 Original line number Diff line number Diff line import { Component, ViewChild, EventEmitter, OnInit } from '@angular/core'; import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { first, map, switchMap, withLatestFrom, catchError, } from 'rxjs/operators'; import { first } from 'rxjs/operators'; import { ToasterService } from 'angular2-toaster'; import { BasicInfoFormComponent } from '../../../../@shared/user/forms'; import { LocationFormComponent } from '../../../../@shared/forms/location'; import { UserRouter } from '@modules/client.common.angular2/routers/user-router.service'; import IGeoLocation from '@modules/server.common/interfaces/IGeoLocation'; import User from '@modules/server.common/entities/User'; import { empty } from 'rxjs'; @Component({ templateUrl: './customer-edit.component.html', Loading @@ -41,19 +34,6 @@ export class CustomerEditComponent implements OnInit { readonly basicInfo = this.form.get('basicInfo') as FormControl; readonly location = this.form.get('location') as FormControl; readonly customerId$ = this._activatedRoute.params.pipe( map((p) => p['id']) ); readonly customer$ = this.customerId$.pipe( catchError((err) => { return empty(); }), switchMap((id) => { return this._customerRouter.get(id).pipe(first()); }) ); private _currentCustomer: User; constructor( Loading @@ -65,9 +45,12 @@ export class CustomerEditComponent implements OnInit { ) {} ngOnInit() { this.customer$ .pipe(withLatestFrom(this.customerId$)) .subscribe(([customer, id]) => { const id = this._activatedRoute.snapshot.params.id; this._customerRouter .get(id) .pipe(first()) .subscribe((customer) => { if (!customer) { this._toasterService.pop( 'error', Loading