import { Component, Injector, ViewChild, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { AppConsts } from '@shared/AppConsts'; import { Router } from '@angular/router'; import { appModuleAnimation } from '@shared/animations/routerTransition'; import { AppComponentBase } from '@shared/common/app-component-base'; import { EntityDtoOfInt64, DriversServiceProxy, UserListDto, GetDriverDetailsDto, VendorsServiceProxy } from '@shared/service-proxies/service-proxies'; import { FileDownloadService } from '@shared/utils/file-download.service'; 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 {Location} from '@angular/common'; import { CreateIncidentModalComponent } from '@app/sprintship/incident/create-incident-modal.component'; import { CreateOrEditDriverIncidentModalComponent } from '@app/sprintship/employees/driver-incident/create-or-edit-driver-incident.component'; @Component({ templateUrl: './view-vendor.component.html', encapsulation: ViewEncapsulation.None, // styleUrls: ['./drivers.component.less'], animations: [appModuleAnimation()] }) export class ViewVendorComponent extends AppComponentBase { // @ViewChild('viewFleetModalComponent', { static: true }) viewFleetModal: ViewFleetModalComponent; @ViewChild('dataTable', {static: true}) dataTable: Table; @ViewChild('paginator', {static: true}) paginator: Paginator; // @ViewChild('createOrEditDriverIncidentModal', {static: false}) createOrEditDriverIncidentModal: CreateOrEditDriverIncidentModalComponent; id: any; driver: any; name: string; company: string; isActive: string; address: string; driverIncident:any; driverIncidentLen:number; timeCreated:any; phone: string; email: string; constructor( injector: Injector, private _vendorService: VendorsServiceProxy, private _router: Router, private route: ActivatedRoute, private _location:Location, ) { super(injector); } ngOnInit(){ this.route.paramMap.subscribe(params => { this.id = params.get("id") }); this._vendorService.getVendorDetails(this.id).subscribe(result => { this.driver = result; this.name = result.user.name +" " +result.user.surname; this.phone = result.user.phoneNumber; this.email = result.user.emailAddress; this.isActive = result.user.isActive? "Active" : "Inactive"; this.address = result.address.addressLine1 +", "+result.address.addressLine2 +", "+result.address.postalCode.city +", "+result.address.postalCode.state +", "+result.address.postalCode.value +", "+result.address.postalCode.country; this.driverIncident = result.vendorIncident; this.driverIncidentLen = result.vendorIncident.length; console.log(this.driverIncident); }); } getDriverDetails(){ } viewDriver(v:boolean){ this.ngOnInit(); console.log("refresh"); } createOrEditVendor(url: any, id?: number){ if(id != null){ var myurl = `${url}/${id}`; }else{ var myurl = `${url}`; } this._router.navigateByUrl(myurl); } goBack(){ this._location.back(); } }