import {Component, OnInit, TemplateRef, ViewChild} from '@angular/core';
import {ListComponent} from '../../../classes/base_components/list/list.component';
import {EditTypesComponent} from './edit-types/edit-types.component';
import {Http} from '@angular/http';
import {Dialog} from '../../../classes/base_components/dialog/dialog';
import {TypesService} from '../../../classes/resorcess/types.service';


@Component({
  selector: 'app-type',
  templateUrl: './types.component.html',
  styleUrls: ['./types.component.scss']
})
export class TypesComponent extends ListComponent implements OnInit {
  @ViewChild('filter_id') public filter_id_ref: TemplateRef<any>;
  @ViewChild('filter_name') public filter_name_ref: TemplateRef<any>;

  constructor(
    public listService: TypesService,
    public dialog: Dialog,
    public http: Http,
  ) {
    super(listService, dialog, EditTypesComponent, http);
    this.listService.register();
  }

  ngOnInit() {
    this.columns = [
      {
        prop: 'name',
        name: 'نام',
        filter: this.filter_name_ref,
      },
      {
        prop: 'id',
        name: 'شناسه',
        filter: this.filter_id_ref,
      },

    ];
    super.ngOnInit();
  }

}
