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

@Component({
  selector: 'app-setup-period-by-subject-testinfor-list',
  templateUrl: './setup-period-by-subject-testinfor-list.component.html',
  styleUrls: ['./setup-period-by-subject-testinfor-list.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class SetupPeriodBySubjectTestinforListComponent extends BaseList implements OnInit, OnChanges{
  @Input() subjectList: any = [];
  @Output() edit = new EventEmitter();
  column = [
    '1',
    'testing_information_code',
    'testing_information_name',
    'academic_semester_code',
    'academic_year_code',
    '8',
    'count_subject',
    'created_by',
    'is_open',
    'created_datetime',
    '7'
  ];
  reload: boolean;
  constructor(
    private appTokenSV: AppTokenService
  ) {
    super();
  }

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

  ngOnChanges(){
    this.subjectList = this.updateMatTable(this.subjectList ? this.subjectList : []);
  }

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

}
