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


@Component({
  selector: 'app-delete-group',
  templateUrl: './delete-group.component.html',
  styleUrls: ['./delete-group.component.scss']
})
export class DeleteGroupComponent implements OnInit {
  devDelete:any;

  constructor(public thisDialogRef: MdDialogRef<DeleteGroupComponent>, private contactService:ContactService, @Inject(MD_DIALOG_DATA) public data: any) {
    this.devDelete = data.devId;
   }

  ngOnInit() {

  }

  onCloseConfirm(){

    // console.log("deleted")
      this.contactService.deleteGroup(this.devDelete).subscribe(res => {
       
      var a = res;
      // console.log(a);
      if(a==200){
        // console.log("Group deleted Succesfully");
       this.thisDialogRef.close("success");
    }  

      },
      err=> {
        // console.log("Check your Internet Connection");
      })


  }

  onCloseCancel(){
    // console.log("cancel button clicked");
    this.thisDialogRef.close('Cancel');
  }


}