<form #form (ngSubmit)="submit()" [appApiAction]="formPromise">
  <header>
    <div class="left">
      <button type="button" (click)="back()">
        <span class="header-icon"><i class="bwi bwi-angle-left" aria-hidden="true"></i></span>
        <span>{{ "back" | i18n }}</span>
      </button>
    </div>
    <h1 class="center">
      <span class="title">{{ "collections" | i18n }}</span>
    </h1>
    <div class="right">
      <button type="submit" [disabled]="form.loading">
        <span [hidden]="form.loading">{{ "save" | i18n }}</span>
        <i class="bwi bwi-spinner bwi-lg bwi-spin" [hidden]="!form.loading" aria-hidden="true"></i>
      </button>
    </div>
  </header>
  <main tabindex="-1">
    <div class="box">
      <div class="box-content" *ngIf="!collections || !collections.length">
        <div class="box-content-row padded no-hover">
          {{ "noCollectionsInList" | i18n }}
        </div>
      </div>
      <div class="box-content" *ngIf="collections && collections.length">
        <div
          class="box-content-row box-content-row-checkbox"
          *ngFor="let c of collections; let i = index"
          appBoxRow
        >
          <label for="collection_{{ i }}">{{ c.name }}</label>
          <input
            id="collection_{{ i }}"
            type="checkbox"
            [(ngModel)]="$any(c).checked"
            name="Collection[{{ i }}].Checked"
          />
        </div>
      </div>
    </div>
  </main>
</form>
