33 lines
1.8 KiB
TypeScript
33 lines
1.8 KiB
TypeScript
import type { TableConfig } from '../../components/GenericTable';
|
|
import { TableTag } from '../../components/TableTag/TableTag';
|
|
import type { ConsRussianStatus, QuarterEnum } from '../../types/consolidations/common_types';
|
|
import type { ConsRow } from '../../types/consolidations/consolidations';
|
|
import { formatMoscowDate } from '../../utils/dates';
|
|
import { quarterShortLabel } from '../../utils/labels';
|
|
import { statusColorMapping } from './consts';
|
|
|
|
const ruDate = (v: unknown) => (typeof v === 'string' ? (formatMoscowDate(v) ?? '—') : '—');
|
|
|
|
export const consConfigBase: TableConfig<ConsRow> = {
|
|
rowKey: 'id',
|
|
// no searchableKeys — table has no cross-column search
|
|
columns: [
|
|
{ key: 'year', title: 'Год', features: { sort: true, multiselect: true } },
|
|
{ key: 'quarter', title: 'Квартал', features: { multiselect: true }, render: (v) => quarterShortLabel(v as QuarterEnum) },
|
|
|
|
{ key: 'version_no', title: 'Версия', features: { sort: true } },
|
|
{
|
|
key: 'status',
|
|
title: 'Статус',
|
|
features: { multiselect: true, sort: true },
|
|
render: (v) => <TableTag {...statusColorMapping[v as ConsRussianStatus]} text={v as string} />,
|
|
},
|
|
// ГСК в версии не хранится (решение владельца П-3) — колонка как в макете [34], пустая
|
|
{ key: 'gsk', title: 'ГСК', features: {}, render: () => '—' },
|
|
{ key: 'created_at', title: 'Дата создания', features: { sort: true }, render: ruDate },
|
|
// даты верификации в API нет (VersionBrief), до маршрута согласования (Срез 7) — прочерк
|
|
{ key: 'verified_at', title: 'Дата верификации', features: {}, render: () => '—' },
|
|
{ key: 'members_count', title: 'Организаций', features: {} },
|
|
],
|
|
};
|