'use client'; import clsx from 'clsx'; import { useState } from 'react'; import Checkbox from '@/components/ui/Checkbox'; import Modal from '@/components/ui/Modal'; import { ConstituentaID, IRSForm } from '@/models/rsform'; import { useDialogsStore } from '@/stores/dialogs'; import { prefixes } from '@/utils/constants'; import ListConstituents from './ListConstituents'; export interface DlgDeleteCstProps { schema: IRSForm; selected: ConstituentaID[]; onDelete: (items: ConstituentaID[]) => void; } function DlgDeleteCst() { const { selected, schema, onDelete } = useDialogsStore(state => state.props as DlgDeleteCstProps); const [expandOut, setExpandOut] = useState(false); const expansion: ConstituentaID[] = schema.graph.expandAllOutputs(selected); const hasInherited = selected.some( id => schema.inheritance.find(item => item.parent === id), [selected, schema.inheritance] ); function handleSubmit() { if (expandOut) { onDelete(selected.concat(expansion)); } else { onDelete(selected); } return true; } return ( setExpandOut(value)} /> {hasInherited ? (

Внимание! Выбранные конституенты имеют наследников в ОСС

) : null}
); } export default DlgDeleteCst;