<page-header title="'Tags'" breadcrumbs="['Tag management']" reload="true"> </page-header>

<div class="row">
  <div class="col-sm-12">
    <rd-widget>
      <rd-widget-header icon="plus" feather-icon="true" title-text="Add a new tag"> </rd-widget-header>
      <rd-widget-body>
        <form class="form-horizontal" name="tagCreationForm" ng-submit="createTag()">
          <!-- name-input -->
          <div class="form-group">
            <label for="name" class="col-sm-2 control-label text-left required"> Name </label>
            <div class="col-sm-10">
              <input
                type="text"
                class="form-control"
                name="name"
                ng-model="formValues.Name"
                ng-change="checkNameValidity(tagCreationForm)"
                placeholder="org/acme"
                required
                auto-focus
              />
            </div>
          </div>
          <div class="form-group" ng-show="tagCreationForm.name.$invalid">
            <div class="col-sm-12 small text-warning">
              <div ng-messages="tagCreationForm.name.$error">
                <p ng-message="required" class="vertical-center">
                  <pr-icon icon="'alert-triangle'" mode="'warning'" feather="true"></pr-icon>
                  This field is required.
                </p>
                <p ng-message="validName" class="vertical-center">
                  <pr-icon icon="'alert-triangle'" mode="'warning'" feather="true"></pr-icon>
                  This tag already exists.
                </p>
              </div>
            </div>
          </div>
          <!-- !name-input -->
          <div class="form-group">
            <div class="col-sm-12">
              <button
                type="button"
                class="btn btn-primary btn-sm"
                ng-disabled="state.actionInProgress || !tagCreationForm.$valid"
                ng-click="createTag()"
                button-spinner="state.actionInProgress"
              >
                <span ng-hide="state.actionInProgress" class="vertical-center">
                  <pr-icon icon="'plus'" feather="true"></pr-icon>
                  Create tag
                </span>
                <span ng-show="state.actionInProgress">Creating tag...</span>
              </button>
            </div>
          </div>
        </form>
      </rd-widget-body>
    </rd-widget>
  </div>
</div>

<div class="row">
  <div class="col-sm-12">
    <tags-datatable title-text="Tags" title-icon="svg-tag2" dataset="tags" table-key="tags" order-by="Name" remove-action="removeAction"></tags-datatable>
  </div>
</div>
