<div id="SubstatusEditBox">
  <div class="row">
    <span class="col-md-8">
      <span data-translate>Substatuses</span>
      <button class="btn btn-sm btn-primary" data-ng-click="toggleAddSubstatus()">
        <i class="fa-solid fa-plus"></i>
        <span data-translate>Add</span>
      </button>
    </span>
  </div>
  <div id="SubstatusAddBox" data-ng-controller="AdminSubmissionSubStatusAddCtrl" class="row" data-ng-if="showAddSubstatus">
    <div class="col-md-6">
      <div data-ng-form="newSubstatus">
        <div class="row">
          <div class="col-md-12">
            <div class="form-group">
              <label data-translate>Label</label>
              <input name="label" class="form-control" data-ng-model="new_substatus.label" type="text" required>
              <div class="text-danger" data-ng-show="newSubstatus.label.$error.required">
                <span data-translate>This field is mandatory</span>
              </div>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col-md-12">
            <div class="form-group clearfix">
              <button class="float-left btn btn-primary" data-ng-disabled="newSubstatus.$invalid"
                      data-ng-click="addSubmissionSubStatus(); toggleAddSubstatus()">
                <i class="fa-solid fa-plus"></i>
                <span data-translate>Add</span>
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="row">
    <div data-ng-repeat="substatus in submissions_status.substatuses" class="col-md-12">
      <div data-ng-controller="AdminSubmissionSubStatusEditorCtrl">
        <div class="configItem">
          <div class="editorHeader row" data-ng-click="toggleSubstatusEditing(); $event.stopPropagation();">
            <span class="col-md-7">
              <span class="substatusLabel">{{substatus.label}}</span>
            </span>
            <span class="col-md-5 clearfix">
              <span class="float-right">
                <button data-ng-if="!$first" class="btn btn-sm btn-primary" data-ng-click="moveSsUp($event, $index)" data-uib-tooltip="{{'Move up' | translate}}">
                  <i class="fa-solid fa-chevron-up"></i>
                </button>
                <button data-ng-if="!$last" class="btn btn-sm btn-primary" data-ng-click="moveSsDown($event, $index)" data-uib-tooltip="{{'Move down' | translate}}">
                  <i class="fa-solid fa-chevron-down"></i>
                </button>
                <button class="btn btn-sm btn-outline-secondary" data-ng-show="!substatus_editing"
                        data-ng-click="toggleSubstatusEditing(); $event.stopPropagation();">
                  <span data-translate>Edit</span>
                </button>
                <button class="btn btn-sm btn-primary" data-ng-show="substatus_editing"
                        data-ng-click="save_submissions_substatuses(substatus);">
                  <span data-translate>Save</span>
                </button>
                <button class="btn btn-sm btn-outline-secondary" data-ng-show="substatus_editing"
                        data-ng-click="toggleSubstatusEditing(); $event.stopPropagation();">
                  <span data-translate>Cancel</span>
                </button>
                <button class="btn btn-sm btn-danger"
                        data-ng-click="deleteSubSubmissionStatus(substatus); $event.stopPropagation();">
                  <span data-translate>Delete</span>
                </button>
              </span>
            </span>
          </div>
          <div data-ng-form="editStep" data-ng-if="substatus_editing">
            <hr/>
            <div class="row">
              <div class="form-group">
                <div class="col-md-6">
                  <label data-translate>Label</label>
                  <input class="form-control" data-ng-model="substatus.label" type="text" required/>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
