<div ng-include="'~/crmSearchAdmin/crmSearchAdminDisplayHeader.html'"></div>
<details>
  <summary>{{:: ts('Settings') }}</summary>
  <fieldset ng-include="'~/crmSearchAdmin/crmSearchAdminDisplaySort.html'"></fieldset>
  <fieldset>
    <div class="form-inline">
      <label for="crm-search-admin-display-colno">{{:: ts('Layout') }}</label>
      <select id="crm-search-admin-display-colno" class="form-control" ng-model="$ctrl.display.settings.colno">
        <option value="2">{{:: ts('2 x 2') }}</option>
        <option value="3">{{:: ts('3 x 3') }}</option>
        <option value="4">{{:: ts('4 x 4') }}</option>
        <option value="5">{{:: ts('5 x 5') }}</option>
      </select>
      <div class="form-group" ng-include="'~/crmSearchAdmin/displays/common/searchButtonConfig.html'"></div>
    </div>
    <search-admin-pager-config display="$ctrl.display"></search-admin-pager-config>
    <search-admin-placeholder-config display="$ctrl.display"></search-admin-placeholder-config>
    <search-admin-toolbar-config display="$ctrl.display" api-entity="$ctrl.apiEntity" api-params="$ctrl.apiParams"></search-admin-toolbar-config>
  </fieldset>
</details>
<fieldset class="crm-search-admin-edit-columns-wrapper">
  <legend>
    {{:: ts('Fields') }}
  </legend>
  <div ng-include="'~/crmSearchAdmin/displays/common/addColMenu.html'"></div>
  <fieldset class="crm-search-admin-edit-columns" ng-model="$ctrl.display.settings.columns" ui-sortable="$ctrl.parent.sortableOptions">
    <fieldset ng-repeat="col in $ctrl.display.settings.columns" class="crm-draggable">
      <i class="crm-i fa-arrows crm-search-move-icon"></i>
      <button type="button" class="btn btn-xs pull-right" ng-click="$ctrl.parent.removeCol($index)" title="{{:: ts('Remove') }}">
        <i class="crm-i fa-ban"></i>
      </button>
      <details>
        <summary> {{ $ctrl.parent.getColLabel(col) }}</summary>
        <div class="form-inline" title="{{:: ts('Should this item display on its own line or inline with other items?') }}">
          <label><input type="checkbox" ng-model="col.break"> {{:: ts('New Line') }}</label>
        </div>
        <div class="form-inline crm-search-admin-flex-row">
          <label>
            <input type="checkbox" ng-checked="col.label" ng-click="col.label = col.label ? null : $ctrl.parent.getColLabel(col)" >
            {{:: ts('Label') }}
          </label>
          <input ng-if="col.label" class="form-control crm-flex-1" type="text" ng-model="col.label" ng-model-options="{updateOn: 'blur'}">
          <crm-search-admin-token-select ng-if="col.label" model="col" field="label" suffix=":label"></crm-search-admin-token-select>
        </div>
        <div class="form-inline" ng-if="col.label">
          <label style="visibility: hidden"><input type="checkbox" disabled></label><!--To indent by 1 checkbox-width-->
          <div class="checkbox">
            <label><input type="checkbox" ng-model="col.forceLabel"> {{:: ts('Show label even when field is blank') }}</label>
          </div>
        </div>
        <div ng-include="'~/crmSearchAdmin/displays/colType/' + col.type + '.html'"></div>
      </details>
    </fieldset>
  </fieldset>
</fieldset>
