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

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

   }

  ngOnInit(): void {
  }

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

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

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

}
