import { Component, Injector, OnInit, ViewChild, ViewEncapsulation, Input, ViewChildren, ChangeDetectorRef } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { AppConsts } from '@shared/AppConsts'; import { appModuleAnimation } from '@shared/animations/routerTransition'; import { AppComponentBase } from '@shared/common/app-component-base'; import { OrderServiceProxy, OrderListDto, ControllerOrderPackagesListServiceProxy, OrderStatusServiceProxy, OrderStatusListDto, OrderStatusTypeServiceProxy, GetControllerOrderPackagesListDto } from '@shared/service-proxies/service-proxies'; // ControllerOrderPackagesListDto, import * as moment from 'moment'; import { LazyLoadEvent } from 'primeng/components/common/lazyloadevent'; import { Paginator } from 'primeng/components/paginator/paginator'; import { Table } from 'primeng/components/table/table'; import { HttpClient } from '@angular/common/http'; import { finalize, count } from 'rxjs/operators'; import { formatDate } from "@angular/common"; import { AddOrderStatusModalComponent } from '../order-status/add-order-status-modal.component'; import { ViewOrderStatusComponent } from '../order-status/view-order-status.component'; import {Location} from '@angular/common'; @Component({ templateUrl: './order-packages-detail.component.html', encapsulation: ViewEncapsulation.None, animations: [appModuleAnimation()], providers: [ControllerOrderPackagesListServiceProxy], styleUrls: ['./order-packages-list.component.less'] }) export class ControllerOrderPackageDetailComponent extends AppComponentBase implements OnInit{ @ViewChild('dataTable', {static: true}) dataTable: Table; @ViewChild('paginator', {static: true}) paginator: Paginator; @ViewChild('addOrderStatusModal', { static: false }) addOrderStatusModal : AddOrderStatusModalComponent @ViewChild('viewOrderStatus', { static: true }) viewOrderStatus : ViewOrderStatusComponent @Input() filters: { locationFilter : number; startDate: Date; endDate: Date } = < any > {}; filterText: string; orderPackageId : number; orderId:number orderPackageCustomer: string space=" "; latitude:number orderPackage: GetControllerOrderPackagesListDto = new GetControllerOrderPackagesListDto(); orderStatuses: Array<{}> = new Array(); orderPackageDateAndTime: any orderStatusTypes: any formattedOrderPackageDateAndTime: any formattedOrderPackageStatusDateAndTime: any formattedOrderPackagePickupDetail: any formattedOrderPackageDeliveryDetail: any formattedOrderPackageStatusTime:any _isLab: any constructor( injector: Injector, private id:ActivatedRoute, private _controllerOrderPackageAppService: ControllerOrderPackagesListServiceProxy, private _orderStatusAppService: OrderStatusServiceProxy, private _orderStatusTypeAppService : OrderStatusTypeServiceProxy, private ref: ChangeDetectorRef, private _location:Location ) { super(injector); } ngOnInit(){ this._isLab = abp.features.isEnabled('App.RouteDetails'); this.id.paramMap.subscribe(params => { this.orderPackageId = Number(params.get('id')); }); // this.getOrderStatusType(); this.getOrderPackageDetail(); } // ngAfterViewInit(){ // this.getOrderPackageDetail(); // } addOrderStatusModalShow(){ // this.createOrEditPostalCodeModal.show(); this.addOrderStatusModal.show() console.log('show') } getOrderPackageDetail(): void{ let timeId = localStorage.getItem('timeZoneId'); moment.tz.setDefault(timeId); this._controllerOrderPackageAppService .getControllerOrderPackageDetails( this.orderPackageId ).pipe().subscribe(result => { this.orderId=result[0]['orderId'] this.orderPackage= result[0]; // this.getOrderStatus(this.orderId) // this.getOrderStatus(this.orderId); }); } // getOrderStatus(orderId:number,event?: LazyLoadEvent): void{ // if (this.primengTableHelper.shouldResetPaging(event)) { // this.paginator.changePage(0); // return; // } // this.spinnerService.show(); // this._orderStatusAppService.getOrderStatus( // undefined, // undefined, // orderId, // undefined, // undefined, // undefined, // this.primengTableHelper.getSorting(this.dataTable), // this.primengTableHelper.getMaxResultCount(this.paginator, event), // this.primengTableHelper.getSkipCount(this.paginator, event) // ).pipe(finalize(() => this.spinnerService.hide())).subscribe(statusResult => { // this.orderStatuses=statusResult.items; // // this.formattedOrderPackageStatusTime=moment(statusResult.items['time']).utc().format('MM/DD/YYYY, h:mm a') // console.log(moment(statusResult.items['time']).utc().format('MM/DD/YYYY, h:mm a')) // console.log("break") // console.log(moment(statusResult.items[0]['time']).utc().format('MM/DD/YYYY, h:mm a')) // this.primengTableHelper.totalRecordsCount = statusResult.totalCount; // }); // } // getOrderStatusType(): void{ // this._orderStatusTypeAppService.getOrderStatusType( // undefined, // undefined, // undefined, // undefined, // undefined, // undefined, // undefined // ).pipe(finalize(() => this.spinnerService.hide())).subscribe(result => { // this.orderStatusTypes=result.items; // }); // } goBack(){ this._location.back(); } }