<h2 mat-dialog-title>{{ interService.get('cambio_estado_solicitud') }}</h2>
<mat-dialog-content>
  <app-loading-card [isLoading]="isLoading" [txtLoading]="interService.get('cargando_informacion_formulario')" />
  @if (!isLoading) {
    <form [formGroup]="formGroup" class="override_content_flex">
      <div class="col-flex-12">
        <mat-form-field appearance="outline" class="w-100">
          <mat-label>{{ interService.get('flujo_trabajo') }}</mat-label>
          <input matInput type="text" formControlName="FLUJO" readonly>
        </mat-form-field>
      </div>
      <div class="col-flex-12">
        <mat-form-field appearance="outline" class="w-100">
          <mat-label>{{ interService.get('tarea') }}</mat-label>
          <input matInput type="text" formControlName="TAREA" readonly>
        </mat-form-field>
      </div>
      <div class="col-flex-12">
        <mat-form-field appearance="outline" class="w-100">
          <mat-label>{{ interService.get('proceso') }}</mat-label>
          <input matInput type="text" formControlName="PROCESO" readonly>
        </mat-form-field>
      </div>
      @if (isResponsible) {
        <div class="col-flex-12">
          <mat-form-field appearance="outline" class="w-100">
            <mat-label>{{ interService.get('estado') }}</mat-label>
            <mat-select formControlName="ESTADO">
              <mat-option value="Aceptado">Aceptado</mat-option>
              <mat-option value="Rechazado">Rechazado</mat-option>
            </mat-select>
            @if (formGroup.controls['ESTADO'].hasError('required')) {
              <mat-error [title]="interService.get('el_campo')+' '+interService.get('estado')+' '+interService.get('es_requerido')">
                {{ interService.get('el_campo') }} <b>{{ interService.get('estado') }}</b> {{ interService.get('es_requerido') }}
              </mat-error>
            }
          </mat-form-field>
        </div>
      }
      @if (formGroup.controls['ESTADO'].value === 'Rechazado') {
        <div class="col-flex-12" >
          <mat-form-field appearance="outline" class="w-100">
            <mat-label>{{ interService.get('mensaje_rechazo') }}</mat-label>
            <textarea matInput formControlName="MENSAJE_RECHAZO"></textarea>
            @if (formGroup.controls['MENSAJE_RECHAZO'].hasError('required')) {
              <mat-error [title]="interService.get('el_campo')+' '+interService.get('mensaje_rechazo')+' '+interService.get('es_requerido')">
                {{ interService.get('el_campo') }} <b>{{ interService.get('mensaje_rechazo') }}</b> {{ interService.get('es_requerido') }}
              </mat-error>
            }
          </mat-form-field>
        </div>
      }
    </form>
  }
</mat-dialog-content>
<mat-dialog-actions align="end">
  <button 
  mat-button 
  [mat-dialog-close]="false">{{ interService.get('cerrar') }}</button>
  <button 
  mat-button 
  [disabled]="isLoading" 
  (click)="verInformacion()" 
  [disabled]="requestWorkflow.ESTADO === 'En espera' || isLoading">
    {{ interService.get('ver_informacion') }}
  </button>
  @if (isResponsible) {
    <button 
    mat-button 
    [disabled]="formGroup.invalid || isLoading || requestWorkflow.ESTADO === 'En espera' || !isResponsible" 
    (click)="save()">
      {{ interService.get('guardar') }}
    </button>
  }
</mat-dialog-actions>
