3 |
3 |
|
4 |
4 |
import { useUnauthRedirect } from '../../../hooks';
|
5 |
5 |
import { useRouter } from 'next/router';
|
6 |
|
import { Button, Input, Row, Space, Table, Tag, Typography } from 'antd';
|
|
6 |
import { Button, Dropdown, Input, Menu, Row, Space, Table, Tag, Typography } from 'antd';
|
7 |
7 |
import { faArrowsRotate, faFileLines, faUser } from '@fortawesome/free-solid-svg-icons';
|
8 |
8 |
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
9 |
9 |
import { LoggedUserContext } from '../../../contexts/LoggedUserContext';
|
... | ... | |
37 |
37 |
|
38 |
38 |
import { faCircleCheck, faClock } from '@fortawesome/free-regular-svg-icons';
|
39 |
39 |
import styles from '/styles/Icon.module.scss';
|
|
40 |
import { FileSearchOutlined, UserDeleteOutlined } from '@ant-design/icons';
|
40 |
41 |
|
41 |
42 |
function AdminDocumentPage() {
|
42 |
43 |
const redirecting = useUnauthRedirect('/login');
|
... | ... | |
274 |
275 |
setVisiblePreview(false);
|
275 |
276 |
};
|
276 |
277 |
|
|
278 |
const removeUserDocument = (user: DocumentUserInfo, record: DocumentListInfo) => {
|
|
279 |
ShowConfirm(
|
|
280 |
async () => {
|
|
281 |
if (!record.id || !user?.id) {
|
|
282 |
return;
|
|
283 |
}
|
|
284 |
await removeUserFromDocument(record.id, user.id);
|
|
285 |
},
|
|
286 |
'odebrat uživatele ' +
|
|
287 |
user.name +
|
|
288 |
' ' +
|
|
289 |
user.surname +
|
|
290 |
' (' +
|
|
291 |
user.username +
|
|
292 |
') z tohoto dokumentu',
|
|
293 |
'Dosavadní postup tohoto anotátora na daném dokumentu bude nenávratně smazán'
|
|
294 |
);
|
|
295 |
};
|
|
296 |
|
|
297 |
const menu = (user: DocumentUserInfo, record: DocumentListInfo) => {
|
|
298 |
return (
|
|
299 |
<Menu>
|
|
300 |
<Menu.ItemGroup title={getNameTruncated(user)}>
|
|
301 |
<Menu.Item
|
|
302 |
icon={<FileSearchOutlined />}
|
|
303 |
onClick={() =>
|
|
304 |
router.push({
|
|
305 |
pathname: '/annotation/[annotationId]',
|
|
306 |
query: { annotationId: user.annotationId, final: false },
|
|
307 |
})
|
|
308 |
}
|
|
309 |
>
|
|
310 |
Zobrazit anotaci
|
|
311 |
</Menu.Item>
|
|
312 |
<Menu.Item
|
|
313 |
icon={<UserDeleteOutlined />}
|
|
314 |
onClick={() => removeUserDocument(user, record)}
|
|
315 |
>
|
|
316 |
Odebrat
|
|
317 |
</Menu.Item>
|
|
318 |
</Menu.ItemGroup>
|
|
319 |
</Menu>
|
|
320 |
);
|
|
321 |
};
|
|
322 |
|
277 |
323 |
function getUserTag(user: DocumentUserInfo, record: DocumentListInfo) {
|
278 |
324 |
return (
|
279 |
|
<span
|
280 |
|
className={'userTagWrapper'}
|
281 |
|
title={getUserInfoAlt(user) + '\nStav: ' + user.state}
|
282 |
|
onClick={() => {
|
283 |
|
ShowConfirm(
|
284 |
|
async () => {
|
285 |
|
if (!record.id || !user?.id) {
|
286 |
|
return;
|
287 |
|
}
|
288 |
|
await removeUserFromDocument(record.id, user.id);
|
289 |
|
},
|
290 |
|
'odebrat uživatele ' +
|
291 |
|
user.name +
|
292 |
|
' ' +
|
293 |
|
user.surname +
|
294 |
|
' (' +
|
295 |
|
user.username +
|
296 |
|
') z tohoto dokumentu',
|
297 |
|
'Dosavadní postup tohoto anotátora na daném dokumentu bude nenávratně smazán'
|
298 |
|
);
|
299 |
|
}}
|
300 |
|
>
|
301 |
|
<span
|
302 |
|
key={user.username + '.' + record.id}
|
|
325 |
<Dropdown overlay={menu(user, record)}>
|
|
326 |
<Space
|
|
327 |
size={2}
|
303 |
328 |
style={{
|
|
329 |
paddingRight: 10,
|
304 |
330 |
color: getAnnotationStateColor(user.state),
|
305 |
331 |
}}
|
306 |
|
className={'me-3 userTag'}
|
307 |
332 |
>
|
308 |
333 |
<FontAwesomeIcon
|
309 |
334 |
icon={faUser}
|
... | ... | |
317 |
342 |
) : (
|
318 |
343 |
getNameTruncated(user)
|
319 |
344 |
)}
|
320 |
|
</span>
|
321 |
|
<span className={'remove'}>Odebrat</span>
|
322 |
|
</span>
|
|
345 |
</Space>
|
|
346 |
</Dropdown>
|
323 |
347 |
);
|
324 |
348 |
}
|
325 |
349 |
|
User annotation preview added