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

@Component({
  selector: 'app-mesmav-form',
  templateUrl: './mesmav-form.component.html',
  styleUrls: ['./mesmav-form.component.css'],
})
export class MESMAVFORMComponent 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({
      id_solicitud: new FormControl(this.data.data.IDSOLICITUD),
      motivo_rechazo: new FormControl('', Validators.required),
    });
  }

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