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

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

    ngOnInit(): void {
    }

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

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

    clear(){
        this.query = {
            faculty_name_th :null
        }
    }

}
