import { Component, Inject, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import {
  MatDialog,
  MatDialogRef,
  MAT_DIALOG_DATA,
} from '@angular/material/dialog';

@Component({
  selector: 'app-mesmcv-form',
  templateUrl: './mesmcv-form.component.html',
  styleUrls: ['./mesmcv-form.component.css'],
})
export class MESMCVFORMComponent implements OnInit {
  formGroup: FormGroup;

  constructor(
    public dialogRef: MatDialogRef<any>,
    @Inject(MAT_DIALOG_DATA) public data: any
  ) {
    this.formGroup = this.createFormGroup();
  }

  ngOnInit(): void {}

  private createFormGroup() {
    
    return new FormGroup({
      IDSOLICITUD: new FormControl({
        value: `Solicitud: #${this.data.item.IDSOLICITUD} - ${this.data.item.NOMBREEMPLEADO}`,
        disabled: true,
      }),
      motivo: new FormControl('', Validators.required),
    });
  }

  get motivo() {
    return this.formGroup.get('motivo');
  }

  get IDSOLICITUD() {
    return this.formGroup.get('IDSOLICITUD');
  }
}
