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

@Component({
  selector: 'academic-years-search',
  templateUrl: './academic-years-search.component.html',
  styleUrls: ['./academic-years-search.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class AcademicYearsSearchComponent implements OnInit {
  query = {
    academic_year_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_year_code: null
    }
  }

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

}
