<div ng-controller="Admin.OrganizationalHierarchyController">
    <div class="pull-right well">
        <select ng-model="directoryName" class="custom-select"
                ng-options="directory for directory in directories" ng-change="selectDirectory(directoryName)"></select>
        </select>
        <div class="btn-group" ng-show="ldapEditingEnabledPerDirectoryServer[directoryName]">
            <button class="btn btn-xs btn-link" ng-click="createGroup()">
                <i class="fa fa-plus"></i>
                <span>{{ 'admin.security.organizationalHierarchy.createGroupDialog.adHocGroup.title' | translate }}</span>
            </button>
            <button class="btn btn-xs btn-link" ng-click="createLdapGroup(directoryName)">
                <i class="fa fa-external-link-square"></i>
                {{ 'admin.security.organizationalHierarchy.createGroupDialog.ldapGroup.title' | translate }}
            </button>
        </div>
    </div>
    <panel-view header="{{'admin.security.organizationalHierarchy.title' | translate}}" collapsible="false">
        <div class="row">
            <div class="col-md-3">
                <form name="groupsSearch" ng-submit="onSearch(searchParams.nameFq)">
                    <div class="input-group">
                        <input type="text" class="input-xs form-control" ng-model="searchParams.nameFq"
                               placeholder="{{'admin.security.organizationalHierarchy.searchFilter.placeholder' | translate }}"
                               minlength="2" ng-change="onFilterChange(searchParams.nameFq)">
                        <div class="input-group-btn">
                            <button class="btn btn-primary btn-xs" type="submit">
                                <i class="fa fa-search"></i>
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <tree-table-view tree-data="data" on-lazy-load="onLazyLoad" config="cfg" on-add-members="onAddMembers" on-load-more="onLoadMore"
                         total-groups="totalGroups" on-delete-group="onDeleteGroup" on-delete-members="onDeleteMembers"
                         on-add-sub-group="onAddSubGroup" on-add-existing-sub-group="onAddExistingSubGroup"
                         on-set-supervisor="onSetSupervisor"
                         show-actions="true" show-supervisor="true" show-type="true"
                         enable-editing-ldap-users="ldapEditingEnabledPerDirectoryServer"
                         on-add-ldap-member="onAddLdapMember" on-edit-ldap-member="onEditLdapMember"
                         on-add-existing-members-to-ldap-group="addExistingMembersToLdapGroup" on-add-ldap-subgroup="addLdapSubgroup"
                         on-delete-ldap-member="onDeleteLdapMember" on-delete-ldap-group="onDeleteLdapGroup"/>
    </panel-view>
</div>