diff --git a/backend/static/css/components/recipientPicker.css b/backend/static/css/components/recipientPicker.css index 23a94928..a3a21889 100644 --- a/backend/static/css/components/recipientPicker.css +++ b/backend/static/css/components/recipientPicker.css @@ -182,6 +182,28 @@ font-weight: 600; font-size: 0.75rem; flex-shrink: 0; + overflow: hidden; +} + +/* Изображение аватара */ +.user-avatar-img { + width: 100%; + height: 100%; + object-fit: cover; + border-radius: 50%; +} + +/* Плейсхолдер с инициалами */ +.user-avatar-placeholder { + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + background: var(--bs-primary); + color: white; + font-weight: 600; + font-size: 0.75rem; } /* Информация о пользователе */ diff --git a/backend/static/js/components/recipientPicker.js b/backend/static/js/components/recipientPicker.js index 27299484..86cc0100 100644 --- a/backend/static/js/components/recipientPicker.js +++ b/backend/static/js/components/recipientPicker.js @@ -52,16 +52,11 @@ export class RecipientPicker { async loadData() { this.state.loading = true; try { - const [usersRes, deptsRes] = await Promise.all([ - fetch(this.options.apiUsersUrl), - fetch(this.options.apiDepartmentsUrl) - ]); - - if (usersRes.ok) { - const usersData = await usersRes.json(); - this.users = usersData.results || usersData; - } - + // Загружаем пользователей с пагинацией (все страницы) + this.users = await this.loadAllUsers(); + + // Загружаем отделы + const deptsRes = await fetch(this.options.apiDepartmentsUrl); if (deptsRes.ok) { const deptsData = await deptsRes.json(); this.departments = deptsData.results || deptsData; @@ -73,6 +68,37 @@ export class RecipientPicker { } } + /** + * Загрузка всех пользователей с автоматической обработкой пагинации + */ + async loadAllUsers() { + const allUsers = []; + let nextUrl = this.options.apiUsersUrl + '?page_size=100&active=true'; + + while (nextUrl) { + try { + const response = await fetch(nextUrl); + if (!response.ok) break; + + const data = await response.json(); + const users = data.results || data; + + if (Array.isArray(users)) { + allUsers.push(...users); + } + + // Проверяем наличие следующей страницы + nextUrl = data.next || null; + } catch (error) { + console.error('RecipientPicker: Error loading users page:', error); + break; + } + } + + console.log(`RecipientPicker: Loaded ${allUsers.length} users`); + return allUsers; + } + render() { this.container.innerHTML = `