import {Component, OnInit, ChangeDetectionStrategy, Output, EventEmitter} from '@angular/core';
import {createQueryStringFromObject} from '../../../../../../shared/util/func';

@Component({
    selector: 'app-testing-vdos-search',
    templateUrl: './testing-vdos-search.component.html',
    styleUrls: ['./testing-vdos-search.component.scss'],
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class TestingVdosSearchComponent implements OnInit {
    @Output() add = new EventEmitter();
    @Output() search = new EventEmitter();
    academicYearList;
    statusMock = [{id: 1, name: 'ใช้งาน'}, {id: 2, name: 'ยกเลิก'}];
    query = {
        testing_vdo_name_th: null,
        testing_vdo_code: null
    };
    constructor() { }

    ngOnInit(): void {
    }

    onAdd(){
        this.add.emit();
    }

    onSearch(){
        const query = createQueryStringFromObject(this.query);
        this.search.emit(query);
    }

    clear(){
        this.query = {
            testing_vdo_name_th: null,
            testing_vdo_code: null
        };
    }

}
