import {Component, OnInit, ChangeDetectionStrategy, Input, OnChanges, Output, EventEmitter} from '@angular/core';
import {BaseList} from '../../../../../../core/base/base-list';

@Component({
  selector: 'app-is-main-true',
  templateUrl: './is-main-true.component.html',
  styleUrls: ['./is-main-true.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class IsMainTrueComponent extends BaseList implements OnInit, OnChanges {
  @Input() dataTrue: any = [];
  @Output() edit = new EventEmitter();
  @Output() expand = new EventEmitter();
  @Output() delete = new EventEmitter();
  column = [
    '1',
    'testing_information_code',
    'testing_information_name',
    'academic_semester_code',
    'academic_year_code',
    '12',
    'count_subject',
    'is_open',
    'is_main',
    'created_by',
    'created_datetime',
    '8'
  ];
  reload: boolean;
  constructor() {
    super();
  }

  ngOnInit(): void {
    this.reload = false;
    setTimeout(() => {
      this.reload = true;
    }, 2000);
  }

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

  onEdit(id){
    this.edit.emit(id);
  }

  onExpand(id){
    this.expand.emit(id);
  }

  onDelete(id){
    this.delete.emit(id);
  }

}
