<div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="folderAddEditTitle">
  <div class="modal-dialog modal-sm" role="document">
    <form
      #form
      class="modal-content"
      (ngSubmit)="submit()"
      [appApiAction]="formPromise"
      [formGroup]="formGroup"
    >
      <div class="modal-body">
        <div class="box">
          <h1 class="box-header" id="folderAddEditTitle">
            {{ title }}
          </h1>
          <div class="box-content">
            <div class="box-content-row" appBoxRow>
              <label for="name">{{ "name" | i18n }}</label>
              <input id="name" type="text" formControlName="name" [appAutofocus]="!editMode" />
            </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button
          type="submit"
          class="primary"
          appA11yTitle="{{ 'save' | i18n }}"
          [disabled]="form.loading"
        >
          <i
            class="bwi bwi-save-changes bwi-lg bwi-fw"
            [hidden]="form.loading"
            aria-hidden="true"
          ></i>
          <i
            class="bwi bwi-spinner bwi-spin bwi-lg bwi-fw"
            [hidden]="!form.loading"
            aria-hidden="true"
          ></i>
        </button>
        <button type="button" data-dismiss="modal">{{ "cancel" | i18n }}</button>
        <div class="right">
          <button
            #deleteBtn
            type="button"
            (click)="delete()"
            class="danger"
            appA11yTitle="{{ 'delete' | i18n }}"
            *ngIf="editMode"
            [disabled]="$any(deleteBtn).loading"
            [appApiAction]="deletePromise"
          >
            <i
              class="bwi bwi-trash bwi-lg bwi-fw"
              [hidden]="$any(deleteBtn).loading"
              aria-hidden="true"
            ></i>
            <i
              class="bwi bwi-spinner bwi-spin bwi-lg bwi-fw"
              [hidden]="!$any(deleteBtn).loading"
              aria-hidden="true"
            ></i>
          </button>
        </div>
      </div>
    </form>
  </div>
</div>
