ConceptPortal-public/rsconcept/frontend/src/dialogs/DlgDeleteCst/ConstituentsList.tsx

32 lines
786 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
import { IRSForm } from '@/models/rsform';
import { labelConstituenta } from '@/utils/labels';
2023-12-07 01:21:27 +03:00
interface ConstituentsListProps {
2023-12-28 14:04:44 +03:00
list: number[];
schema: IRSForm;
2023-12-28 14:04:44 +03:00
prefix: string;
title?: string;
2023-12-07 01:21:27 +03:00
}
function ConstituentsList({ list, schema, title, prefix }: ConstituentsListProps) {
2023-12-07 01:21:27 +03:00
return (
2023-12-28 14:04:44 +03:00
<div>
{title ? (
<p className='pb-1'>
{title}: <b>{list.length}</b>
</p>
) : null}
2024-05-02 21:34:47 +03:00
<div className={clsx('h-[9rem]', 'px-3', 'cc-scroll-y', 'border', 'whitespace-nowrap')}>
2023-12-28 14:04:44 +03:00
{list.map(id => {
const cst = schema.cstByID.get(id);
2023-12-28 14:04:44 +03:00
return cst ? <p key={`${prefix}${cst.id}`}>{labelConstituenta(cst)}</p> : null;
})}
</div>
2023-12-07 01:21:27 +03:00
</div>
2023-12-28 14:04:44 +03:00
);
2023-12-07 01:21:27 +03:00
}
2023-12-28 14:04:44 +03:00
export default ConstituentsList;