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

@Component({
  selector: 'app-immobilize',
  templateUrl: './immobilize.component.html',
  styleUrls: ['./immobilize.component.scss']
})
export class ImmobilizeComponent implements OnInit {
  inputEngincutPass:any;
  engine_cut_password:any;
  errmsg: string;
  constructor(public dialogRef: MdDialogRef<ImmobilizeComponent>,
    @Inject(MD_DIALOG_DATA) public data: any,private contactService: ContactService) { 
        this.engine_cut_password = this.data.engineCutpass ;
        console.log('engine_cut_password',this.engine_cut_password);
    }

  ngOnInit() {
  }

  errFlag= false;
  proceed(){
    if(this.engine_cut_password === this.inputEngincutPass){
      this.dialogRef.close('succ');

    }else{
      this.errmsg = "password not matched";
      this.errFlag = true
      var that = this ; 
     var endTIme =  setTimeout(function(){ 
            that.errFlag = false;
            clearTimeout(endTIme);
       }, 7000);

    }

  }

  close(){
    this.dialogRef.close('close');
  }

}
