@WidgetComponent
    
    
File
    Description
    
    Used in iPIM Buy.
No Widgetframe.
Button of type mat-raised-button
    
    Metadata
    
        
            
                | selector | nm-product-details-head | 
            
                | styleUrls | head.component.scss | 
            
                | templateUrl | ./head.component.html | 
        
    
    
    Index
    
        
            
                | 
                        Widget inputs
                     | 
                        
                             
                        
              
             
                |  | 
                
                           
                        
                             
                        
                        
                        
              
             
                |  | 
                
                           
              
             
                |  | 
                
                        
              
                |  | 
             
                | 
                        Widget outputs
                     | 
                        
                             
                        
                             
                        
                             
                        
                        
                        
                             
                          
              
                |  | 
            
            
            
             
            
                | 
                        Properties
                     | 
            
                |  | 
               
            
                | 
                        Methods
                     | 
            
                |  | 
                  
        
    
    
    
    
        
            Methods
        
        
            
                
                    | Protected
                            configureWidget | 
                
                    | configureWidget(configuration: WidgetConfig) | 
                    
                        | Decorators : WidgetConfigure | 
                        
                            |  | 
                
                    | 
                             
                                    
                                 | 
            
        
        
    
    
        
        
            
                
                    | Public
                            _id | 
                
                    | _id:      | 
                    
                        | Decorators : WidgetId | 
                        
                            |  | 
            
        
        
            
                
                    | Public
                            assetHref | 
                
                    | assetHref:      | 
                    
                        | Default value : new ReplaySubject<any>(1) | 
                        
                            |  | 
            
        
        
            
                
                    | Public
                            assets | 
                
                    | assets:      | 
                    
                        | Default value : new Subject<any>() | 
                    
                        | Decorators : WidgetInput | 
                        
                            |  | 
            
        
        
            
                
                    | Public
                            cols | 
                
                    | cols:     any[] | 
                    
                        | Type : any[] | 
                        
                            |  | 
            
        
        
        
            
                
                    | Public
                            header | 
                
                    | header:     any | 
                    
                        | Type : any | 
                        
                            |  | 
            
        
        
            
                
                    | Public
                            manufacturerImage | 
                
                    | manufacturerImage:     any | 
                    
                        | Type : any | 
                    
                        | Default value : "" | 
                        
                            |  | 
            
        
        
            
                
                    | Public
                            product | 
                
                    | product:     any | 
                    
                        | Type : any | 
                        
                            |  | 
            
        
        
            
                
                    | Public
                            productNo | 
                
                    | productNo:      | 
                    
                        | Default value : new Subject<any>() | 
                    
                        | Decorators : WidgetInput | 
                        
                            |  | 
            
        
        
            
                
                    | Public
                            reload | 
                
                    | reload:      | 
                    
                        | Default value : new Subject<any>() | 
                    
                        | Decorators : WidgetInput | 
                        
                            |  | 
            
        
 
    
        import {
  combineLatest as observableCombineLatest,
  Subject,
  ReplaySubject,
  Observable,
} from "rxjs";
import { filter, map, mergeMap, distinctUntilChanged } from "rxjs/operators";
import { Component } from "@angular/core";
import { WidgetframeService } from "../../widgetframe/widgetframe.service";
import { WidgetConfig } from "../../widget.configuration";
import {
  WidgetComponent,
  WidgetId,
  WidgetConfiguration,
  WidgetConfigure,
  WidgetInput,
  WidgetOutput,
} from "../../widget.metadata";
import * as uriTemplates_ from "uri-templates";
const uriTemplates = uriTemplates_;
declare var $: any;
/**
 * Used in iPIM Buy.
 * No Widgetframe.
 *
 * Button of type mat-raised-button
 */
@WidgetComponent("nm-product-details-head")
@Component({
  selector: "nm-product-details-head",
  templateUrl: "./head.component.html",
  styleUrls: ["./head.component.scss"],
})
export class HeaderWidgetComponent {
  public cols: any[];
  public header: any;
  public product: any;
  public manufacturerImage: any = "";
  public assetHref = new ReplaySubject<any>(1);
  @WidgetId()
  public _id;
  //
  @WidgetInput()
  public productNo = new Subject<any>();
  @WidgetInput()
  public assets = new Subject<any>();
  @WidgetInput()
  public reload = new Subject<any>();
  @WidgetConfiguration()
  public configuration: WidgetConfig;
  constructor(private _widgetframeService: WidgetframeService) {
    this.header = [];
    this.product = [];
  }
  @WidgetConfigure()
  protected configureWidget(configuration: WidgetConfig) {
    let headerHref = configuration._links["showcase-header"]["href"];
    let headerTemplate = uriTemplates(headerHref);
    observableCombineLatest(
      this.productNo.asObservable().pipe(distinctUntilChanged()),
      this.reload.asObservable(),
      (productNo, reloadEvent) => productNo
    )
      .pipe(
        map((number) => headerTemplate.fill({ product: number })),
        mergeMap((href) => this._widgetframeService.getData(href))
      )
      .subscribe((data) => {
        this.header = data;
      });
    let productHref = configuration._links["product"]["href"];
    let productTemplate = uriTemplates(productHref);
    observableCombineLatest(
      this.productNo.asObservable().pipe(distinctUntilChanged()),
      this.reload.asObservable(),
      (productNo, reloadEvent) => productNo
    )
      .pipe(
        map((number) => productTemplate.fill({ product: number })),
        mergeMap((href) => this._widgetframeService.getData(href))
      )
      .subscribe((data) => (this.product = data));
    let manufacturerImageHref =
      configuration._links["manufacturerImage"]["href"];
    let manufacturerImageTemplate = uriTemplates(manufacturerImageHref);
    this.manufacturerImage = "";
    this.productNo
      .asObservable()
      .pipe(
        map((number) => manufacturerImageTemplate.fill({ product: number })),
        mergeMap((href) => this._widgetframeService.getData(href)),
        filter(
          (data) =>
            data &&
            data._embedded &&
            data._embedded["asset-relations"] &&
            data._embedded["asset-relations"]["0"] &&
            data._embedded["asset-relations"]["0"]._embedded.assets
        )
      )
      .subscribe(
        (data) => {
          this.manufacturerImage =
            data["_embedded"]["asset-relations"]["0"]._embedded.assets[
              "0"
            ]._links.default.href;
        },
        (error) => {
          console.log(error);
          var err = JSON.parse(error.text());
        }
      );
    if (configuration._links["assets"]) {
      let assetHref = configuration._links["assets"]["href"];
      let assetTemplate = uriTemplates(assetHref);
      this.productNo
        .asObservable()
        .subscribe((number) =>
          this.assetHref.next(assetTemplate.fill({ product: number }))
        );
    }
  }
  ngOnInit() {}
}
     
    
        <nm-widgetframe
  [header]="configuration.configuration['header']"
  widgetId="{{ _id }}"
>
  <div slot="title" class="nm-widgetframe__title">
    {{ "productnumber" | translate }} {{ product.productNo }}
  </div>
  <div slot="content" class="nm-widgetframe__content">
    <nm-gallery
      [href]="assetHref"
      [assets]="assets"
      [width]="'500px'"
      [height]="'400px'"
      *ngIf="header !== null"
    ></nm-gallery>
    <div class="info">
      <img
        *ngIf="manufacturerImage.length > 0"
        class="nm-manufacturerImage"
        src="{{ manufacturerImage }}"
      />
      <h3>{{ header.description }}</h3>
      <span>{{ header.manufacturer }} </span>
      <div *ngIf="header?.productStateColors" class="traffic_light_container">
        <div
          *ngFor="let color of header?.productStateColors; let i = index"
          pTooltip="{{
            'infotext.product.state.' + (i + 1).toString() | translate
          }}"
          class="traffic_light traffic_light_grid single"
        >
          <span class="active" [ngClass]="color"></span>
        </div>
      </div>
      <ul class="nm-featurelist" *ngIf="header?.sellingPoints != null">
        <li *ngFor="let sellingPoint of header?.sellingPoints">
          {{ sellingPoint }}
        </li>
      </ul>
      <div class="nm-categorypath">
        <div *ngIf="header?.purchaseCategory">
          <h4>{{ "purchase.category" | translate }}:</h4>
          <ul>
            <li *ngFor="let node of header?.purchaseCategory; let last = last">
              {{ node }}
              <span class="divider" *ngIf="!last"> / </span>
            </li>
          </ul>
        </div>
        <div>
          <div *ngIf="header?.salesCategories">
            <h4>{{ "categories" | translate }}:</h4>
            <ul>
              <li *ngFor="let category of header?.salesCategories">
                <span *ngFor="let node of category; let last = last">
                  {{ node }}
                  <span class="divider" *ngIf="!last"> / </span>
                </span>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <button
        class="nm-add-to-card-button"
        mat-raised-button
        color="primary"
        *ngFor="let act of product._actions | iterable"
        [nm-action]="act.value"
        [action-name]="act.key"
      >
        <mat-icon>add_shopping_cart</mat-icon>
        {{ "addproducttocart" | translate }}
      </button>
    </div>
  </div>
</nm-widgetframe>
     
    
        
        
            
                Legend
            
            
            
            
                Html element with directive