import { Component, OnInit, Input, ViewChild } from '@angular/core';
import { ModalDirective } from 'angular-bootstrap-md';
import { DescriptiveCardProperties } from '../../interfaces/descriptive-card-properties-interface';
import { DescriptiveCardCSSProperties } from '../../interfaces/descriptive-card-css-properties-interface';

@Component({
  selector: 'sts-features-detail',
  templateUrl: './features-detail.component.html',
  styleUrls: ['./features-detail.component.scss']
})

export class FeaturesDetailComponent implements OnInit {
  @Input() featureData;
  @ViewChild('basicModal') basicModal: ModalDirective;
  @ViewChild('modalContainer') modal;

  public descriptiveCardItem: DescriptiveCardProperties;
  public descriptiveCardCSSItem: DescriptiveCardCSSProperties;
  public carItem;
  public popImg;

  top;
  left;

  obj = {
    heading: 'Details'
  };

  constructor() {}

  ngOnInit() {}

  openDialog(e?: any) {
    this.modal.nativeElement.style.display = "block";
    const cursorX = e.screenX;
    const cursorY = e.screenY;
    this.top = cursorY;
    this.left = cursorX;
  }

  closeDialog() {
    this.modal.nativeElement.style.display = "none";
  }

  public updateDsccp(event: DescriptiveCardCSSProperties) {
    this.descriptiveCardCSSItem = event;
  }

}
