import { Component, Inject, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { InformationsData } from 'src/app/interfaces/acquisition-management/provider/provider.interface';
import { FormGroup } from '@angular/forms';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';

@Component({
  selector: 'app-information-provider',
  templateUrl: './information-provider.component.html',
  styleUrls: ['./information-provider.component.css']
})
export class InformationProviderComponent implements OnInit {

  public formGroupInformation: FormGroup;
  constructor(
    @Inject(MAT_DIALOG_DATA) public dataInformation: InformationsData
  ) {
    this.formGroupInformation = this.createFormGroupInformation();
  }

  ngOnInit(): void {
  }

  private createFormGroupInformation(): FormGroup {
    return new FormGroup({
      'NOMBRE_COMERCIAL': new FormControl({ value: this.dataInformation.RAZON_SOCIAL, disabled: true }),
      'CORREO': new FormControl({ value: this.dataInformation.CORREO, disabled: true }),
      'NOMBRE': new FormControl({ value: this.dataInformation.NOMBRE, disabled: true }),
      'APELLIDO_PATERNO': new FormControl({ value: this.dataInformation.PRIMER_APELLIDO, disabled: true }),
      'APELLIDO_MATERNO': new FormControl({ value: this.dataInformation.SEGUNDO_APELLIDO, disabled: true }),
      'LADA1': new FormControl({ value: this.dataInformation.LADA1, disabled: true }),
      'TELEFONO1': new FormControl({ value: this.dataInformation.TELEFONO1, disabled: true }),
      'LADA2': new FormControl({ value: this.dataInformation.LADA2, disabled: true }),
      'TELEFONO2': new FormControl({ value: this.dataInformation.TELEFONO2, disabled: true }),
      'GIRO_EMPRESA': new FormControl({ value: this.dataInformation.GIRO_EMPRESA, disabled: true }),
      'TIPO_EMPRESA': new FormControl({ value: this.dataInformation.TIPO_EMPRESA, disabled: true }),
      'RFC': new FormControl({ value: this.dataInformation.RFC, disabled: true }),
      'TAXID': new FormControl({ value: this.dataInformation.TAXID, disabled: true }),
      'SITIO_WEB': new FormControl({ value: this.dataInformation.SITIO_WEB, disabled: true }),
    });
  }

  get NOMBRE_COMERCIAL () {return this.formGroupInformation.get('NOMBRE_COMERCIAL');}
  get CORREO () {return this.formGroupInformation.get('CORREO');}
  get NOMBRE () {return this.formGroupInformation.get('NOMBRE');}
  get APELLIDO_PATERNO () {return this.formGroupInformation.get('APELLIDO_PATERNO');}
  get APELLIDO_MATERNO () {return this.formGroupInformation.get('APELLIDO_MATERNO');}
  get LADA1 () {return this.formGroupInformation.get('LADA1');}
  get TELEFONO1 () {return this.formGroupInformation.get('TELEFONO1');}
  get LADA2 () {return this.formGroupInformation.get('LADA2');}
  get TELEFONO2 () {return this.formGroupInformation.get('TELEFONO2');}
  get GIRO_EMPRESA () {return this.formGroupInformation.get('GIRO_EMPRESA');}
  get TIPO_EMPRESA () {return this.formGroupInformation.get('TIPO_EMPRESA');}
  get RFC () {return this.formGroupInformation.get('RFC');}
  get TAXID () {return this.formGroupInformation.get('TAXID');}
  get SITIO_WEB () {return this.formGroupInformation.get('SITIO_WEB');}

}
