- {/*------------ Date -----------*/}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={}
- intent={inputIntent({ error, touched })}
- helperText={}
- minimal={true}
- className={classNames(CLASSES.FILL)}
- >
- {
- form.setFieldValue('date', formattedDate);
- })}
- value={tansformDateValue(value)}
- popoverProps={{
- position: Position.BOTTOM,
- minimal: true,
- }}
- />
-
- )}
-
+
+
+ {/*------------ Date -----------*/}
+
+ {({ form, field: { value }, meta: { error, touched } }) => (
+ }
+ labelInfo={}
+ intent={inputIntent({ error, touched })}
+ helperText={}
+ minimal={true}
+ className={classNames(CLASSES.FILL, 'form-group--date')}
+ >
+ {
+ form.setFieldValue('date', formattedDate);
+ })}
+ value={tansformDateValue(value)}
+ popoverProps={{
+ position: Position.BOTTOM,
+ minimal: true,
+ }}
+ />
+
+ )}
+
+
+
+ {/*------------ Adjustment type -----------*/}
+
+ {({ form, field: { value }, meta: { error, touched } }) => (
+ }
+ labelInfo={}
+ helperText={}
+ intent={inputIntent({ error, touched })}
+ className={classNames(CLASSES.FILL, 'form-group--type')}
+ >
+ {
+ form.setFieldValue('type', type.value);
+ type?.value == 'increment'
+ ? form.setFieldValue(
+ 'new_quantity',
+ incrementCalc(values),
+ )
+ : form.setFieldValue(
+ 'new_quantity',
+ values.quantity_on_hand - values.quantity,
+ );
+ }}
+ filterable={false}
+ selectedItem={value}
+ selectedItemProp={'value'}
+ textProp={'name'}
+ popoverProps={{ minimal: true }}
+ />
+
+ )}
+
+
+
+
+
- {/*------------ Adjustment type -----------*/}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={}
- helperText={}
- intent={inputIntent({ error, touched })}
- className={classNames(CLASSES.FILL)}
- >
- {
- form.setFieldValue('type', type.value);
- type?.value == 'increment'
- ? form.setFieldValue('new_quantity', incrementCalc(values))
- : form.setFieldValue(
- 'new_quantity',
- values.quantity_on_hand - values.quantity,
- );
- }}
- filterable={false}
- selectedItem={value}
- selectedItemProp={'value'}
- textProp={'name'}
- popoverProps={{ minimal: true }}
- />
-
- )}
-
-
-
-
-
-
-
-
-
- {/*------------ Reason -----------*/}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- labelInfo={}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
-
- )}
-
{/*------------ Adjustment account -----------*/}
{({ form, field, meta: { error, touched } }) => (
@@ -123,6 +113,7 @@ function InventoryAdjustmentFormDialogFields({
labelInfo={}
intent={inputIntent({ error, touched })}
helperText={}
+ className={'from-group--adjustment-account'}
>
)}
+
{/*------------ Reference -----------*/}
{({ form, field, meta: { error, touched } }) => (
}
- className={classNames(CLASSES.FILL)}
intent={inputIntent({ error, touched })}
helperText={}
+ className={'from-group--reference-no'}
>
)}
+
{/*------------ description -----------*/}
-
+
{({ field, meta: { error, touched } }) => (
}
- className={'form-group--description'}
+ label={}
+ className={'form-group--adjustment-reasons'}
intent={inputIntent({ error, touched })}
- helperText={}
+ helperText={}
+ placeholder={'Max 500 characters'}
>
-
+
)}
diff --git a/client/src/containers/Dialogs/InventoryAdjustmentFormDialog/InventoryAdjustmentQuantityFields.js b/client/src/containers/Dialogs/InventoryAdjustmentFormDialog/InventoryAdjustmentQuantityFields.js
new file mode 100644
index 000000000..42229d662
--- /dev/null
+++ b/client/src/containers/Dialogs/InventoryAdjustmentFormDialog/InventoryAdjustmentQuantityFields.js
@@ -0,0 +1,22 @@
+import React from 'react';
+import { useFormikContext } from 'formik';
+import { Choose, If } from 'components';
+import IncrementAdjustmentFields from './IncrementAdjustmentFields';
+import DecrementAdjustmentFields from './DecrementAdjustmentFields';
+
+export default function InventoryAdjustmentQuantityFields() {
+ const { values } = useFormikContext();
+
+ return (
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/client/src/containers/Dialogs/InventoryAdjustmentFormDialog/index.js b/client/src/containers/Dialogs/InventoryAdjustmentFormDialog/index.js
index e32d749ee..9cbb004f8 100644
--- a/client/src/containers/Dialogs/InventoryAdjustmentFormDialog/index.js
+++ b/client/src/containers/Dialogs/InventoryAdjustmentFormDialog/index.js
@@ -13,7 +13,7 @@ const InventoryAdjustmentFormDialogContent = lazy(() =>
*/
function InventoryAdjustmentFormDialog({
dialogName,
- payload = { action: '', id: null },
+ payload = { action: '', itemId: null },
isOpen,
}) {
return (
@@ -23,11 +23,12 @@ function InventoryAdjustmentFormDialog({
isOpen={isOpen}
canEscapeJeyClose={true}
autoFocus={true}
+ className={'dialog--adjustment-item'}
>
diff --git a/client/src/containers/Items/ItemForm.js b/client/src/containers/Items/ItemForm.js
index d19efc0af..55c3192aa 100644
--- a/client/src/containers/Items/ItemForm.js
+++ b/client/src/containers/Items/ItemForm.js
@@ -6,7 +6,6 @@ import { useHistory } from 'react-router-dom';
import { useIntl } from 'react-intl';
import classNames from 'classnames';
import { defaultTo } from 'lodash';
-import moment from 'moment';
import { CLASSES } from 'common/classes';
import AppToaster from 'components/AppToaster';
@@ -18,7 +17,7 @@ import ItemFormInventorySection from './ItemFormInventorySection';
import withItemsActions from 'containers/Items/withItemsActions';
import withMediaActions from 'containers/Media/withMediaActions';
import useMedia from 'hooks/useMedia';
-import withItemDetail from 'containers/Items/withItemDetail';
+import withItem from 'containers/Items/withItem';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import withSettings from 'containers/Settings/withSettings';
@@ -56,7 +55,7 @@ function ItemForm({
requestEditItem,
itemId,
- itemDetail,
+ item,
onFormSubmit,
// #withDashboardActions
@@ -106,12 +105,12 @@ function ItemForm({
* as well.
*/
...transformToForm(
- transformItemFormData(itemDetail, defaultInitialValues),
+ transformItemFormData(item, defaultInitialValues),
defaultInitialValues,
),
}),
[
- itemDetail,
+ item,
preferredCostAccount,
preferredSellAccount,
preferredInventoryAccount,
@@ -177,20 +176,20 @@ function ItemForm({
};
useEffect(() => {
- if (itemDetail && itemDetail.type) {
- changePageSubtitle(transitionItemTypeKeyToLabel(itemDetail.type));
+ if (item && item.type) {
+ changePageSubtitle(transitionItemTypeKeyToLabel(item.type));
}
- }, [itemDetail, changePageSubtitle, formatMessage]);
+ }, [item, changePageSubtitle, formatMessage]);
const initialAttachmentFiles = useMemo(() => {
- return itemDetail && itemDetail.media
- ? itemDetail.media.map((attach) => ({
+ return item && item.media
+ ? item.media.map((attach) => ({
preview: attach.attachment_file,
upload: true,
metadata: { ...attach },
}))
: [];
- }, [itemDetail]);
+ }, [item]);
const handleDropFiles = useCallback(
(_files) => {
@@ -233,7 +232,7 @@ function ItemForm({
{({ isSubmitting, handleSubmit }) => (