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

@Component({
  selector: 'app-setting-exam-list',
  templateUrl: './setting-exam-list.component.html',
  styleUrls: ['./setting-exam-list.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class SettingExamListComponent extends BaseList implements OnInit,OnChanges {
  @Input() subjectList :any = [];
  @Output() edit = new EventEmitter()
  column = [
    '11',
    '1',
    'subject_code',
    'subject_name_th',
    'subject_name_en',
    'subject_type_name_th',
    'responsible_faculty_name_th',
    'created_by',
    'created_datetime',
    'status_id',
    'is_use'
  ];
  reload: boolean;
  constructor(
    // public route: Router,
    // public activeRoute: ActivatedRoute,
    // public appTokenSV: AppTokenService
  ) {
    super()
    // super(route,activeRoute,appTokenSV)
   }

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

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

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

}
