import { AuthServiceService } from './../../shared/auth-service.service';
import { ActivatedRoute, Params } from '@angular/router';
import { Component, OnInit } from '@angular/core';
import { InternalPageService } from '../../shared/internal-page.service';

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

  constructor(private route: ActivatedRoute, 
    private authSer:AuthServiceService, 
    private internalService: InternalPageService) { }
  
  newsId: number;
  newsData = [];


  ngOnInit() {

  this.authSer.arabicTemplate = true;
  this.authSer.arabicLanguage = true;
  this.authSer.englishLanguage = false;
  
    this.route.params.subscribe(
      (params: Params) => {
        this.newsId = params['reportId'];
      }
    );


    //get news data 
    this.internalService.getNewsData(this.newsId).subscribe(
      (responce) => {
        console.log(responce);
        this.newsData = responce['report'];
      },
      (error) => {
        console.log(error);
      }
    )
  }

}
