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

@Component({
    selector: 'app-typesubject-search',
    templateUrl: './typesubject-search.component.html',
    styleUrls: ['./typesubject-search.component.scss'],
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class TypesubjectSearchComponent implements OnInit {
    @Output() add = new EventEmitter();
    @Output() search = new EventEmitter();
    query = {
        subject_type_name_th : null
    };
    constructor() { }

    ngOnInit(): void {
    }
    onAdd(){
        this.add.emit();
    }

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

    clear(){
        this.query = {
            subject_type_name_th : null
        };
    }

}
