<nav aria-label="breadcrumb">
  <ol class="breadcrumb">
    <li class="breadcrumb-item">
      <a routerLink="/my-library/video-playlists" i18n>My Playlists</a>
    </li>

    <ng-container *ngIf="isCreation()">
      <li class="breadcrumb-item active" i18n>Create</li>
    </ng-container>
    <ng-container *ngIf="!isCreation()">
      <li class="breadcrumb-item active" i18n>Edit</li>
      <li class="breadcrumb-item active" aria-current="page">
        <a *ngIf="videoPlaylistToUpdate" [routerLink]="[ '/my-library/video-playlists/update', videoPlaylistToUpdate?.uuid ]">{{ videoPlaylistToUpdate?.displayName }}</a>
      </li>
    </ng-container>
  </ol>
</nav>

<div *ngIf="error" class="alert alert-danger">{{ error }}</div>

<form role="form" (ngSubmit)="formValidated()" [formGroup]="form">

  <div class="row"> <!-- playlist grid -->
    <div class="col-12 col-lg-4 col-xl-3">
      <div *ngIf="isCreation()" class="video-playlist-title" i18n>NEW PLAYLIST</div>
      <div *ngIf="!isCreation() && videoPlaylistToUpdate" class="video-playlist-title" i18n>PLAYLIST</div>
    </div>

    <div class="col-12 col-lg-8 col-xl-9">

      <div class="col-md-12 col-xl-6">
        <div class="form-group">
          <label i18n for="displayName">Display name</label>
          <input
            type="text" id="displayName" class="form-control"
            formControlName="displayName" [ngClass]="{ 'input-error': formErrors['displayName'] }"
          >
          <div *ngIf="formErrors['displayName']" class="form-error">
            {{ formErrors['displayName'] }}
          </div>
        </div>

        <div class="form-group">
          <label i18n for="description">Description</label><my-help helpType="markdownText"></my-help>
          <my-markdown-textarea id="description" formControlName="description" [formError]="formErrors['description']"></my-markdown-textarea>
        </div>
      </div>

      <div class="col-md-12 col-xl-6">
        <div class="form-group">
          <label i18n for="privacy">Privacy</label>
          <div class="peertube-select-container">
            <select id="privacy" formControlName="privacy" class="form-control">
              <option *ngFor="let privacy of videoPlaylistPrivacies" [value]="privacy.id">{{ privacy.label }}</option>
            </select>
          </div>

          <div *ngIf="formErrors.privacy" class="form-error">
            {{ formErrors.privacy }}
          </div>
        </div>

        <div class="form-group">
          <label i18n>Channel</label>

          <my-select-channel
            labelForId="videoChannelIdl" [items]="userVideoChannels" formControlName="videoChannelId"
          ></my-select-channel>

          <div *ngIf="formErrors['videoChannelId']" class="form-error">
            {{ formErrors['videoChannelId'] }}
          </div>
        </div>

        <div class="form-group">
          <label i18n>Playlist thumbnail</label>

          <my-preview-upload
            i18n-inputLabel inputLabel="Edit" inputName="thumbnailfile" formControlName="thumbnailfile"
            previewWidth="223px" previewHeight="122px"
          ></my-preview-upload>
        </div>
      </div>

      <div class="row"> <!-- submit placement block -->
        <div class="col-md-7 col-xl-5"></div>
        <div class="col-md-5 col-xl-5 d-inline-flex">
          <input type="submit" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid">
        </div>
      </div>
    </div>
  </div>

</form>
