import {Component} from '@angular/core';
import {SubscribingComponent} from "../../../shared/components/subscribing.component";
import {CompanyService} from "../../service/company.service";
import {EmployeePermission} from "../../../shared/model/employee";
import {FormBuilder} from "@angular/forms";
import {ActivatedRoute, Router} from "@angular/router";

@Component({
  selector: 'cre-list',
  templateUrl: './list.component.html',
  styleUrls: ['./list.component.sass']
})
export class ListComponent extends SubscribingComponent {
  companies$ = this.companyService.all
  columns = [
    {def: 'name', title: 'Nom', valueFn: c => c.name}
  ]
  buttons = [{
    text: 'Modifier',
    linkFn: t => `/catalog/company/edit/${t.id}`,
    permission: EmployeePermission.EDIT_COMPANY
  }]

  constructor(
    private companyService: CompanyService,
    router: Router,
    activatedRoute: ActivatedRoute
  ) {
    super(activatedRoute, router)
  }
}
