import {Component, OnInit, ChangeDetectionStrategy, OnChanges, Input} from '@angular/core';
import {BaseList} from '../../../../../../core/base/base-list';
import {MatDialog} from '@angular/material/dialog';
import {CalendarDialogComponent} from '../../../../../settings/calendars/presenter/dialog/calendar-dialog/calendar-dialog.component';
import {tap} from 'rxjs/operators';
import {NotificationCheckExamDialogComponent} from '../../dialog/notification-check-exam-dialog/notification-check-exam-dialog.component';
import { SweetalertService } from 'src/app/core/service/sweetalert/sweetalert';

@Component({
  selector: 'app-notification-check-exam-all',
  templateUrl: './notification-check-exam-all.component.html',
  styleUrls: ['./notification-check-exam-all.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class NotificationCheckExamAllComponent extends BaseList implements OnInit, OnChanges {
  @Input() subjectList: any = [];
  column = ['1', '0', '2', '3', '4', '5'];
  constructor(
    private dialog: MatDialog,
    private swSV: SweetalertService
  ) {
    super();
  }

  ngOnInit(): void {
    this.swSV.loadingStart()
  }

  ngOnChanges(){
    this.subjectList = this.updateMatTable(this.subjectList ? this.subjectList : []);
    if(this.subjectList.data) this.swSV.close()
  }

  opendialog(data){
    const dialogRef = this.dialog.open(NotificationCheckExamDialogComponent, {
      width: '700px',
      height: '570px',
      data,
      panelClass: 'custom-modalbox'
    });
  }

}
