2023-11-06 20:21:30 +03:00
|
|
|
|
import { IConstituenta } from '../../models/rsform';
|
|
|
|
|
import { isMockCst } from '../../models/rsformAPI';
|
2023-11-06 18:03:23 +03:00
|
|
|
|
import { colorfgCstStatus,IColorTheme } from '../../utils/color';
|
|
|
|
|
import { describeExpressionStatus } from '../../utils/labels';
|
2023-11-26 02:24:16 +03:00
|
|
|
|
import ConceptTooltip from '../common/ConceptTooltip';
|
2023-11-06 18:03:23 +03:00
|
|
|
|
import ConstituentaTooltip from '../Help/ConstituentaTooltip';
|
|
|
|
|
|
|
|
|
|
interface ConstituentaBadgeProps {
|
|
|
|
|
prefixID?: string
|
|
|
|
|
shortTooltip?: boolean
|
|
|
|
|
value: IConstituenta
|
|
|
|
|
theme: IColorTheme
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ConstituentaBadge({ value, prefixID, shortTooltip, theme }: ConstituentaBadgeProps) {
|
|
|
|
|
return (<div className='w-fit'>
|
|
|
|
|
<div
|
|
|
|
|
id={`${prefixID}${value.alias}`}
|
|
|
|
|
className='min-w-[3.1rem] max-w-[3.1rem] px-1 text-center rounded-md whitespace-nowrap'
|
|
|
|
|
style={{
|
|
|
|
|
borderWidth: '1px',
|
|
|
|
|
borderColor: colorfgCstStatus(value.status, theme),
|
|
|
|
|
color: colorfgCstStatus(value.status, theme),
|
|
|
|
|
backgroundColor: isMockCst(value) ? theme.bgWarning : theme.bgInput,
|
|
|
|
|
fontWeight: 600
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{value.alias}
|
|
|
|
|
</div>
|
|
|
|
|
{ !shortTooltip && <ConstituentaTooltip data={value} anchor={`#${prefixID}${value.alias}`} />}
|
|
|
|
|
{ shortTooltip &&
|
|
|
|
|
<ConceptTooltip
|
|
|
|
|
anchorSelect={`#${prefixID}${value.alias}`}
|
|
|
|
|
place='right'
|
|
|
|
|
>
|
|
|
|
|
<p><span className='font-semibold'>Статус</span>: {describeExpressionStatus(value.status)}</p>
|
|
|
|
|
</ConceptTooltip>}
|
|
|
|
|
</div>);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ConstituentaBadge;
|