import { Component, OnInit } from '@angular/core';
import { HyperService } from '../../core/services/http.service';

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

  is_modal_visible: boolean = false;
  screen_callback: any;
  assessment_id: number;
  content_data: any;
  product_info:any = [];
  loader: boolean;

  constructor(private server: HyperService) { }

  ngOnInit() {
  } 

  public showcontentrModal(url: string = "", data: any = {}, callBack: any = null) {
    this.is_modal_visible = true;
    this.content_data = data.sendData;
    console.log('Data', this.content_data)
    this.screen_callback = callBack;
    this.getDseReportDetails()

  }


  getDseReportDetails() {
    this.loader = true;
    this.server.post('manager/usertopicreport/'+ this.content_data.userid+'/'+this.content_data.topic_id, {
    })
      .then((data) => {
        if (data.status == 200 && data.result.response != 'failed') {
          this.product_info = data.result.data;
          console.log('product_info', this.product_info)
          this.loader = false;
        } else if (data.result.status == 401 && data.result.response == 'failed') { 
        }
      });
  }

  onCloseModal(){
    this.is_modal_visible = false;
    this.screen_callback(true);
  }


}
