<div
  class="panel-default"
  ng-class="{ expanded: vm.isOpen }"
  uib-accordion-group
  is-open="vm.isOpen"
  template-url=":::PLUGIN_PATH:::/tenantPolicyDetail/accordion.html"
>
  <uib-accordion-heading>
    <div class="d-flex flex-wrap flex-grow">
      <div class="col-sm-6 col-xs-12 p-t-4 p-b-4">
        <div class="text-label-small">
          {{ 'Category' | translate }}
        </div>
        <div
          class="text-truncate"
          title="{{ vm.option.category }}"
        >
          {{ vm.option.category }}
        </div>
      </div>
      <div class="col-sm-3 col-xs-6 p-t-4 p-b-4">
        <div class="text-label-small">
          {{ 'Key' | translate }}
        </div>
        <div
          class="text-truncate"
          title="{{ vm.option.key }}"
        >
          {{ vm.option.key }}
        </div>
      </div>
      <div class="col-sm-3 col-xs-6 p-t-4 p-b-4">
        <div class="text-label-small">
          {{ 'Value' | translate }}
        </div>
        <div
          class="text-truncate"
          title="{{ vm.option.value }}"
        >
          {{ vm.option.value }}
        </div>
      </div>
    </div>

    <div class="col-md-3 col-xs-4 flex-no-shrink text-right p-t-4 p-b-4">
      <button
        class="showOnHover btn btn-dot btn-dot--danger"
        ng-class="{ open: popoverIsOpen }"
        aria-label="{{ 'Remove' | translate }}"
        type="button"
        data-cy="c8yTenantOptionsRow--remove-button"
        uib-popover-template="'confirmDelete.html'"
        popover-trigger="'focus'"
        popover-placement="left"
        popover-is-open="popoverIsOpen"
        ng-click="$event.stopPropagation();"
      >
        <i c8y-icon="minus-circle"></i>
      </button>
      <button
        class="collapse-btn"
        title="{{ 'Expand' | translate }}"
        type="button"
      >
        <i c8y-icon="chevron-down"></i>
      </button>
    </div>
  </uib-accordion-heading>

  <form
    name="tenantOptionsForm"
    novalidate
  >
    <c8y-edit-tenant-option option="vm.option"></c8y-edit-tenant-option>

    <div class="form-horizontal">
      <div
        class="form-group"
        ng-show="vm.canDisableEdit"
      >
        <div class="col-sm-12">
          <label
            class="c8y-checkbox"
            title="{{ 'Allow subtenants to edit this tenant option' | translate }}"
          >
            <input
              type="checkbox"
              ng-checked="vm.option.editable"
              ng-click="vm.option.editable=!vm.option.editable"
            />
            <span></span>
            <span translate>Allow subtenants to edit this tenant option</span>
          </label>
        </div>
      </div>
    </div>
  </form>
</div>
