import { Component, Inject, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { GetIssueTracking } from 'src/app/interfaces/acquisition-management/issue-tracking.interface';
import { SliderData } from 'src/app/interfaces/slider.interface';

@Component({
  selector: 'app-details-issue-tracking',
  templateUrl: './details-issue-tracking.component.html',
  styleUrls: ['./details-issue-tracking.component.css'],
})
export class DetailsIssueTrackingComponent implements OnInit {
  public arrImages: Array<SliderData>;
  public formGroup: FormGroup;
  constructor(@Inject(MAT_DIALOG_DATA) public objIssueTracking: GetIssueTracking) {
    this.formGroup = this.createFormGroup();
    this.arrImages = [];
  }
  ngOnInit(): void {
    this.objIssueTracking.SEPR_EVID.map((evidence:string) => {
      this.arrImages.push({
        image: evidence,
        width: '521px',
        height: '300px'
      });
    });
 
  }

  private createFormGroup() {
    return new FormGroup({
      TIPO: new FormControl(this.objIssueTracking.SEPR_TIPO, Validators.required),
      DESCRIPCION: new FormControl(this.objIssueTracking.SEPR_DESC, Validators.required),
      RESULUCION: new FormControl(this.objIssueTracking.SEPR_RESO, Validators.required),
    });
  }
}
