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

@Component({
  selector: 'app-setting-view-table-summary-subject',
  templateUrl: './setting-view-table-summary-subject.component.html',
  styleUrls: ['./setting-view-table-summary-subject.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class SettingViewTableSummarySubjectComponent extends BaseList implements OnInit, OnChanges{
  query = {
    testing_date: null,
  };
  @Input() subjectList: any = [];
  @Input() TestinforUid: any = [];
  @Output() search = new EventEmitter();

  column = ['1', '2', '3', '4', '5', '6', '7', '8'];
  constructor() {
    super();
  }

  ngOnInit(): void {
  }

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

  onSearch(){
    this.query.testing_date = formatDate(this.query.testing_date, 'yyyy-MM-dd', 'en-US');
    this.search.emit(this.query.testing_date);
  }

}
