2023-12-15 17:34:50 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2023-12-13 14:32:57 +03:00
|
|
|
import { IConstituenta } from '@/models/rsform';
|
|
|
|
import { labelConstituenta } from '@/utils/labels';
|
2023-12-07 01:21:27 +03:00
|
|
|
|
|
|
|
interface ConstituentsListProps {
|
|
|
|
list: number[]
|
|
|
|
items: IConstituenta[]
|
|
|
|
prefix: string
|
|
|
|
title?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
function ConstituentsList({ list, items, title, prefix }: ConstituentsListProps) {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{title ?
|
|
|
|
<p className='pb-1'>
|
|
|
|
{title}: <b>{list.length}</b>
|
|
|
|
</p> : null}
|
2023-12-15 17:34:50 +03:00
|
|
|
<div className={clsx(
|
|
|
|
'h-[9rem]',
|
|
|
|
'px-3',
|
|
|
|
'overflow-y-auto',
|
|
|
|
'border',
|
|
|
|
'whitespace-nowrap'
|
|
|
|
)}>
|
2023-12-07 01:21:27 +03:00
|
|
|
{list.map(
|
|
|
|
(id) => {
|
|
|
|
const cst = items.find(cst => cst.id === id);
|
|
|
|
return (cst ?
|
|
|
|
<p key={`${prefix}${cst.id}`}>
|
|
|
|
{labelConstituenta(cst)}
|
|
|
|
</p> : null);
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ConstituentsList;
|