diff --git a/client/src/containers/Dialogs/ItemCategoryDialog/ItemCategoryForm.js b/client/src/containers/Dialogs/ItemCategoryDialog/ItemCategoryForm.js index bcb8981be..df4561014 100644 --- a/client/src/containers/Dialogs/ItemCategoryDialog/ItemCategoryForm.js +++ b/client/src/containers/Dialogs/ItemCategoryDialog/ItemCategoryForm.js @@ -67,7 +67,7 @@ function ItemCategoryForm({ const afterSubmit = () => { closeDialog(dialogName); }; - // Handle the response success/ + // Handle the response success. const onSuccess = ({ response }) => { AppToaster.show({ message: formatMessage({ @@ -80,7 +80,9 @@ function ItemCategoryForm({ afterSubmit(response); }; // Handle the response error. - const onError = (errors) => { + const onError = (error) => { + const { response: { data: { errors } } } = error; + transformErrors(errors, { setErrors }); setSubmitting(false); }; diff --git a/client/src/containers/InventoryAdjustments/InventoryAdjustmentDataTable.js b/client/src/containers/InventoryAdjustments/InventoryAdjustmentDataTable.js deleted file mode 100644 index 4a2ce1330..000000000 --- a/client/src/containers/InventoryAdjustments/InventoryAdjustmentDataTable.js +++ /dev/null @@ -1,195 +0,0 @@ - import React, { useCallback, useMemo } from 'react'; -import { - Button, - Popover, - Menu, - Intent, - MenuItem, - MenuDivider, - Position, -} from '@blueprintjs/core'; -import { useIntl } from 'react-intl'; -import moment from 'moment'; -import classNames from 'classnames'; -import { withRouter } from 'react-router-dom'; - -import { DataTable, Icon } from 'components'; -import { CLASSES } from 'common/classes'; -import { - PublishAccessor, - TypeAccessor, -} from './components'; - -import withDialogActions from 'containers/Dialog/withDialogActions'; -import withInventoryAdjustmentActions from './withInventoryAdjustmentActions'; - -import { compose, saveInvoke } from 'utils'; - -function InventoryAdjustmentDataTable({ - // withInventoryAdjustmentsActions - addInventoryAdjustmentTableQueries, - - // #ownProps - isLoading, - inventoryAdjustments, - pagination, - onDeleteInventoryAdjustment, - onSelectedRowsChange, -}) { - const { formatMessage } = useIntl(); - - const handleDeleteInventoryAdjustment = useCallback( - (_adjustment) => () => { - saveInvoke(onDeleteInventoryAdjustment, _adjustment); - }, - [onDeleteInventoryAdjustment], - ); - - const actionMenuList = useCallback( - (adjustment) => ( - - } - text={formatMessage({ id: 'view_details' })} - /> - - } - /> - - ), - [handleDeleteInventoryAdjustment, formatMessage], - ); - - const onRowContextMenu = useCallback( - (cell) => actionMenuList(cell.row.original), - [actionMenuList], - ); - - const columns = useMemo( - () => [ - { - id: 'date', - Header: formatMessage({ id: 'date' }), - accessor: (r) => moment(r.date).format('YYYY MMM DD'), - width: 115, - className: 'date', - }, - { - id: 'type', - Header: formatMessage({ id: 'type' }), - accessor: TypeAccessor, - className: 'type', - width: 100, - }, - { - id: 'reason', - Header: formatMessage({ id: 'reason' }), - accessor: 'reason', - className: 'reason', - width: 115, - }, - { - id: 'reference_no', - Header: formatMessage({ id: 'reference_no' }), - accessor: 'reference_no', - className: 'reference_no', - width: 100, - }, - { - id: 'publish', - Header: formatMessage({ id: 'status' }), - accessor: PublishAccessor, - width: 95, - className: 'publish', - }, - { - id: 'description', - Header: formatMessage({ id: 'description' }), - accessor: 'description', - disableSorting: true, - width: 85, - className: 'description', - }, - { - id: 'created_at', - Header: formatMessage({ id: 'created_at' }), - accessor: (r) => moment(r.created_at).format('YYYY MMM DD'), - width: 125, - className: 'created_at', - }, - { - id: 'actions', - Header: '', - Cell: ({ cell }) => ( - -