From e88593a39cf925dfaf71a9c581eee5d6ff6d5333 Mon Sep 17 00:00:00 2001 From: "gorbenko.pavel" Date: Tue, 13 Oct 2026 12:10:40 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=81=D1=82=D1=83=D0=BF=20=D0=BA?= =?UTF-8?q?=20=D0=B7=D0=B0=D1=8F=D0=B2=D0=BA=D0=B0=D0=BC:=20=D1=81=D0=BE?= =?UTF-8?q?=D1=82=D1=80=D1=83=D0=B4=D0=BD=D0=B8=D0=BA=D0=B8=20=D1=81=20?= =?UTF-8?q?=D1=83=D0=B6=D0=B5=20=D0=B2=D1=8B=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D0=BC=20=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=BE=D0=BC=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BA=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0=D1=8E=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20=D0=B2=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=D0=B5=20?= =?UTF-8?q?=D1=81=20=D0=BF=D0=BE=D0=BC=D0=B5=D1=82=D0=BA=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=B5=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- .../screens/RequestTypeAccessScreen.tsx | 23 ++++++++++++++----- .../ui/SearchableSelect.module.scss | 1 + .../components/ui/SearchableSelect.tsx | 3 +++ frontend/src/webparts/approvalAdmin/texts.ts | 2 ++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/frontend/src/webparts/approvalAdmin/components/screens/RequestTypeAccessScreen.tsx b/frontend/src/webparts/approvalAdmin/components/screens/RequestTypeAccessScreen.tsx index 58a61a4..8faecc3 100644 --- a/frontend/src/webparts/approvalAdmin/components/screens/RequestTypeAccessScreen.tsx +++ b/frontend/src/webparts/approvalAdmin/components/screens/RequestTypeAccessScreen.tsx @@ -136,12 +136,23 @@ export const RequestTypeAccessScreen: React.FC = }); }; - // Уже выбранным и тем, у кого доступ к этому типу есть, в списке делать нечего. - const unavailableEmails = new Set( - [...emails, ...access.items.filter(a => String(a.requestTypeId) === requestTypeId).map(a => a.email)] - .map(e => e.toLowerCase()) + // Тех, у кого доступ к этому типу уже есть (и кого уже добавили в список), показываем + // в поиске с пометкой, но выбрать нельзя — так видно, что человек не потерялся. + const grantedEmails = new Set( + access.items.filter(a => String(a.requestTypeId) === requestTypeId).map(a => a.email.toLowerCase()) ); - const addableEmployees = employees.items.filter(e => !unavailableEmails.has(e.email.toLowerCase())); + const chosenEmails = new Set(emails.map(e => e.toLowerCase())); + const employeeOptions = employees.items.map(employee => { + const option = toEmployeeOption(employee); + const key = employee.email.toLowerCase(); + if (grantedEmails.has(key)) { + return { ...option, disabled: true, sublabel: `${option.sublabel ?? ''} · ${texts.requestTypeAccess.alreadyGranted}` }; + } + if (chosenEmails.has(key)) { + return { ...option, disabled: true, sublabel: `${option.sublabel ?? ''} · ${texts.requestTypeAccess.alreadyChosen}` }; + } + return option; + }); const employeeLabel = (email: string): string => { const employee = employees.items.find(e => e.email.toLowerCase() === email.toLowerCase()); return employee ? `${employee.fio} · ${employee.email}` : email; @@ -237,7 +248,7 @@ export const RequestTypeAccessScreen: React.FC =
= ({ type="button" key={opt.value} className={`${styles.item} ${opt.value === value ? styles.selected : ''}`} + disabled={opt.disabled} onClick={() => pick(opt.value)} > {opt.label} diff --git a/frontend/src/webparts/approvalAdmin/texts.ts b/frontend/src/webparts/approvalAdmin/texts.ts index 18c2923..ba2f123 100644 --- a/frontend/src/webparts/approvalAdmin/texts.ts +++ b/frontend/src/webparts/approvalAdmin/texts.ts @@ -201,6 +201,8 @@ export const texts = { emailLabel: 'Сотрудники', emailPlaceholder: 'Добавьте сотрудника — найдите по ФИО или email', removeEmail: 'Убрать из списка', + alreadyGranted: 'доступ уже есть', + alreadyChosen: 'уже в списке', noEmailsSelected: 'Пока никого не выбрано.', createFailed: (failures: string[]): string => `Не удалось выдать доступ (остались в списке): ${failures.join('; ')}`,