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