Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 2x 2x 2x 2x 2x 2x | import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { Observable } from 'rxjs';
import { ShoppingFacade } from 'ish-core/facades/shopping.facade';
import { AttributeHelper } from 'ish-core/models/attribute/attribute.helper';
import { Attribute } from 'ish-core/models/attribute/attribute.model';
import { HttpError } from 'ish-core/models/http-error/http-error.model';
import { Warranty } from 'ish-core/models/warranty/warranty.model';
/**
* The Warranty Details Component displays a link to a modal dialog
* This dialog provides information in detail about the specified warranty.
*
* @example
* <ish-warranty-details
* [warranty]="warranty"
* />
*/
@Component({
selector: 'ish-product-warranty-details',
templateUrl: './product-warranty-details.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ProductWarrantyDetailsComponent {
@Input({ required: true }) warranty: Warranty;
warrantyDetails$: Observable<Warranty>;
loading$: Observable<boolean>;
error$: Observable<HttpError>;
constructor(private shoppingFacade: ShoppingFacade) {}
getWarrantyDetails(): void {
this.loading$ = this.shoppingFacade.warrantyLoading$;
this.error$ = this.shoppingFacade.warrantyError$;
this.warrantyDetails$ = this.shoppingFacade.warrantyById$(this.warranty.id);
}
getWarrantyAttribute(attributes: Attribute[], name: string): string {
return AttributeHelper.getAttributeValueByAttributeName(attributes, name);
}
}
|