<div class="alert alert-warning" ng-show="!smartGroupColumns.length">
  {{:: ts('Unable to create smart group because this search does not include any contacts.') }}
</div>

<div class="form-inline">
  <label for="crm-search-admin-group-title">{{:: ts('Group Title') }} <span class="crm-marker">*</span></label>
  <input id="crm-search-admin-group-title" class="form-control" placeholder="{{:: ts('Untitled') }}" ng-model="$ctrl.savedSearch.groups[0].title" ng-disabled="!smartGroupColumns.length" ng-required="smartGroupColumns.length">
  <label for="api-save-search-select-column">{{:: ts('Contact Column') }}</label>
  <input id="api-save-search-select-column" ng-model="$ctrl.savedSearch.api_params.select[0]" class="form-control huge" crm-ui-select="{data: smartGroupColumns}"/>
</div>
<fieldset ng-show="smartGroupColumns.length">
  <label>{{:: getField('description', 'Group').label }}</label>
  <textarea class="form-control" ng-model="$ctrl.savedSearch.groups[0].description"></textarea>
  <div ng-if="getEntity('Group').optionsLoaded">
    <div class="form-inline">
      <label>{{:: getField('group_type', 'Group').label }}</label>
      <div class="checkbox" ng-repeat="option in getField('group_type', 'Group').options">&nbsp;
        <label>
          <input type="checkbox" checklist-model="$ctrl.savedSearch.groups[0].group_type" checklist-value="option.id">
          {{:: option.label }}
        </label>&nbsp;
      </div>
    </div>
    <div class="form-inline">
      <label>{{:: getField('visibility', 'Group').label }}</label>
      <crm-search-input-val field=":: getField('visibility', 'Group')" ng-model="$ctrl.savedSearch.groups[0].visibility"></crm-search-input-val>
    </div>
    <hr>
    <div class="form-inline" ng-repeat="field in getEntity('Group').fields | filter:{name: '.', entity: 'Group'}">
      <label>{{:: field.label }}</label>
      <crm-search-input-val field="field" ng-model="$ctrl.savedSearch.groups[0][field.name]"></crm-search-input-val>
    </div>
  </div>
  <div ng-if="!getEntity('Group').optionsLoaded">
    <i class="crm-i fa-spinner fa-spin"></i>
  </div>
</fieldset>
