mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
Fix: Item Category Dialog
This commit is contained in:
46
client/src/containers/Dialogs/ItemCategoryDialog/index.js
Normal file
46
client/src/containers/Dialogs/ItemCategoryDialog/index.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import React, { lazy } from 'react';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import { Dialog, DialogSuspense } from 'components';
|
||||
|
||||
import withDialogRedux from 'components/DialogReduxConnect';
|
||||
import { compose } from 'utils';
|
||||
|
||||
const ItemCategoryFormDialogContent = lazy(() =>
|
||||
import('./ItemCategoryFormDialogContent'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Item Category form dialog.
|
||||
*/
|
||||
function ItemCategoryFormDialog({
|
||||
dialogName,
|
||||
payload = { action: '', id: null },
|
||||
isOpen,
|
||||
}) {
|
||||
return (
|
||||
<Dialog
|
||||
name={dialogName}
|
||||
title={
|
||||
payload.action === 'edit' ? (
|
||||
<T id={'edit_category'} />
|
||||
) : (
|
||||
<T id={'new_category'} />
|
||||
)
|
||||
}
|
||||
className={'dialog--category-form'}
|
||||
isOpen={isOpen}
|
||||
autoFocus={true}
|
||||
canEscapeKeyClose={true}
|
||||
>
|
||||
<DialogSuspense>
|
||||
<ItemCategoryFormDialogContent
|
||||
dialogName={dialogName}
|
||||
action={payload.action}
|
||||
itemCategoryId={payload.id}
|
||||
/>
|
||||
</DialogSuspense>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withDialogRedux())(ItemCategoryFormDialog);
|
||||
Reference in New Issue
Block a user