Loading packages/admin-web-angular/src/app/pages/+carriers/+carrier/carrier-orders/carrier-orders.component.ts +89 −93 Original line number Diff line number Diff line Loading @@ -19,14 +19,14 @@ import _ from 'lodash'; import { LocalDataSource } from 'ng2-smart-table'; import { Subject, Observable } from 'rxjs/Rx'; import { TranslateService } from '@ngx-translate/core'; import { forkJoin, Subscription } from 'rxjs'; import { forkJoin, Subscription, of } from 'rxjs'; import { CreatedComponent } from '../../../../@shared/render-component/created/created.component'; import { CarriersService } from '@app/@core/data/carriers.service'; import { GeoLocationOrdersService } from '@app/@core/data/geo-location-orders.service'; import GeoLocation from '@modules/server.common/entities/GeoLocation'; import { StoreOrderComponent } from '@app/@shared/render-component/carrier-orders-table/store-order.component'; import { UserOrderComponent } from '@app/@shared/render-component/carrier-orders-table/user-order-component'; import { takeUntil } from 'rxjs/operators'; import { takeUntil, catchError } from 'rxjs/operators'; const perPage = 3; let searchCustomer: boolean; Loading Loading @@ -58,6 +58,7 @@ export class CarrierOrdersComponent private _isWork: boolean; private dataCount: number; private $locationOrders: Subscription; subscription: Subscription; public carrierOnlineStatus = CarrierStatus.Online; Loading Loading @@ -95,16 +96,16 @@ export class CarrierOrdersComponent this.loadSmartTableTranslates(); this.smartTableChange(); CarrierOrdersComponent.$customerSearch .pipe(takeUntil(this.ngDestroy$)) .subscribe(async (searchText: string) => { this.subscription = CarrierOrdersComponent.$customerSearch.subscribe( async (searchText: string) => { await this.loadDataCount({ byRegex: [{ key: 'user.firstName', value: searchText }], }); await this.loadSmartTableData(1, { byRegex: [{ key: 'user.firstName', value: searchText }], }); }); } ); } ngOnChanges() { Loading Loading @@ -170,9 +171,8 @@ export class CarrierOrdersComponent } async smartTableChange() { this.sourceSmartTable this.subscription = this.sourceSmartTable .onChanged() .pipe(takeUntil(this.ngDestroy$)) .subscribe(async (event) => { if (event.action === 'page') { const page = event.paging.page; Loading Loading @@ -225,16 +225,14 @@ export class CarrierOrdersComponent const getTranslate = (name: string): Observable<string | any> => this._translateService.get(columnTitlePrefix + name); forkJoin( this.subscription = forkJoin( this._translateService.get('Id'), getTranslate('WAREHOUSE'), getTranslate('CUSTOMER'), getTranslate('WAREHOUSE_STATUS'), getTranslate('CARRIER_STATUS'), getTranslate('CREATED') ) .pipe(takeUntil(this.ngDestroy$)) .subscribe( ).subscribe( ([ id, warehouse, Loading @@ -261,10 +259,7 @@ export class CarrierOrdersComponent cell?: string, search?: string ): boolean { if ( !searchCustomer && oldSearch !== search ) { if (!searchCustomer && oldSearch !== search) { oldSearch = search; searchCustomer = true; Loading @@ -285,9 +280,9 @@ export class CarrierOrdersComponent type: 'string', valuePrepareFunction: (_, order: Order) => { let warehouseStat = 'BAD_STATUS'; getTranslate(order.warehouseStatusText) .pipe(takeUntil(this.ngDestroy$)) .subscribe((y) => { getTranslate( order.warehouseStatusText ).subscribe((y) => { warehouseStat = y; }); Loading @@ -299,11 +294,11 @@ export class CarrierOrdersComponent type: 'string', valuePrepareFunction: (_, order: Order) => { let carrierStat = 'No Status'; getTranslate(order.carrierStatusText) .pipe(takeUntil(this.ngDestroy$)) .subscribe((y) => { getTranslate(order.carrierStatusText).subscribe( (y) => { carrierStat = y; }); } ); return carrierStat; }, Loading Loading @@ -364,7 +359,6 @@ export class CarrierOrdersComponent }, searchObj ) .pipe(takeUntil(this.ngDestroy$)) .subscribe(async (ordersForWork: Order[]) => { const currentOrder = await this.carriersService.getCarrierCurrentOrder( this.selectedCarrier.id Loading @@ -388,5 +382,7 @@ export class CarrierOrdersComponent ngOnDestroy() { this.ngDestroy$.next(); this.ngDestroy$.complete(); this.subscription.unsubscribe(); this.$locationOrders.unsubscribe(); } } Loading
packages/admin-web-angular/src/app/pages/+carriers/+carrier/carrier-orders/carrier-orders.component.ts +89 −93 Original line number Diff line number Diff line Loading @@ -19,14 +19,14 @@ import _ from 'lodash'; import { LocalDataSource } from 'ng2-smart-table'; import { Subject, Observable } from 'rxjs/Rx'; import { TranslateService } from '@ngx-translate/core'; import { forkJoin, Subscription } from 'rxjs'; import { forkJoin, Subscription, of } from 'rxjs'; import { CreatedComponent } from '../../../../@shared/render-component/created/created.component'; import { CarriersService } from '@app/@core/data/carriers.service'; import { GeoLocationOrdersService } from '@app/@core/data/geo-location-orders.service'; import GeoLocation from '@modules/server.common/entities/GeoLocation'; import { StoreOrderComponent } from '@app/@shared/render-component/carrier-orders-table/store-order.component'; import { UserOrderComponent } from '@app/@shared/render-component/carrier-orders-table/user-order-component'; import { takeUntil } from 'rxjs/operators'; import { takeUntil, catchError } from 'rxjs/operators'; const perPage = 3; let searchCustomer: boolean; Loading Loading @@ -58,6 +58,7 @@ export class CarrierOrdersComponent private _isWork: boolean; private dataCount: number; private $locationOrders: Subscription; subscription: Subscription; public carrierOnlineStatus = CarrierStatus.Online; Loading Loading @@ -95,16 +96,16 @@ export class CarrierOrdersComponent this.loadSmartTableTranslates(); this.smartTableChange(); CarrierOrdersComponent.$customerSearch .pipe(takeUntil(this.ngDestroy$)) .subscribe(async (searchText: string) => { this.subscription = CarrierOrdersComponent.$customerSearch.subscribe( async (searchText: string) => { await this.loadDataCount({ byRegex: [{ key: 'user.firstName', value: searchText }], }); await this.loadSmartTableData(1, { byRegex: [{ key: 'user.firstName', value: searchText }], }); }); } ); } ngOnChanges() { Loading Loading @@ -170,9 +171,8 @@ export class CarrierOrdersComponent } async smartTableChange() { this.sourceSmartTable this.subscription = this.sourceSmartTable .onChanged() .pipe(takeUntil(this.ngDestroy$)) .subscribe(async (event) => { if (event.action === 'page') { const page = event.paging.page; Loading Loading @@ -225,16 +225,14 @@ export class CarrierOrdersComponent const getTranslate = (name: string): Observable<string | any> => this._translateService.get(columnTitlePrefix + name); forkJoin( this.subscription = forkJoin( this._translateService.get('Id'), getTranslate('WAREHOUSE'), getTranslate('CUSTOMER'), getTranslate('WAREHOUSE_STATUS'), getTranslate('CARRIER_STATUS'), getTranslate('CREATED') ) .pipe(takeUntil(this.ngDestroy$)) .subscribe( ).subscribe( ([ id, warehouse, Loading @@ -261,10 +259,7 @@ export class CarrierOrdersComponent cell?: string, search?: string ): boolean { if ( !searchCustomer && oldSearch !== search ) { if (!searchCustomer && oldSearch !== search) { oldSearch = search; searchCustomer = true; Loading @@ -285,9 +280,9 @@ export class CarrierOrdersComponent type: 'string', valuePrepareFunction: (_, order: Order) => { let warehouseStat = 'BAD_STATUS'; getTranslate(order.warehouseStatusText) .pipe(takeUntil(this.ngDestroy$)) .subscribe((y) => { getTranslate( order.warehouseStatusText ).subscribe((y) => { warehouseStat = y; }); Loading @@ -299,11 +294,11 @@ export class CarrierOrdersComponent type: 'string', valuePrepareFunction: (_, order: Order) => { let carrierStat = 'No Status'; getTranslate(order.carrierStatusText) .pipe(takeUntil(this.ngDestroy$)) .subscribe((y) => { getTranslate(order.carrierStatusText).subscribe( (y) => { carrierStat = y; }); } ); return carrierStat; }, Loading Loading @@ -364,7 +359,6 @@ export class CarrierOrdersComponent }, searchObj ) .pipe(takeUntil(this.ngDestroy$)) .subscribe(async (ordersForWork: Order[]) => { const currentOrder = await this.carriersService.getCarrierCurrentOrder( this.selectedCarrier.id Loading @@ -388,5 +382,7 @@ export class CarrierOrdersComponent ngOnDestroy() { this.ngDestroy$.next(); this.ngDestroy$.complete(); this.subscription.unsubscribe(); this.$locationOrders.unsubscribe(); } }