import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { ConfigService } from '@arrow/bom/config'; @Component({ selector: 'bom-cpn', templateUrl: './bom-cpn.component.html', styleUrls: ['./bom-cpn.component.scss'] }) export class BomCpnComponent implements OnInit, OnChanges { @Input() data: any; @Input() row: any; @Input() disabled = false; @Output() editCpn: EventEmitter = new EventEmitter(); hasCpns: boolean; customerPartNumber: string; endCustomer: string; constructor(private _configService: ConfigService) {} ngOnInit() { this.disabled = this._configService.isArrowcom(); } ngOnChanges(changes: SimpleChanges): void { if (changes.data && changes.data.currentValue) { this.customerPartNumber = this.data.appliedCPN; this.endCustomer = this.data.appliedEC && this.data.appliedEC.name; } if (this.row.cpnToEcRel) { this.hasCpns = !!this.row.cpnToEcRel.cpns.length; } } onEditCpn(): void { this.editCpn.emit(null); } }