import { CommonModule } from '@angular/common'; import { Component, EventEmitter, Input, Output } from '@angular/core'; // modules import { AngularSvgIconModule } from 'angular-svg-icon'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; // components import { CaAppTooltipV2Component } from '../ca-app-tooltip-v2/ca-app-tooltip-v2.component'; import { CaSearchMultipleStatesComponent } from '../ca-search-multiple-states/ca-search-multiple-states.component'; // enums import { eVehicleList } from './enums'; import { eStringPlaceholder } from '../../enums'; // constants import { VehicleListConstants } from './utils/constants'; // pipes import { TruckTrailerColorFinderPipe, ThousandSeparatorPipe, } from '../../pipes'; // svg routes import { VehicleListSvgRoutes } from './utils/svg-routes'; // interfaces import { IVehicleListConfig, IVehicleListActionsEmit } from './interfaces'; @Component({ selector: 'app-ca-vehicle-list', templateUrl: './ca-vehicle-list.component.html', styleUrl: './ca-vehicle-list.component.scss', imports: [ // modules CommonModule, AngularSvgIconModule, NgbModule, // components CaAppTooltipV2Component, CaSearchMultipleStatesComponent, // pipes ThousandSeparatorPipe, TruckTrailerColorFinderPipe, ] }) export class CaVehicleListComponent { @Input() set vehicleListConfig(data: IVehicleListConfig) { this._vehicleListConfig = data; this.getConstantData(); } @Output() vehicleListActionsEmitter = new EventEmitter(); @Output() onSearchActionEmit: EventEmitter = new EventEmitter(); public _vehicleListConfig!: IVehicleListConfig; // svg routes public vehicleListSvgRoutes = VehicleListSvgRoutes; // enums public eVehicleList = eVehicleList; public eStringPlaceholder = eStringPlaceholder; // header public vehicleListHeaderItems: string[] = []; // helper indexes public vehicleHoverIndex: number = -1; constructor() {} private getConstantData(): void { this.vehicleListHeaderItems = VehicleListConstants.VEHICLE_LIST_HEADER_ITEMS; } public handleVehicleTypeHoverAction(vehicleIndex: number): void { this.vehicleHoverIndex = vehicleIndex; } public onClickActions(action?: IVehicleListActionsEmit): void { this.vehicleListActionsEmitter.emit(action); } public onSearchAction(searchText: string): void { this.onSearchActionEmit.emit(searchText); } }