2024-08-01 20:11:32 +03:00
|
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { createColumnHelper } from '@tanstack/react-table';
|
|
|
|
|
|
2025-03-12 11:55:43 +03:00
|
|
|
|
import { DataTable } from '@/components/data-table';
|
2025-03-12 12:04:50 +03:00
|
|
|
|
import { IconPageRight } from '@/components/icons';
|
2024-07-26 00:34:08 +03:00
|
|
|
|
|
2025-02-21 21:15:05 +03:00
|
|
|
|
import { type ICstSubstituteInfo, OperationType } from '../backend/types';
|
2025-02-11 20:56:24 +03:00
|
|
|
|
import { labelOperationType } from '../labels';
|
2025-02-21 21:15:05 +03:00
|
|
|
|
import { type IOperation } from '../models/oss';
|
2025-02-10 01:32:55 +03:00
|
|
|
|
|
2025-02-20 14:45:52 +03:00
|
|
|
|
interface InfoOperationProps {
|
|
|
|
|
operation: IOperation;
|
2024-07-26 00:34:08 +03:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-18 23:39:11 +03:00
|
|
|
|
const columnHelper = createColumnHelper<ICstSubstituteInfo>();
|
2024-08-01 20:11:32 +03:00
|
|
|
|
|
2025-02-20 14:45:52 +03:00
|
|
|
|
export function InfoOperation({ operation }: InfoOperationProps) {
|
2024-12-13 21:31:09 +03:00
|
|
|
|
const columns = [
|
|
|
|
|
columnHelper.accessor('substitution_term', {
|
|
|
|
|
id: 'substitution_term',
|
|
|
|
|
size: 200
|
|
|
|
|
}),
|
|
|
|
|
columnHelper.accessor('substitution_alias', {
|
|
|
|
|
id: 'substitution_alias',
|
|
|
|
|
size: 50
|
|
|
|
|
}),
|
|
|
|
|
columnHelper.display({
|
|
|
|
|
id: 'status',
|
|
|
|
|
header: '',
|
|
|
|
|
size: 40,
|
|
|
|
|
cell: () => <IconPageRight size='1.2rem' />
|
|
|
|
|
}),
|
|
|
|
|
columnHelper.accessor('original_alias', {
|
|
|
|
|
id: 'original_alias',
|
|
|
|
|
size: 50
|
|
|
|
|
}),
|
|
|
|
|
columnHelper.accessor('original_term', {
|
|
|
|
|
id: 'original_term',
|
|
|
|
|
size: 200
|
|
|
|
|
})
|
|
|
|
|
];
|
2024-08-01 20:11:32 +03:00
|
|
|
|
|
2024-07-26 00:34:08 +03:00
|
|
|
|
return (
|
2025-02-20 14:45:52 +03:00
|
|
|
|
<>
|
|
|
|
|
<h2>{operation.alias}</h2>
|
2024-07-26 00:34:08 +03:00
|
|
|
|
<p>
|
2025-02-20 14:45:52 +03:00
|
|
|
|
<b>Тип:</b> {labelOperationType(operation.operation_type)}
|
2024-07-26 00:34:08 +03:00
|
|
|
|
</p>
|
2025-02-20 14:45:52 +03:00
|
|
|
|
{!operation.is_owned ? (
|
2024-08-15 23:23:45 +03:00
|
|
|
|
<p>
|
|
|
|
|
<b>КС не принадлежит ОСС</b>
|
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
2025-02-20 14:45:52 +03:00
|
|
|
|
{operation.is_consolidation ? (
|
2024-08-17 12:17:13 +03:00
|
|
|
|
<p>
|
|
|
|
|
<b>Ромбовидный синтез</b>
|
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
2025-02-20 14:45:52 +03:00
|
|
|
|
{operation.title ? (
|
2024-07-26 00:34:08 +03:00
|
|
|
|
<p>
|
|
|
|
|
<b>Название: </b>
|
2025-02-20 14:45:52 +03:00
|
|
|
|
{operation.title}
|
2024-07-26 00:34:08 +03:00
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
2025-02-20 14:45:52 +03:00
|
|
|
|
{operation.comment ? (
|
2024-07-26 00:34:08 +03:00
|
|
|
|
<p>
|
|
|
|
|
<b>Комментарий: </b>
|
2025-02-20 14:45:52 +03:00
|
|
|
|
{operation.comment}
|
2024-07-26 00:34:08 +03:00
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
2025-02-20 14:45:52 +03:00
|
|
|
|
{operation.substitutions.length > 0 ? (
|
2024-12-13 21:31:09 +03:00
|
|
|
|
<DataTable
|
|
|
|
|
dense
|
|
|
|
|
noHeader
|
|
|
|
|
noFooter
|
2025-03-13 14:42:48 +03:00
|
|
|
|
className='text-sm border-x select-none mb-2'
|
2025-02-20 14:45:52 +03:00
|
|
|
|
data={operation.substitutions}
|
2024-12-13 21:31:09 +03:00
|
|
|
|
columns={columns}
|
|
|
|
|
/>
|
2025-02-20 14:45:52 +03:00
|
|
|
|
) : operation.operation_type !== OperationType.INPUT ? (
|
2024-08-14 21:50:28 +03:00
|
|
|
|
<p>
|
|
|
|
|
<b>Отождествления:</b> Отсутствуют
|
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
2025-02-20 14:45:52 +03:00
|
|
|
|
</>
|
2024-07-26 00:34:08 +03:00
|
|
|
|
);
|
|
|
|
|
}
|