import { Component, Input, OnChanges, OnInit, OnDestroy, Output, SimpleChanges } from '@angular/core'; import { FormControl } from '@angular/forms'; import { BomModel, ListItemModel } from '@arrow/bom/core'; import { ConfigService } from '@arrow/bom/config'; import { Subscription } from 'rxjs'; import { EndCustomer, RowBase as Row, UserUploadData } from '../ORM'; @Component({ selector: 'bom-user-uploaded-data', templateUrl: 'user-uploaded-data.component.html', styleUrls: ['../part-name/part-name.component.scss'] }) /** * @deprecated */ export class UserUploadedDataComponent implements OnChanges, OnInit { @Input() row: Row; @Input() item: ListItemModel; @Input() itemLoading: boolean; @Input() partNameControl: FormControl; @Input() bom: BomModel; @Input() customerType?: any; hasCpns: boolean; permissions: any; subscriptions: Array = []; CpnMapCreationError: boolean; isMyArrow = false; appliedCPN = ''; appliedEC: EndCustomer; availableECs: EndCustomer[] = []; userUploadData: UserUploadData; cpnMapCreationErrorMessage = 'There was an error creating this CPN. Please create it manually using the CPN link in the Part Number column.'; constructor(public config: ConfigService) {} ngOnInit(): void { this.isMyArrow = this.config.getTarget() === 'myarrow'; // myarrow|models } ngOnChanges(changes: SimpleChanges) { if (changes['row']) { if (this.row.cpnToEcRel) { this.hasCpns = !!this.row.cpnToEcRel.cpns.length; if (this.row.cpnToEcRel && this.row.pricing) { this.availableECs = this.row.cpnToEcRel.ecMap.get(this.appliedCPN) || []; } if (this.row.errorCode) { this.CpnMapCreationError = this.row.errorCode === 40001 ? true : false; } if (this.row.userUploadData) { this.userUploadData = this.row.userUploadData; } } } } }