
import { Component, OnInit, Inject } from '@angular/core';
import { ContactService } from '../contact.service';
import { Router } from '@angular/router';
import { MdDialogRef, MD_DIALOG_DATA } from '@angular/material';

@Component({
  selector: 'app-poi-dtl-del',
  templateUrl: './poi-dtl-del.component.html',
  styleUrls: ['./poi-dtl-del.component.scss']
})
export class PoiDtlDelComponent implements OnInit {

  dataPoi:any;
  constructor(private contactService: ContactService,private router: Router,public dialogRef: MdDialogRef<PoiDtlDelComponent>,
    @Inject(MD_DIALOG_DATA) public data: any) { 
      // this.routeId = data.routeId;
      // console.log(this.routeId);
    }

  ngOnInit() {
    this.dataPoi=JSON.parse(localStorage.poiShowDelData);
  }
  cancel(){
    this.dialogRef.close('close');
  }
  delete(){
    this.contactService.deletePOI(this.dataPoi._id).subscribe(resp => {
      this.dialogRef.close('delete');
      console.log("delete POI",resp);
    })
  }

}