{
diff --git a/client/src/containers/Items/ItemFormInventorySection.js b/client/src/containers/Items/ItemFormInventorySection.js
index 42fa52166..f595635cc 100644
--- a/client/src/containers/Items/ItemFormInventorySection.js
+++ b/client/src/containers/Items/ItemFormInventorySection.js
@@ -1,18 +1,37 @@
import React from 'react';
import { FastField, ErrorMessage } from 'formik';
-import { FormGroup, InputGroup, Position } from '@blueprintjs/core';
+import {
+ FormGroup,
+ InputGroup,
+ ControlGroup,
+ Position,
+} from '@blueprintjs/core';
import { DateInput } from '@blueprintjs/datetime';
-import { AccountsSelectList, Col, Row, Hint } from 'components';
+import {
+ AccountsSelectList,
+ MoneyInputGroup,
+ InputPrependText,
+ Col,
+ Row,
+ Hint,
+} from 'components';
import { CLASSES } from 'common/classes';
import { FormattedMessage as T } from 'react-intl';
import classNames from 'classnames';
import withAccounts from 'containers/Accounts/withAccounts';
-import { compose, tansformDateValue, momentFormatter, inputIntent } from 'utils';
+import withSettings from 'containers/Settings/withSettings';
+import {
+ compose,
+ tansformDateValue,
+ momentFormatter,
+ inputIntent,
+ handleDateChange,
+} from 'utils';
/**
* Item form inventory sections.
*/
-function ItemFormInventorySection({ accountsList }) {
+function ItemFormInventorySection({ accountsList, baseCurrency }) {
return (
@@ -47,23 +66,23 @@ function ItemFormInventorySection({ accountsList }) {
)}
+ {/*------------- Opening quantity ------------- */}
- {({ field, field: { value }, meta: { touched, error } }) => (
+ {({ field, meta: { touched, error } }) => (
}
labelInfo={}
className={'form-group--opening_quantity'}
intent={inputIntent({ error, touched })}
+ helperText={}
inline={true}
>
-
+
)}
+ {/*------------- Opening date ------------- */}
{({ form, field: { value }, meta: { touched, error } }) => (
}
inline={true}
>
{
+ onChange={handleDateChange((value) => {
form.setFieldValue('opening_date', value);
- }}
+ })}
+ helperText={}
popoverProps={{ position: Position.BOTTOM, minimal: true }}
/>
@@ -90,20 +111,28 @@ function ItemFormInventorySection({ accountsList }) {
+ {/*------------- Opening cost ------------- */}
-
- {({ field, field: { value }, meta: { touched, error } }) => (
+
+ {({ form, field: { value }, meta: { touched, error } }) => (
}
labelInfo={}
- className={'form-group--opening_average_rate'}
+ className={'form-group--opening_cost'}
intent={inputIntent({ error, touched })}
+ helperText={}
inline={true}
>
-
+
+
+ {
+ form.setFieldValue('opening_cost', unformattedValue);
+ }}
+ />
+
)}
@@ -117,4 +146,7 @@ export default compose(
withAccounts(({ accountsList }) => ({
accountsList,
})),
+ withSettings(({ organizationSettings }) => ({
+ baseCurrency: organizationSettings?.baseCurrency,
+ })),
)(ItemFormInventorySection);
diff --git a/client/src/containers/Items/ItemsDataTable.js b/client/src/containers/Items/ItemsDataTable.js
index 09a9736f1..7b1d8f925 100644
--- a/client/src/containers/Items/ItemsDataTable.js
+++ b/client/src/containers/Items/ItemsDataTable.js
@@ -124,6 +124,14 @@ function ItemsDataTable({
],
);
+ const quantityonHandCell = ({ value: quantity }) => {
+ return quantity <= 0 ? (
+ {quantity}
+ ) : (
+ {quantity}
+ );
+ };
+
const handleRowContextMenu = useCallback(
(cell) => {
return actionMenuList(cell.row.original);
@@ -189,13 +197,7 @@ function ItemsDataTable({
{
Header: formatMessage({ id: 'quantity_on_hand' }),
accessor: 'quantity_on_hand',
- className: 'quantity_on_hand',
- width: 140,
- },
- {
- Header: formatMessage({ id: 'average_rate' }),
- accessor: 'average_cost_rate',
- className: 'average_cost_rate',
+ Cell: quantityonHandCell,
width: 140,
},
{
diff --git a/client/src/lang/en/index.js b/client/src/lang/en/index.js
index 8a825ad04..757673bac 100644
--- a/client/src/lang/en/index.js
+++ b/client/src/lang/en/index.js
@@ -100,6 +100,7 @@ export default {
inventory_information: 'Inventory Information',
inventory_account: 'Inventory Account',
opening_quantity: 'Opening quantity',
+ opening_cost: 'Opening cost',
save: 'Save',
save_as_draft: 'Save as Draft',
active: 'Active',
@@ -928,5 +929,9 @@ export default {
'Are you sure you want to activate this item? You will be able to inactivate it later',
inactivate_item: 'Inactivate Item',
activate_item: 'Activate Item',
- all_payments:'All Payments'
+ all_payments: 'All Payments',
+ opening_quantity_: 'Opening quantity',
+ opening_average_cost: 'Opening average cost',
+ opening_cost_: 'Opening cost ',
+ opening_date_: 'Opening date ',
};
diff --git a/client/src/style/pages/items.scss b/client/src/style/pages/items.scss
index 383b524a0..0e4287f67 100644
--- a/client/src/style/pages/items.scss
+++ b/client/src/style/pages/items.scss
@@ -95,6 +95,9 @@
color: #9eaab6;
}
}
+ .quantity_on_hand {
+ color: #ff0000;
+ }
}
}
}