Company structure provider
Company structure provider
"Department" entity has the department
ID and is implemented by the class Bitrix\Intranet\Integration\UI\EntitySelector\DepartmentProvider
.
Provider automatically adds "Departments" tab to dialog with tree-type company structure.
Company structure has several modes of selection:
- Select users only.
- Select departments only.
- Select users and departments, where departments can have the following options:
- All employees with subdepartments.
- Only department employees.
Company structure provider
const tagSelector = new TagSelector({ dialogOptions: { context: 'MY_MODULE_CONTEXT', entities: [ { id: 'department', options: { selectMode: 'departmentsOnly', // select departments only } }, ], } }); tagSelector.renderTo(document.getElementById('container'));
User selection dialog
const button = document.getElementById('responsible-button'); const dialog = new Dialog({ targetNode: button, enableSearch: true, context: 'MY_MODULE_CONTEXT', entities: [ { id: 'user', // users }, { id: 'department', // company structure: select users only }, ], }); button.addEventListener('click', function() { dialog.show(); });
Provider settings
selectMode: string
Department selection mode. The following values are available:
-
usersOnly
— select users only. -
usersAndDepartments
— select users and departments. -
departmentsOnly
— select departments only.
By default, the
usersOnly
mode - select users only.-
allowFlatDepartments: bool
This option enables "Department user only" selection for department and user selection mode (
usersAndDepartments
). Default value:false
.allowSelectRootDepartment: bool
Allows selection of company root department. By default, set as
true
for the "department only" selection mode andfalse
for the rest of modes.userOptions: array
User display settings in company structure. When dialog indicates user selection provider, the default user display settings are sourced from this provider.
userOptions
is sensible only in cases, when only company structure provider is indicated.