import { Component, Injector, ViewChild, ViewEncapsulation, OnInit, DoCheck, Input, AfterViewInit } from '@angular/core'; import { appModuleAnimation } from '@shared/animations/routerTransition'; import { AppComponentBase } from '@shared/common/app-component-base'; import { OrderServiceProxy, OrderListDto, OrderStatusAttachmentServiceProxy } from '@shared/service-proxies/service-proxies'; import { LazyLoadEvent } from 'primeng/components/common/lazyloadevent'; import { Paginator } from 'primeng/components/paginator/paginator'; import { Table } from 'primeng/components/table/table'; import { finalize } from 'rxjs/operators'; import { ActivatedRoute, Router } from '@angular/router'; import { OrderAttachment } from './order-attachments.component'; import * as moment from 'moment'; import { AddOrderStatusModalComponent } from '../order-status/add-order-status-modal.component'; import { DomSanitizer } from '@angular/platform-browser'; import {Location} from '@angular/common'; declare var $: any; declare var jquery:any; @Component({ templateUrl: './order-detail.component.html', encapsulation: ViewEncapsulation.None, animations: [appModuleAnimation()], styleUrls: ['./order-detail.component.less'] }) export class OrderDetailComponent extends AppComponentBase implements OnInit { zoom: number = 12; // initial center position for the map lat: number = 34.044971; lng: number = -118.291243; map: any; image: Array<{src:string,caption:string,thumb:string}> = new Array(); orderNumber:string; trackingId:string; @ViewChild('dataTable', { static: true }) dataTable: Table; @ViewChild('paginator', { static: true }) paginator: Paginator; @ViewChild('orderAttachment', { static: true }) orderAttachment: OrderAttachment; @ViewChild('addOrderStatusModal', { static: true }) addOrderStatusModal: AddOrderStatusModalComponent; //Filters filterText = ''; id: any; _isLab: any; orderDetails: OrderListDto = new OrderListDto(); constructor( injector: Injector, private _orderAppService: OrderServiceProxy, private _attachmentService: OrderStatusAttachmentServiceProxy, public sanitizer: DomSanitizer, private _router: Router, private route: ActivatedRoute, private _location:Location, private router:Router ) { super(injector); } ngOnInit() { this._isLab = abp.features.isEnabled('App.RouteDetails'); this.route.paramMap.subscribe(params => { this.id = params.get("id") }) this._orderAppService.getOrderForView( this.id ).pipe(finalize(() => this.spinnerService.hide())).subscribe(result => { this.orderDetails = result; if (this._isLab) { this.lat = result.deliveryDetail.contact.address.geocode.latitude; this.lng = result.deliveryDetail.contact.address.geocode.longitude; } else { this.lat = result.pickupDetail.contact.address.geocode.latitude; this.lng = result.pickupDetail.contact.address.geocode.longitude; } result.orderTags.forEach(element => { if(element.tag.tagType.name == "Order Number"){ this.orderNumber = element.tag.name } if(element.tag.tagType.name == "Tracking Identifier"){ this.trackingId = element.tag.name } }); }); // image // this.image = [] this._attachmentService.getOrderStatusAttachmentList(this.id) .pipe(finalize(() => this.spinnerService.hide())).subscribe(result => { for (let index = 0; index < result.length; index++) { this._attachmentService.getImageIdInternal(result[index].binaryObjectId).subscribe(image => { // console.log(this.sanitizer.bypassSecurityTrustUrl('data:image/jpeg;base64,'+images.pictureString)); this.image.push({ src: 'data:image/jpeg;base64,' + image.pictureString, thumb: 'data:image/jpeg;base64,' + image.pictureString, caption: result[index].fileName }); }); } }); } mapReady(event: any) { this.map = event; } addOrderStatusModalShow() { this.addOrderStatusModal.show() } goBack(){ this._location.back(); } navOrder(id){ this.router.navigate(['/app/sprintship/controller-order-package-detail/', id]); } }