import {
    Component,
    OnInit,
    ChangeDetectionStrategy,
    Input,
    OnChanges,
    SimpleChanges,
    ChangeDetectorRef
} from '@angular/core';
import {MatDialog} from '@angular/material/dialog';
import {tap} from 'rxjs/operators';
import {BaseList} from 'src/app/core/base/base-list';

@Component({
    selector: 'app-check-candidate-list-table',
    templateUrl: './check-candidate-list-table.component.html',
    styleUrls: ['./check-candidate-list-table.component.scss'],
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class CheckCandidateListTableComponent extends BaseList implements OnInit, OnChanges {
    @Input() eligibleCandidateList: any = [];
    @Input() haveExam: any;
    column = ['1', '2', '3', '4', '7', '8', '9', '10', '11', '0'];

    constructor(
        private dialog: MatDialog,
        private cdf: ChangeDetectorRef,
    ) {
        super();
    }

    ngOnInit(): void {
        this.getEventPage().pipe(
            tap(x => this.onPaginatorPageChange.emit(x))
        ).subscribe()
    }

    ngOnChanges(changes: SimpleChanges): void {
        this.eligibleCandidateList = this.updatePagingMatabe(this.eligibleCandidateList ? this.eligibleCandidateList : []);
    }

}
