import { Component, OnInit, ChangeDetectionStrategy, Input, OnChanges, SimpleChanges } from '@angular/core';
import { Router } from '@angular/router';
import { BaseList } from 'src/app/core/base/base-list';

@Component({
    selector: 'app-testing-info-list',
    templateUrl: './testing-info-list.component.html',
    styleUrls: ['./testing-info-list.component.scss'],
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class TestingInfoListComponent extends BaseList implements OnInit,OnChanges {
    @Input() testingInfomationList : any = [];
    column = [
        '1',
        'testing_information_code',
        'testing_information_name',
        'type_of_examinee',
        'total_seat',
        'no_imported',
        'academic_semester_code',
        'academic_year_code',
        'created_by',
        'created_datetime',
        '11'
    ];
    reload: boolean;
    constructor(
        private router: Router
    ) {
        super()
     }

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

    ngOnChanges(changes: SimpleChanges): void {
        this.testingInfomationList = this.updateMatTable(this.testingInfomationList? this.testingInfomationList:[])
    }

    onView(uid){
        this.router.navigate(['student-info/view',uid])
    }

}
