

<form [formGroup]="form" *ngIf="form">
  <h1 id="advancedOptionsTitle"><i class="fas fa-sliders-h"></i> {{'MediaDetails.AdvancedOptions' | translate }}</h1>
  <hr />
  <div class="alert alert-info" role="alert">
    <i class="fas fa-x7 fa-exclamation-triangle glyphicon"></i>
    <span *ngIf="data.type === RequestType.movie">{{'MediaDetails.AutoApproveOptions' | translate }}</span>
    <span *ngIf="data.type === RequestType.tvShow">{{'MediaDetails.AutoApproveOptionsTv' | translate }}</span>
  </div>

  <div style="max-width: 0; max-height: 0; overflow: hidden;">
      <input autofocus="true" />
  </div>

<!-- User area -->
<h3><i class="fas fa-user-friends"></i> {{'MediaDetails.RequestOnBehalf' | translate }}</h3>
<mat-form-field class="example-full-width" appearance="outline" floatLabel=auto>
  <mat-label>{{ 'MediaDetails.PleaseSelectUser' | translate}}</mat-label>
  <input id="requestOnBehalfUserInput"
         type="text"
         matInput
         formControlName="username"
         [matAutocomplete]="auto">
  <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn">
    <mat-option *ngFor="let option of filteredOptions | async" [value]="option">
      {{displayFn(option)}}
    </mat-option>
  </mat-autocomplete>
</mat-form-field>
<!-- End User area -->




  <!-- Sonarr -->
  <div *ngIf="data.type === RequestType.tvShow && sonarrEnabled"><hr />
  <div>
    <h3>Sonarr Overrides</h3>
    <mat-form-field appearance="outline" floatLabel=auto>
        <mat-label>{{'MediaDetails.QualityProfilesSelect' | translate }}</mat-label>
        <mat-select id="sonarrQualitySelect" formControlName="sonarrPathId">
            <mat-option id="sonarrQualitySelect{{profile.id}}" *ngFor="let profile of sonarrProfiles" value="{{profile.id}}">{{profile.name}}</mat-option>
        </mat-select>
    </mat-form-field>
  </div>
  <div >
    <mat-form-field appearance="outline" floatLabel=auto>
        <mat-label>{{'MediaDetails.RootFolderSelect' | translate }}</mat-label>
        <mat-select id="sonarrFolderSelect" formControlName="sonarrFolderId">
            <mat-option id="sonarrFolderSelect{{profile.id}}" *ngFor="let profile of sonarrRootFolders" value="{{profile.id}}">{{profile.path}}</mat-option>
        </mat-select>
    </mat-form-field>
  </div>
  <div>
    <mat-form-field *ngIf="sonarrLanguageProfiles" appearance="outline" floatLabel=auto>
        <mat-label>{{'MediaDetails.LanguageProfileSelect' | translate }}</mat-label>
        <mat-select id="sonarrLanguageId" formControlName="sonarrLanguageId">
            <mat-option id="sonarrLanguageId{{profile.id}}" *ngFor="let profile of sonarrLanguageProfiles" value="{{profile.id}}">{{profile.name}}</mat-option>
        </mat-select>
    </mat-form-field>
  </div>
</div>
  <!-- End Sonarr-->

  <!-- Radarr -->
  <div *ngIf="data.type === RequestType.movie && radarrEnabled"><hr />
    <div>
      <h3>Radarr Overrides</h3>
        <mat-form-field appearance="outline" floatLabel=auto>
            <mat-label>{{'MediaDetails.QualityProfilesSelect' | translate }}</mat-label>
            <mat-select id="radarrQualitySelect" formControlName="radarrPathId">
                <mat-option id="radarrQualitySelect{{profile.id}}" *ngFor="let profile of radarrProfiles" value="{{profile.id}}">{{profile.name}}</mat-option>
            </mat-select>
        </mat-form-field>
    </div>
    <div mat-dialog-content>
        <mat-form-field appearance="outline" floatLabel=auto>
            <mat-label>{{'MediaDetails.RootFolderSelect' | translate }}</mat-label>
            <mat-select id="radarrFolderSelect" formControlName="radarrFolderId">
                <mat-option id="radarrFolderSelect{{profile.id}}" *ngFor="let profile of radarrRootFolders" value="{{profile.id}}">{{profile.path}}</mat-option>
            </mat-select>
        </mat-form-field>
    </div>
  </div>
    <!-- End Radarr-->


<div mat-dialog-actions class="right-buttons">
  <button mat-raised-button id="cancelButton" [mat-dialog-close]="" color="warn"><i class="fas fa-times"></i> {{ 'Common.Cancel' | translate }}</button>
  <button mat-raised-button id="requestButton" (click)="submitRequest()" color="accent"><i class="fas fa-plus"></i> {{ 'Common.Request' | translate }}</button>
</div>
</form>

