diff --git a/rsconcept/frontend/src/app/global-dialogs.tsx b/rsconcept/frontend/src/app/global-dialogs.tsx index 9b62de62..f0c79d34 100644 --- a/rsconcept/frontend/src/app/global-dialogs.tsx +++ b/rsconcept/frontend/src/app/global-dialogs.tsx @@ -118,6 +118,11 @@ const DlgCreateBlock = React.lazy(() => default: module.DlgCreateBlock })) ); +const DlgEditBlock = React.lazy(() => + import('@/features/oss/dialogs/dlg-edit-block').then(module => ({ + default: module.DlgEditBlock + })) +); export const GlobalDialogs = () => { const active = useDialogsStore(state => state.active); @@ -134,6 +139,8 @@ export const GlobalDialogs = () => { return ; case DialogType.CREATE_BLOCK: return ; + case DialogType.EDIT_BLOCK: + return ; case DialogType.DELETE_CONSTITUENTA: return ; case DialogType.EDIT_EDITORS: diff --git a/rsconcept/frontend/src/features/oss/backend/api.ts b/rsconcept/frontend/src/features/oss/backend/api.ts index 2a160a52..02e09ed3 100644 --- a/rsconcept/frontend/src/features/oss/backend/api.ts +++ b/rsconcept/frontend/src/features/oss/backend/api.ts @@ -66,7 +66,7 @@ export const ossApi = { updateBlock: ({ itemID, data }: { itemID: number; data: IUpdateBlockDTO }) => axiosPatch({ schema: schemaOperationSchema, - endpoint: `/api/oss/${itemID}/update-operation`, + endpoint: `/api/oss/${itemID}/update-block`, request: { data: data, successMessage: infoMsg.changesSaved diff --git a/rsconcept/frontend/src/features/oss/components/select-parent.tsx b/rsconcept/frontend/src/features/oss/components/select-parent.tsx new file mode 100644 index 00000000..1abc9ff7 --- /dev/null +++ b/rsconcept/frontend/src/features/oss/components/select-parent.tsx @@ -0,0 +1,35 @@ +import clsx from 'clsx'; + +import { IconConceptBlock } from '@/components/icons'; +import { globalIDs } from '@/utils/constants'; + +import { type IBlock } from '../models/oss'; + +import { SelectBlock } from './select-block'; + +interface SelectParentProps { + id?: string; + value: IBlock | null; + onChange: (newValue: IBlock | null) => void; + + fullWidth?: boolean; + items?: IBlock[]; + placeholder?: string; + noBorder?: boolean; + popoverClassname?: string; +} + +export function SelectParent({ fullWidth, ...restProps }: SelectParentProps) { + return ( +
+ + +
+ ); +} diff --git a/rsconcept/frontend/src/features/oss/dialogs/dlg-create-block/dlg-create-block.tsx b/rsconcept/frontend/src/features/oss/dialogs/dlg-create-block/dlg-create-block.tsx index 48e48ec9..8e13b8a6 100644 --- a/rsconcept/frontend/src/features/oss/dialogs/dlg-create-block/dlg-create-block.tsx +++ b/rsconcept/frontend/src/features/oss/dialogs/dlg-create-block/dlg-create-block.tsx @@ -78,7 +78,7 @@ export function DlgCreateBlock() { submitText='Создать' canSubmit={isValid} onSubmit={event => void methods.handleSubmit(onSubmit)(event)} - className='w-160 px-6 h-128' + className='w-160 px-6 h-110' helpTopic={HelpTopic.CC_OSS} > ( - field.onChange(value ? value.id : null)} @@ -44,7 +43,7 @@ export function TabBlockCard() { id='operation_comment' // label='Описание' noResize - rows={3} + rows={5} {...register('item_data.description')} /> diff --git a/rsconcept/frontend/src/features/oss/dialogs/dlg-create-block/tab-block-children.tsx b/rsconcept/frontend/src/features/oss/dialogs/dlg-create-block/tab-block-children.tsx index 8dd413b3..e190dbb7 100644 --- a/rsconcept/frontend/src/features/oss/dialogs/dlg-create-block/tab-block-children.tsx +++ b/rsconcept/frontend/src/features/oss/dialogs/dlg-create-block/tab-block-children.tsx @@ -33,7 +33,7 @@ export function TabBlockChildren() { return (
); } diff --git a/rsconcept/frontend/src/features/oss/dialogs/dlg-create-operation/dlg-create-operation.tsx b/rsconcept/frontend/src/features/oss/dialogs/dlg-create-operation/dlg-create-operation.tsx index 985d7d08..03e58bcb 100644 --- a/rsconcept/frontend/src/features/oss/dialogs/dlg-create-operation/dlg-create-operation.tsx +++ b/rsconcept/frontend/src/features/oss/dialogs/dlg-create-operation/dlg-create-operation.tsx @@ -93,7 +93,7 @@ export function DlgCreateOperation() { submitText='Создать' canSubmit={isValid} onSubmit={event => void methods.handleSubmit(onSubmit)(event)} - className='w-160 px-6 h-128' + className='w-180 px-6 h-128' helpTopic={HelpTopic.CC_OSS} > @@ -74,7 +74,7 @@ export function TabInputOperation() { name='item_data.parent' control={control} render={({ field }) => ( - @@ -39,7 +39,7 @@ export function TabSynthesisOperation() { name='item_data.parent' control={control} render={({ field }) => ( - state.props as DlgEditBlockProps); + const { updateBlock } = useUpdateBlock(); + + const { + handleSubmit, + control, + register, + formState: { errors, isValid } + } = useForm({ + resolver: zodResolver(schemaUpdateBlock), + defaultValues: { + target: target.id, + item_data: { + title: target.title, + description: target.description, + parent: target.parent + }, + layout: layout + }, + mode: 'onChange' + }); + + function onSubmit(data: IUpdateBlockDTO) { + return updateBlock({ itemID: oss.id, data }); + } + + return ( + void handleSubmit(onSubmit)(event)} + className='w-160 px-6 h-fit cc-column' + > + + ( + block.id !== target.id)} + value={field.value ? oss.blockByID.get(field.value) ?? null : null} + placeholder='Блок содержания не выбран' + onChange={value => field.onChange(value ? value.id : null)} + /> + )} + /> + +