Andrey Epifancev 46d553b074 fix(web): правила экранов консолидаций — в utils/consolidations.ts с тестами (AURORA-1589, PR #166)
Подписи и пояснения статусов версии, ручные переходы MANUAL_TRANSITIONS (зеркало
api/src/services/consolidation_status.py, синхронная константа вместо мока), своя
блокировка, активность «Изменить статус», причина ≤ 1000 после обрезки, «Версия»
(1 — пусто, 2+ — номер), разбор ?in_work_only (по умолчанию выключен), «Взять в работу»
по коду статуса CANCELLED. Подпись CANCELLED — «Отменена»; у строки списка — код статуса
(status_code). Хук useBeforeUnload. Тесты vitest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 01:15:55 +04:00

34 lines
1.9 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 { versionLabel } from '../../utils/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 }, render: (v) => versionLabel(Number(v)) },
{
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: { search: true, multiselect: true }, render: () => '—' },
{ key: 'created_at', title: 'Дата создания', features: {}, render: ruDate },
// даты верификации в API нет (VersionBrief), до маршрута согласования (Срез 7) — прочерк
{ key: 'verified_at', title: 'Дата верификации', features: {}, render: () => '—' },
{ key: 'members_count', title: 'Организаций', features: {} },
],
};