import { Component, Inject, OnInit } from '@angular/core';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatTableDataSource } from '@angular/material/table';
import { ConditionsData } from 'src/app/interfaces/acquisition-management/provider/provider.interface';
import { ConditionProviderFormComponent } from './condition-provider-form/condition-provider-form.component';

@Component({
  selector: 'app-condition-provider',
  templateUrl: './condition-provider.component.html',
  styleUrls: ['./condition-provider.component.css']
})
export class ConditionProviderComponent implements OnInit {
  public displayedColumns: Array<string>;
  public isLoading: boolean;
  public dataSource: MatTableDataSource<ConditionsData>;

  constructor(
    @Inject(MAT_DIALOG_DATA) public dataConditions: Array<ConditionsData>,
    private _dialogRef: MatDialogRef<any>
  ) {
    this.displayedColumns = [ 'TIPO_CONDITION', 'ACCIONES' ]
    this.dataSource = new MatTableDataSource(this.dataConditions);
    this.isLoading = false;
  }

  public openDialog(element:ConditionsData) {
    this._dialogRef.close(element);
  }

  ngOnInit(): void {
  }

}
