import { ExternalPageService } from './../../shared/external-page.service';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { AuthServiceService } from '../../shared/auth-service.service';
import { NgxSpinnerService } from 'ngx-spinner';

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

  constructor(private http: HttpClient, 
    private spinner: NgxSpinnerService,
    private externalService: ExternalPageService,
    private authSer: AuthServiceService) { }

    contactUs = [];

  ngOnInit() {
    this.spinner.show();
    this.authSer.homeActivate = false;
    this.http.get(this.authSer.pathApi + '/get_contact_us/1').subscribe(
      (responce) => {
        console.log(responce);
        this.contactUs = responce['contact_us'];
        this.spinner.hide();
      },
      (error) => {
        console.log(error);
      }
    );

    this.externalService.getHeader().subscribe(
      (responce) => {
        this.externalService.headerMenus = responce['parents'];
        console.log('wesssssaaaaaaaaaaaaaaaaaaaaam' , this.externalService.headerMenus);
        for(let i = 0; i < this.externalService.headerMenus.length; i++) {
          if(this.externalService.headerMenus[i].id == 23) {
            this.externalService.headerMenus[i].active = 1;
          } else {
            this.externalService.headerMenus[i].active = 0;
          }
        }
        this.spinner.hide();
      },
      (error) => {
        console.log(error);
      }
    );

  }

 

}
