Andrey Epifancev 2cddb55a5b Форматирование под ESLint + Prettier и зелёный make check (#31)
После merge test (ESLint + Prettier, #30): npm run format и правки,
без которых make check и синхронизация arm-core/web не проходят.

- Список ЮЛ: тип ответа — страница Page<ICatalogueJur> (items/total),
  thunk с rejectValue: string, как в companyGroupsSlice.
- Склонения «организация/запись» — общая функция pluralRu в utils/labels
  (с тестом) вместо вложенных тернарников; заодно верно для 11–14, 21–24.
- Список ГК: пункт — <button> вместо div с onClick (a11y), пустое
  состояние и загрузка — без вложенного тернарника.
- Убраны лишние async, неиспользуемые импорты и проп companyId,
  any в колонке «Основной РФ».

make check: tsc 0, biome 7 предупреждений (как на test), eslint 0 ошибок,
vitest 141/141, build ок.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 18:28:53 +04:00

50 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { TableConfig } from '../../components/GenericTable';
import { TableTag } from '../../components/TableTag/TableTag';
import { TAG_PRESETS } from '../../components/TableTag/presets';
import type { ICatalogueJur } from '../../types/catalogueJur/catalogueJur';
export const catalogueJurConfig: TableConfig<ICatalogueJur> = {
rowKey: 'id',
searchableKeys: ['closed', 'inn', 'kpp', 'name', 'entity_type'],
columns: [
{
key: 'closed',
title: 'Статус',
features: { sort: true },
render: (_: unknown, row) => {
// #TODO поменять логику если запись не активна
return <TableTag text={!row.closed ? 'Активно' : 'Не активно'} {...TAG_PRESETS.green} />;
},
},
{
key: 'inn',
title: 'ИНН',
features: { search: true },
},
{
key: 'kpp',
title: 'КПП',
features: { search: true },
},
{
key: 'name',
title: 'Организация',
features: { search: true, multiselect: true, sort: true },
},
{
key: 'entity_type',
title: 'Тип',
features: { multiselect: true, sort: true },
render: (val) => {
const preset = val === 'ЮЛ' ? TAG_PRESETS.orange : TAG_PRESETS.purple;
return <TableTag text={val as string} {...preset} />;
},
},
{
key: 'regional_office',
title: 'Основной РФ',
render: (val) => (val as ICatalogueJur['regional_office'] | null)?.name,
},
],
};