Сделать фильтр по сотруднику стандартным SearchableSelect
Как и везде в админке (форма выдачи доступа, ManageRequestsApproverModal и т.п.) — поиск по ФИО/email вместо свободного текста, точное совпадение вместо подстроки. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,8 +26,7 @@ import {
|
||||
PageHeader,
|
||||
PrimaryCell,
|
||||
SearchableSelect,
|
||||
Select,
|
||||
TextInput
|
||||
Select
|
||||
} from '../ui';
|
||||
|
||||
export interface IRequestTypeAccessScreenProps {
|
||||
@@ -84,7 +83,7 @@ export const RequestTypeAccessScreen: React.FC<IRequestTypeAccessScreenProps> =
|
||||
|
||||
const filteredItems = access.items.filter(item => {
|
||||
if (filterRequestTypeId && String(item.requestTypeId) !== filterRequestTypeId) return false;
|
||||
if (filterEmail && item.email.toLowerCase().indexOf(filterEmail.trim().toLowerCase()) === -1) return false;
|
||||
if (filterEmail && item.email.toLowerCase() !== filterEmail.toLowerCase()) return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -143,10 +142,16 @@ export const RequestTypeAccessScreen: React.FC<IRequestTypeAccessScreenProps> =
|
||||
</div>
|
||||
<div className={styles.filterField}>
|
||||
<Field label={texts.requestTypeAccess.filterEmailLabel}>
|
||||
<TextInput
|
||||
<SearchableSelect
|
||||
options={employees.items.map(toEmployeeOption)}
|
||||
value={filterEmail}
|
||||
onChange={e => setFilterEmail(e.target.value)}
|
||||
loading={employees.isLoading}
|
||||
allowClear
|
||||
clearLabel={texts.requestTypeAccess.filterEmailAll}
|
||||
placeholder={texts.requestTypeAccess.filterEmailPlaceholder}
|
||||
searchPlaceholder={texts.select.employeeSearchPlaceholder}
|
||||
emptyMessage={texts.select.employeesEmpty}
|
||||
onChange={setFilterEmail}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
|
||||
@@ -189,7 +189,8 @@ export const texts = {
|
||||
filterRequestTypeLabel: 'Фильтр по типу заявки',
|
||||
filterRequestTypeAll: 'Все типы заявок',
|
||||
filterEmailLabel: 'Фильтр по сотруднику',
|
||||
filterEmailPlaceholder: 'Email сотрудника',
|
||||
filterEmailAll: 'Все сотрудники',
|
||||
filterEmailPlaceholder: 'Найдите по ФИО или email',
|
||||
columnRequestType: 'Тип заявки',
|
||||
columnEmail: 'Сотрудник',
|
||||
columnSharePointLists: 'Списки SharePoint (выдать доступ вручную)',
|
||||
|
||||
Reference in New Issue
Block a user