import {Component, OnInit, ChangeDetectionStrategy, Input, OnChanges, ChangeDetectorRef} from '@angular/core';
import {BaseList} from '../../../../../core/base/base-list';
import {MatDialog} from '@angular/material/dialog';
import {SetExamInformationDialogComponent} from '../../dialog/set-exam-information-dialog/set-exam-information-dialog.component';
import {ChangeTimeSectionComponent} from '../dialog/change-time-section/change-time-section.component';
import {Router} from '@angular/router';

@Component({
  selector: 'app-setting-exam-view-table-section',
  templateUrl: './setting-exam-view-table-section.component.html',
  styleUrls: ['./setting-exam-view-table-section.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class SettingExamViewTableSectionComponent extends BaseList implements OnInit, OnChanges {
  @Input() sectionList: any = [];
  column = ['1', '2', '3', '4'];

  constructor(
    private dialog: MatDialog,
    private cdRef: ChangeDetectorRef,
    public router: Router,
  ) {
    super();
  }

  ngOnInit(): void {
  }

  ngOnChanges(){
    console.log(this.sectionList);
    this.sectionList = this.updateMatTable(this.sectionList ? this.sectionList : []);
  }

  openDialogexam(id: any, index: any){
    console.log(id);
    console.log(index);
    // const centerList = this.centerList.data;
    const dialogRefedit = this.dialog.open(ChangeTimeSectionComponent, {
      width: '1000px',
      height: '280px',
      data: {
        id
      }
    });
  }


  onRoute(id: any, index: any){
    console.log(id);
    console.log(index);
    // const centerList = this.centerList.data;
    this.router.navigate(['exam-information/section/edit',id])

  }


}
