// import { Component, OnInit } from '@angular/core';

// @Component({
//   selector: 'app-all-menus',
//   templateUrl: './all-menus.component.html',
//   styleUrls: ['./all-menus.component.scss']
// })
// export class AllMenusComponent implements OnInit {

//   constructor() { }

//   ngOnInit() {
//   }

// }


// import { Component, OnInit } from '@angular/core';

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

//   constructor() { }

//   ngOnInit() {
//   }

// }
////////////////////////////
import { Component, OnInit, Input } from '@angular/core';
import { Params, Router, ActivatedRoute } from '@angular/router'
import { ContactService } from '../../contact.service';
import { TranslateService } from 'ng2-translate';
import { MdDialog } from '@angular/material';
import { DemoVideosComponent } from '../../const/demo-videos/demo-videos.component';
// import { PoiListComponent } from '../poi-list/poi-list.component';
// import { PoiDtlDelComponent } from "../poi-dtl-del/poi-dtl-del.component";
// import { MdDialog } from '@angular/material';
// import { Data } from '../data';

declare var google: any,$:any;
@Component({
    selector: 'app-all-menus',
  templateUrl: './all-menus.component.html',
  styleUrls: ['./all-menus.component.scss']
})
export class AllMenusComponent implements OnInit {
 // 
  marker1: any;
  mapData: any[];
  routePath: any;
  before: any;
  logoutbut: boolean;
  cust: boolean = false;
  logo: any;
  text: any;
  fs: any; ls: any; emailid: any; or: any; useridd: any; mb: any; custtype: any; dealer: any;
  showImage: any;
  groups = [];
  group_info: any;
  deviceId: any;
  device_update: any;
  markerpoi: any;
  superAdmin: any = false;
  waypoints_path:any;
  routeData:any;
  cnt:any =0;
  showIMEI=false
  dbMap:any;
  dbMapInit:any = false;
  menuFlag:any ='';
  isOperator: boolean = false;
  isOrganisation: boolean = false;
  reportPrefrecne: any;
  paddingLeft:boolean=false
  reportArray = [
    {name:"Daily Report",Rstatus:true,Astatus:false,value:"daily_report"},
    {name:"Daywise Report",Rstatus:true,Astatus:false,value:"daywise_report"},
    {name:"Speed Variation",Rstatus:true,Astatus:false,value:"speed_variation"},
    {name :"Fuel Report",Rstatus : true,Astatus:false,value:"fuel_report"},
    {name :"Idle Report",Rstatus : true,Astatus:false,value:"idle_report"},
    {name:"Fuel Consumption Report",Rstatus:true,Astatus:false,value:"fuel_consumption_report"},
    {name:"Trip Report",Rstatus:true,Astatus:false,value:"trip_report"},
    {name : "Travel Path Report",Rstatus : true,Astatus:false,value:"travel_path_report"},
    {name : "Summary Report",Rstatus : true,Astatus:false,value:"summary_report"},
    {name : "Geofence Report",Rstatus : true,Astatus:false,value:"geofence_report"},
    {name : "Overspeed Report",Rstatus : true,Astatus:false,value:"overspeed_report"},
    {name : "Route Violation Report",Rstatus : true,Astatus:false,value:"route_violation_report"},
    {name : "Stoppage Report",Rstatus : true,Astatus:false,value:"stoppage_report"},
    {name : "Ignition Report",Rstatus : true,Astatus:false,value:"ignition_report"},
    {name : "Distance Report",Rstatus : true,Astatus:false,value:"distance_report"},
    {name : "POI Report",Rstatus : true,Astatus:false,value:"poi_report"},
    {name : "SOS Report",Rstatus : true,Astatus:false,value:"sos_report"},
    {name : "AC Report",Rstatus : true,Astatus:false,value:"ac_report"},
    {name : "Driver Performance Report",Rstatus : true,Astatus:false,value:"driver_performance_report"},
    {name : "User Trip Report",Rstatus : true,Astatus:false,value:"user_trip_report"},
    {name : "Alert Report",Rstatus : true,Astatus:false,value:"alert_report"}  ,
    {name : "Loading Unloading Trip",Rstatus : true,Astatus:false,value:"loading_unloading_trip"} ,
    {name : "Working Hours Reports",Rstatus : true,Astatus:false,value:"working_hours_report"},
    {name : "Maintenance Reports",Rstatus : true,Astatus:false,value:"maintanance_report"},
    {name:"Daily Logs",Rstatus:true,Astatus:false,value:"daily_logs"},
    {name : "Notification Center",Rstatus : true,Astatus:false,value:"notification_master"},
  ];
  availaPointsFlag: boolean = false;
  pointCount: number = 0;
  adressTab: boolean=false;
  phone: any;
  // ,public dialog: MdDialog
  constructor(public dialog: MdDialog,private router: Router, private route: ActivatedRoute, private contactService: ContactService,public translate: TranslateService) {
    this.contactService.totalTicketCount.subscribe(totalTicketCount => {
        //  this.ticketCount = totalTicketCount
       this.useridd = JSON.parse(window.atob(window.localStorage.token.split('.')[1]))._id;
    this.fs = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).fn;
    this.phone=JSON.parse(window.atob(window.localStorage.token.split(".")[1])).phn;
    this.ls = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).ln;
    this.isOrganisation = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isOrganisation;
    // console.log("jwtvalue",JSON.parse(window.atob(window.localStorage.token.split(".")[1])));
    this.ngOnInit()
     });
    this.useridd = JSON.parse(window.atob(window.localStorage.token.split('.')[1]))._id;
    
    if(this.useridd=="59cbbdbe508f164aa2fef3d8"){
      this.showIMEI=true;
      
    }
    console.log("USEERRRR",this.useridd,'59cbbdbe508f164aa2fef3d8', this.showIMEI);
    this.fs = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).fn;
    this.ls = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).ln;
    this.isOrganisation = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isOrganisation;
    // console.log("jwtvalue",JSON.parse(window.atob(window.localStorage.token.split(".")[1])));
    
    var routeID = localStorage.getItem('routeId')

    // this.route.params.subscribe((params:Params)=>{
    // let id= params['routePath._id'];
    // this.getRouteData(routeID);

    // });
    
  }
  link
  menuWidth:any;
  sup_admin:boolean;
  ngOnInit() {
    // console.log("Inside all app menu component---------------------------------------------");
    // this.superAdmin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin;
    if(localStorage.getItem('superadmin')=="ON"){
      this.sup_admin = true;
      this.logoutbut = false;
      this.dealer = false;
    }

    this.logo = window.localStorage['logo'];
  
    // this.text = window.localStorage['text'];
    // window.localStorage['DataUpdate'] = 'Tthis.rue'
    this.fs = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).fn;
    this.ls = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).ln;
    // this.emailid = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).email;
    this.or = JSON.parse(window.atob(window.localStorage.token.split(".")[1]))._orgName;
    this.superAdmin = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).isSuperAdmin;
    this.mb = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).phn;
    // // this.routePath = JSON.parse(localStorage.getItem('routeData'));
    this.custtype = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isDealer;
    this.isOperator = JSON.parse(window.atob(window.localStorage.token.split('.')[1])).isOperator;

    this.reportPrefrecne = JSON.parse(window.atob(window.localStorage.token.split(".")[1])).report_preference;   
  
    let that = this;
    if(this.reportPrefrecne !=undefined){
    
      var tempReport = this.reportPrefrecne;
      console.log(this.reportPrefrecne);
      
      for(let dt in tempReport){
        let arr = that.reportArray.filter(function(d){ 
          return d.value == dt;
        })
        arr[0].Astatus = tempReport[dt]?tempReport[dt].Astatus:false;
        arr[0].Rstatus = tempReport[dt]?tempReport[dt].Rstatus:false;
      }
      
    }

    

    // console.log("this.reportPrefrecne=>",this.reportPrefrecne);
  
    if (this.custtype == true) {
      this.cust = true;
    }

    // let foods = [];

    // if (this.mb.charAt(0) == "n") {
    //   this.mb = ' '
    // }
    if (window.localStorage['Custumer'] == 'ON') {
      // this.logoutbut = true;
      this.sup_admin =false;
      this.dealer = true;
    }else if(window.localStorage['superadmin']=='ON'){
      this.logoutbut = false;
    }
    else {
      this.logoutbut = true;
    }
    
    this.getLanguage()


    this.menuFlag = this.contactService.menuReturnGet();
    var chkProfilePic = localStorage.getItem('profilePic');
    // console.log('chkProfilePic',chkProfilePic);
    if(chkProfilePic == null){
      this.getProfileImagePath();
    }else{
      this.ppSHOW = true; 
      this.profilePic = chkProfilePic ; 
    }

    this.availaPointsFlag = false ;
    if((this.custtype === true)||((this.superAdmin === true)&&(this.isOrganisation === false))){
      // console.log("Inside FunctionCheckpoint");
      this.availaPointsFlag = true ;
      this.getPointAvailable(this.useridd);
    }
    this. checkPassword();
    // if(this.useridd === '59cbbdbe508f164aa2fef3d8'){
    //   this.adressTab = true;
    // }

    $(document).on('click', '.dropdown-menu', function (e) {
      e.stopPropagation();
    });
    // this.getLink()

  }

  getLink(){
    // 9481773053'
    console.log("PHONE_________-------",this.phone);
    
    this.contactService.get('/pullData/getSetuLink?mobileNumber='+this.phone).subscribe((res:any)=>{
      console.log(res);
      if(res.link){
        this.link=res.link

      }
    })
  }

//2 menu dashboard 
  soon(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("const?_i=" + window.localStorage.token);
  }
  // 3 menu
  group(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);

    this.router.navigateByUrl("group_view");
  }
  // 4 menu
  devi(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);

    this.router.navigateByUrl("dashboard");
  }

  productSummary(id){
    this.router.navigateByUrl("product-summary");

  }

  orderSummary(id){
    this.router.navigateByUrl("orderSummary");

  }

  tempDetal(id){
    this.router.navigateByUrl("device-report/temp_report");

  }
  //5 menu
  openNav(id) {
    this.contactService.menuReturnSet(id);
    this.router.navigate(['/location'],{queryParams : {pageid : 'locationComponent'}});
  }



  //6 menu
  geo(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("geofencing");
  }
  // 7 menu 
  report(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("device-report");

  }

  daywisereport(){
    this.router.navigateByUrl("device-report/daywise-report");
  }
  subAdmin(){
    this.router.navigateByUrl("suAdmin");
  }

    
  vehicleExpense(id){
    this.router.navigateByUrl("vehicleExpense");
  }

  temp_report(id){
    this.router.navigateByUrl("device-report/tempGraph");
  }

  commandQueue(id){
    this.router.navigateByUrl("commanQueue");
  }

  addressList(id){
    this.router.navigateByUrl("addreessUpdate");
  }


  censorDetail(id){
    this.router.navigateByUrl("censor");

  }
  fuelPrice(id){
    console.log(id);
      this.router.navigate(["/FuelPrice"]);
  }

  daily_logs(){
    this.router.navigateByUrl("device-report/dailyLogs");
  }

  workingHour(id){
    this.router.navigateByUrl("workhourReport");
  }

  reminder_list(id)
  {
    this.router.navigateByUrl("vehicle/reminder_service");

  }

  

  TrackingHistory(id){
    // this.menuFlag =  this.contactService.menuReturnSet(id);
    // this.router.navigateByUrl("location/live-history");

    this.contactService.menuReturnSet(id);
    this.router.navigate(['/location'],{queryParams : {pageid : 'locationHistory'}});
  }


  dev_fuel_report(){
    this.router.navigateByUrl("device-report/dev-fuel-report");
  }

  POI_report(id){
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("device-report/POI_report");
  }

  SOS_report(id){
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("device-report/devicesosReport");
  }


  //8
  report_speed(id) {

    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("device-report/device-speed-report");
  }
  //9
  trip_report(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("device-report/trip_report");
//10
  }

  acReport(id){
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("device-report/ac_report");
  }
  summaryReport(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("device-report/summary-report");
  }
  //11
  geofancingReport(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("device-report/geofancing");
  }
//12

travelPath(id){
  // TravelPathReportComponent
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/travel_path");
}

messageUtility(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("messageUtility");
}
Rechange(id){
this.menuFlag =  this.contactService.menuReturnSet(id);
  // this.router.navigateByUrl("recharge");
}

billing(id){

  this.router.navigateByUrl("billingDashboard");
}

overspeed(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/overspeed");

}
//13
routeViolation(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/routeViolation");
}

mainReport(){
  this.router.navigateByUrl("maintananceReport");
  
}

idleReport(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/idle-report");
}
//14
stoppage_report(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/stoppage_report");
}
//15
ignition_report(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/ignition_report");
}
//16

distance_report(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/distance_report");
}
//17
alert_report(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/alert-report");

}

POIlist(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("POI_list");
}

userTrip(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/deviceTrip");

}

driverPerformance(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/Driver-performance");
}
//18

vehicleRoute(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("vehicleRoute");
}


//19
route_map(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("routeMapping");

}

route_plan(id){
this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("routePlan");
}

route_planReport(id){
this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("routePlanReportNew");
}
//20
addcus(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  localStorage.removeItem('mapLoad_ID')
  this.router.navigateByUrl("add");
}
//21
Ddetail(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("driverdetail");
}

userMaster(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("userLogs");
}

cssupport(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("cus_support");
}

adddistributers(){
  this.router.navigateByUrl("distributersList");
}

deviceMaster(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("deviceMaster");
}

deviceRenew(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("RenewReport");
}
deviceInventory(){
  this.router.navigateByUrl("deviceInventory");
}
gpsMaster(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("gpsMaster");

}

technician(id){
   this.router.navigateByUrl("technician");
}

jobCard(id)
{
   this.router.navigateByUrl("JobCard");
}

cmdMaster(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("cmdMaster");

}

deviceEntry(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("deviceEntry");
}

deviceInventoryList(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("Inventorylist");
}
//22
poiMenu(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("poimenu");
}
//23
myaccount(id) {
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("accountSettings");
}

loadUnload(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("device-report/tripLoadUnload");

}


load_management(id){
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("loadManagement");
}

// LR_Number(id){
//   this.menuFlag =  this.contactService.menuReturnSet(id);
//   this.router.navigateByUrl("lrinput");
// }

fuel_report(id){
  console.log(id);
  
  this.menuFlag =  this.contactService.menuReturnSet(id);
  this.router.navigateByUrl("fuel_Report");

}
//24
  mydealer(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);
    localStorage.removeItem("in1");
    window.localStorage['token'] = window.localStorage['Dealer_token'];
    localStorage.removeItem('supAdminAcessToCust');
    localStorage.removeItem('devices');
    localStorage.removeItem('custId')
    window.localStorage['DataUpdate'] = 'True';
    if (window.localStorage['DataLoaded'] = 'True') {
      window.localStorage['Custumer'] = 'OFF';
      localStorage.setItem('Dealer',"ON");
      // this.dealer = false; 
        this.sup_admin =false;
        this.logoutbut= true; 
        var chkPP = localStorage.getItem('profilePic');
        if(chkPP != null){
          localStorage.removeItem('profilePic');
        }  
       this.router.navigateByUrl("add");
      // this.router.navigateByUrl("const?_status="+"OK");
    }
  }


  super_Admin(id){
   
    this.menuFlag =  this.contactService.menuReturnSet(id);
    // localStorage.setItem('token',localStorage.getItem('superAdminToken'));
    var tempsup = localStorage.getItem('superAdminToken');
    localStorage.removeItem('supAdminAcessToCust');
    localStorage.removeItem("in1");
    if(tempsup == null){
      // console.log("Inside if block");
     this.sup_admin = false;
     this.logoutbut= true; 

    }else{
      window.localStorage['token'] = window.localStorage['superAdminToken'];
      localStorage.removeItem('devices');
      window.localStorage['DataUpdate'] = 'True';
      if(window.localStorage['DataLoaded'] = 'True'){
        // let dlrStatus = "true";
        localStorage.setItem('superadmin',"OFF");
        this.sup_admin =false;
        this.logoutbut=true;
        // localStorage.setItem("dlrchk",dlrStatus)
        var chkPP = localStorage.getItem('profilePic');
        if(chkPP != null){
          localStorage.removeItem('profilePic');
        }  
        this.router.navigateByUrl("dealerInfo");
    
        //  this.router.navigateByUrl("const?_status="+"OK");
   
      
       }
    }
   
       

  }
  //25


  notification(id){
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("notifications");
  }
  DModel(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("deviceModel");
  }
  VType(id) {
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("VehicleType");
  }
  dealerInfo(id){
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigateByUrl("dealerInfo");
  }

  logout() {
    window.localStorage.clear();
    this.router.navigateByUrl("login");
  }






  goback() {
    this.router.navigateByUrl("vehicleRoute");
  }

  new() {
    this.router.navigateByUrl("new");
  }

  checkPassword(){
    this.contactService.getImagePath(this.useridd).subscribe((res:any)=>{
    if(localStorage.getItem('currentpwd') && localStorage.getItem('currentuser')){
    
        if(res._id==localStorage.getItem('currentuser')){
          if(localStorage.getItem('currentpwd')!=res.pass){
            if(localStorage.getItem('currentpwd')!='XIt8UXhmjW'){
              this.logout()
            }

          }
        }
        // pass
      }else{
       
        this.logout()
      }
    })
  }

  ppSHOW:boolean = false;
  profilePic = '';
  getProfileImagePath(){  
    // console.log('check profile pic function');
    this.contactService.getImagePath(this.useridd).subscribe((res:any)=>{
      
      // console.log(res);
      if(res.imageDoc.length != 0){
        var str =  res.imageDoc[0]
        var splitStr = str.split('/');
        // console.log(splitStr);
        var concatStr ='';
       for(var i=1 ; i< splitStr.length ; i++){      
         if(i > 0){ 
          var tt = splitStr[i];   
         concatStr += '/'+tt ; 
         }
       }
      //  console.log(concatStr);
       this.ppSHOW = true;
         this.profilePic = 'https://www.oneqlik.in' + concatStr;
         localStorage.setItem('profilePic',this.profilePic)
      }else{
        this.ppSHOW = false ; 
      }
   
    })
  }



  cond: Boolean = false;
  point: any = 0;
  aa() {

    if (this.point == 0) {
      this.cond = true;
      this.point++;
    }
    else if (this.point % 2 == 0) {
      this.cond = true;
      this.point++;
    }
    else {
      this.cond = false
      this.point++;
    }





  }

selectedlanguage:any;
classVar:any = 'defaultClass';
classVarDashboard:any = 'styleDefaultDashboard';
getLanguage(){
//  var Var = { uid: this.useridd };
//  this.contactService.getLanguages(Var).subscribe(res=>{
   this.selectedlanguage = localStorage.getItem('appLang');

  if(this.selectedlanguage != undefined){
    if(this.selectedlanguage=='newLan2'){
      this.paddingLeft=true
    }else{
      this.paddingLeft=false
    }
    this.translate.setDefaultLang(this.selectedlanguage);
    this.translate.use(this.selectedlanguage);
    // localStorage.setItem('appLang',this.selectedlanguage);
    if(this.selectedlanguage != 'en'){
      this.classVar = 'changedclass';
      this.classVarDashboard = 'stylechangedDashboard';
    }

    if(this.selectedlanguage == 'en'){
      this.classVar = 'defaultClass';
      this.classVarDashboard = 'styleDefaultDashboard';
    }
   
  }else{
    this.translate.setDefaultLang('en');
    localStorage.setItem('appLang','en');
    this.translate.use('en');
    this.classVar = 'defaultClass';
    this.classVarDashboard = 'styleDefaultDashboard';
  }
   
//  },err=>{
//    console.log(err);
//  })

}

  dataArrayCoords: any;
  currentLatitude: any;
  currentLongitude: any;
  marker: any;



  livetrack(id){
    this.router.navigateByUrl("live");

  }


  getPointAvailable(distId){
    var distPoint = '0';
    this.contactService.getAvialblePoints(distId,distPoint).subscribe(res=>{
      // console.log(res.available_points);
      this.pointCount =res.available_points?res.available_points: 0 ; 
    })
  }
  


  tutorialVideos(){
  
      let dialogRef = this.dialog.open(DemoVideosComponent, {
        // width: '903px',
        // data: { Type: type, dataset: datasets }
        panelClass: 'custom-dialog-container'
      });
  
      dialogRef.afterClosed().subscribe(result => {
        if (result == "OKK") {
  
        }
        else if (result == "No_Dev") {
  
  
        }
      });

  }
    reports(){
    this.router.navigate(['/reports/start'])
  }
  reportScedule(){
    this.router.navigate(['/report-schedule'])
  }
  imeiFind(id){
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigate(["/IEMI_Finder"]);
  }

  userFinder(id){
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigate(["/USER_Finder"]);
  }

  
  issueList(id){
    this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigate(["/issueList"]);
  }
  RTOMaster(id){
     this.menuFlag =  this.contactService.menuReturnSet(id);
    this.router.navigate(["/RTO_Master"]);
  }
  deviceList(){
    this.router.navigate(['/deviceList'])
  }
  inActiveAdmins(){
    this.router.navigate(['/inactiveAdmins'])
  }
  toll(){
  this.router.navigate(['/toll'])
  }
}
