import { Component, OnInit , Inject } from '@angular/core';
import { Http, Response } from '@angular/http';
import {Map} from '../map';
import {Contact} from '../contact';
import {ContactService} from '../contact.service';
import { Injectable } from '@angular/core';
import {Matrix} from '../matrix';
import * as moment from 'moment-timezone';
import {MdDialog, MdDialogRef, MD_DIALOG_DATA} from '@angular/material';
declare var google: any;
@Component({
  selector: 'gmap',
  templateUrl: 'gmap.component.html',
  styleUrls: ['gmap.component.css'],
  providers: [ContactService]
})
@Injectable()
export class GmapComponent  implements OnInit {


    constructor( public dialogRef: MdDialogRef<GmapComponent>,
      @Inject(MD_DIALOG_DATA) public data: any,private contactService: ContactService) { }
      onNoClick(): void {
        this.dialogRef.close();
      }
      matrixs: Matrix[];
      matrix: Matrix;
      Device_ID : any;
      Matrix_Name : any;
      Topic : any;
      Message : any;
      User_ID : any;
      mat:any;
row:any;
input:any;
ontime:any;
offtime:any;
onn_time:any;
offf_time:any;
      addmatrix(){
console.log(this.inputs)

 /*    console.log(this.offtime)

        const newMatrix ={
          
          Device_ID: this.data.did,
          Matrix_Name: this.Matrix_Name,
          User_ID: this.emailid,
          Mess_Top: this.inputs,
      
     } 
      console.log(newMatrix);
       this.contactService.addmatrix(newMatrix)
      .subscribe(matrix => {
        this.matrixs.push(matrix);

    
      }
       
      )
      this.dialogRef.close();
      this.contactService.getmatrix( this.data.did).subscribe(
        
        mat_data => {
          this.mat = mat_data 
        }); */ 
    
    }
    save(my){
      console.log(my);
    }

      emailid:any;
    //  aa:any;
 
   
      inputs = [{topic: '' , message: ''}];
      addInput()  {
        this.inputs.push({topic: '',message:''});
      }
    ngOnInit() {
  
     this.emailid = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).email;
    }   
      
  
}






