import { InternalPageService } from './../../shared/internal-page.service';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { AuthServiceService } from './../../shared/auth-service.service';
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { NgxSpinnerService } from 'ngx-spinner';
import * as moment from 'moment';
import { UserService } from '../../shared/user.service';

//import 'moment/locale/ar-SA';



@Component({
  selector: 'app-internal-page',
  templateUrl: './internal-page.component.html',
  styleUrls: ['./internal-page.component.css']
})
export class InternalPageComponent implements OnInit {

  constructor(private authSer: AuthServiceService, 
    private router:Router, 
    private userservice: UserService, 
    private route: ActivatedRoute,
    private internalService: InternalPageService,
    private spinner: NgxSpinnerService,) { }

    // joinUs = [];
    // reportsData = [];
    // externalServices = [];
    // congratulations = [];
    // condolences = [];
    // internalServices = [];
    // tabsData = [];
    // achievements = [];
    // checkShowData: boolean;
    // tabtype:number = 0;
    // expandedIndex:number;
    // live_event = [];
    // next_lecture = [];
    myInnerHeight = window.innerHeight;
   externalServices = [];



    
    // flag: boolean = false;
  
    // catchEvent(event) {
    //   this.flag = true
    //   console.log(event)
    // }
  
    // hide(event) {
    //   this.flag = false;
    // }

  ngOnInit() {

    this.spinner.show();

    //this.spinner.show();
    this.authSer.showDashboardHeader = false;
    
   //get profile data
    this.userservice.getUserDataProfile();
    this.spinner.hide();
    //get parent and child data
   
    //this.router.navigate(['InternalPage/home']);

   

    // //get slider data
    // this.internalService.getSliderData().subscribe(
    //   (responce) => {
    //     console.log('responxce', responce);
    //     this.reportsData = responce['reports'];
    //   }, 
    //   (error) => {
    //     console.log(error);
    //   }
    // );

    // //get externals list 
    // this.internalService.getExternalServicesList().subscribe(
    //   (responce) => {
    //     console.log('external_list' , responce);
    //     this.externalServices = responce['external_services'];
    //   },
    //   (error) => {
    //     console.log(error);
    //   }
    // );

    // //get join us data 
    // this.internalService.getJoinUsData().subscribe(
    //   (responce) => {
    //     console.log('joooin us', responce);
    //     this.joinUs = responce['user'];
    //   },
    //   (error) => {
    //     console.log(error);
    //   }
    // );

    // this.internalService.getCongatoration().subscribe(
    //   (responce) => {
    //     console.log('condddddd' ,responce['event']);
    //     this.congratulations = responce['event'];
    //   },
    //   (error) => {
    //     console.log(error);
    //   }
    // );

    // this.internalService.getCondolences().subscribe(
    //   (responce) => {
    //     console.log('condddddd',responce['event']);
    //     this.condolences = responce['event'];
    //   },
    //   (error) => {
    //     console.log(error);
    //   }
    // );

    // this.internalService.getInternalServicesList().subscribe(
    //   (responce) => {
    //     console.log('internal serviceees',responce);
    //     this.internalServices = responce['internal_services'];
    //   },
    //   (error) => {
    //     console.log(error);
    //   }
    // );

    // this.internalService.getTabData(this.tabtype).subscribe(
    //   (responce) => {
    //     this.tabsData = responce['tabs'];
    //     if(this.tabsData.length > 0) {
    //       this.checkShowData = false;
    //     } else {
    //       this.checkShowData = true;
    //     }
    //   },
    //   (error) => {
    //     console.log(error);
    //   }
    // );

    // this.internalService.getForthAchievementsList().subscribe(
    //   (responce) => {
    //     console.log('weeeeeeeeeeeeeeeeeeee', responce);
    //     this.achievements = responce['achievements'];
    //     this.spinner.hide();
    //   },
    //   (error) => {
    //     console.log(error);
    //   }
    // );

    // this.internalService.getEventNow().subscribe(
    //   (responce) => {
    //     console.log( 'liiiiiiiiive', responce);
    //     this.live_event = responce['live_lecture'];
    //     this.next_lecture = responce['next_lecture'];
    //   },
    //   (error) => {
    //     console.log(error);
    //   }
    // )

  }

  // onLogin() {
  //   this.router.navigate(['/login']);
  // }

  // onGetProfile() {
  //   console.log('profile/'  + this.authSer.dataLoginUser['id']);
  //   this.router.navigate(['profile/'  + this.authSer.dataLoginUser['id']]);
  // }

  // //log out function
  // onLogout() { 
  //   localStorage.clear();
  //   this.router.navigate(['login']);
  // }

  // onDashBoard() {
  //   this.router.navigate(['dashboard/' + this.authSer.dataLoginUser['id']]);
  // }

  // getListPage(parent) {
  //   for(let i = 0; i< this.internalService.parentsPage.length; i++) {
  //     if(this.internalService[i].id == parent.id) {
  //       this.internalService[i].active = 1;
  //     } else if(this.internalService[0].id != parent.id) {
  //       this.internalService[i].active = 0;
  //     } else {
  //       this.internalService[i].active = 0;
  //     }
  //   }
  // };

  // onGetData(numberTab) {
  //   this.spinner.show();
  //   this.tabsData = [];
  //   this.tabtype = numberTab;
  //   this.internalService.getTabData(this.tabtype).subscribe(
  //     (responce) => {
  //       this.tabsData = responce['tabs'];
  //       if(this.tabsData.length > 0) {
  //         this.checkShowData = false;
  //       } else {
  //         this.checkShowData = true;
  //       }
  //       this.spinner.hide();
  //     },
  //     (error) => {
  //       console.log(error);
  //     }
  //   )
  // }

  // open(data,i) {
  //   console.log(data);
  //   this.expandedIndex = i;
  // }

  // closeCollapse(i) {
  //   this.expandedIndex = -1;
  // }

  




}
