import { Component, Inject, OnInit } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ResourcesService } from 'src/app/services/resources/resources.service';

@Component({
  selector: 'app-showmultiform',
  templateUrl: './showmultiform.component.html',
  styleUrls: ['./showmultiform.component.css'],
})
export class SHOWMULTIFORMComponent implements OnInit {
  btnSmall: boolean = false;
  constructor(
    private _resourcesService: ResourcesService,
    public dialogRef: MatDialogRef<any>,
    @Inject(MAT_DIALOG_DATA) public data: any
  ) {
  }

  ngOnInit(): void {}

  public deleteItem(index:number){
    this.data.datos.splice(index, 1);
    this._resourcesService.openSnackBar("¡Elemento eliminado!", "Cerrar", 1000);
  }

  dataShow(item: any){    
    let type = typeof item;
    if(type == 'string'){
      return item
    }else{
      return item.VALUE
    }
  }
}
