<form class="form-horizontal">

  <div>
    {{#if automatic}}
      <h3>{{name}}</h3>
    {{else}}
      <label for="name">{{i18n 'admin.groups.name'}}</label>
      {{text-field name="name" value=name placeholderKey="admin.groups.name_placeholder"}}
    {{/if}}
  </div>

  {{#if id}}
    <div>
      <label>{{i18n 'admin.groups.group_members'}} ({{user_count}})</label>
      <div>
        <a {{bind-attr class=":previous showingFirst:disabled"}} {{action "previous"}}>{{fa-icon "fast-backward"}}</a>
        {{currentPage}}/{{totalPages}}
        <a {{bind-attr class=":next showingLast:disabled"}} {{action "next"}}>{{fa-icon "fast-forward"}}</a>
      </div>
      <div class="ac-wrap clearfix">
        {{each member in members itemView="group-member"}}
      </div>
    </div>

    {{#unless automatic}}
      <div>
        <label for="user-selector">{{i18n 'admin.groups.add_members'}}</label>
        {{user-selector usernames=usernames placeholderKey="admin.groups.selector_placeholder" id="user-selector"}}
        <button {{action "addMembers"}} class='btn add'>{{fa-icon "plus"}} {{i18n 'admin.groups.add'}}</button>
      </div>
    {{/unless}}
  {{/if}}

  <div>
    <label>
      {{input type="checkbox" checked=visible}}
      {{i18n 'groups.visible'}}
    </label>
  </div>

  <div>
    <label for="alias">{{i18n 'groups.alias_levels.title'}}</label>
    {{combo-box name="alias" valueAttribute="value" value=alias_level content=aliasLevelOptions}}
  </div>

  {{#unless automatic}}
    <div>
      <label for="automatic_membership">{{i18n 'admin.groups.automatic_membership_email_domains'}}</label>
      {{list-setting name="automatic_membership" settingValue=emailDomains}}
      <label>
        {{input type="checkbox" checked=automatic_membership_retroactive}}
        {{i18n 'admin.groups.automatic_membership_retroactive'}}
      </label>
    </div>
  {{/unless}}

  <div class='buttons'>
    <button {{action "save"}} {{bind-attr disabled="disableSave"}} class='btn btn-primary'>{{i18n 'admin.customize.save'}}</button>
    {{#unless automatic}}
      <button {{action "destroy"}} class='btn btn-danger'>{{fa-icon "trash-o"}}{{i18n 'admin.customize.delete'}}</button>
    {{/unless}}
  </div>

</form>
