From f042e23e6c7a504fcd4ab0b92c9a786cb23c3ee2 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Tue, 12 Jan 2021 15:37:25 +0200 Subject: [PATCH] fix: remove opening quantity & cost & date from item. --- client/src/containers/Items/ItemForm.js | 3 - .../src/containers/Items/ItemForm.schema.js | 20 ------ .../Items/ItemFormInventorySection.js | 71 ------------------- 3 files changed, 94 deletions(-) diff --git a/client/src/containers/Items/ItemForm.js b/client/src/containers/Items/ItemForm.js index b30b6c3ee..89af435d6 100644 --- a/client/src/containers/Items/ItemForm.js +++ b/client/src/containers/Items/ItemForm.js @@ -43,9 +43,6 @@ const defaultInitialValues = { category_id: '', sellable: 1, purchasable: true, - opening_quantity: '', - opening_cost: '', - opening_date: moment(new Date()).format('YYYY-MM-DD'), }; /** diff --git a/client/src/containers/Items/ItemForm.schema.js b/client/src/containers/Items/ItemForm.schema.js index 963b12f12..8eade519d 100644 --- a/client/src/containers/Items/ItemForm.schema.js +++ b/client/src/containers/Items/ItemForm.schema.js @@ -61,26 +61,6 @@ const Schema = Yup.object().shape({ stock: Yup.string() || Yup.boolean(), sellable: Yup.boolean().required(), purchasable: Yup.boolean().required(), - opening_cost: Yup.number().when(['opening_quantity'], { - is: (value) => value, - then: Yup.number() - .min(0) - .required() - .label(formatMessage({ id: 'opening_cost_' })), - otherwise: Yup.number().nullable(), - }), - opening_quantity: Yup.number() - .integer() - .min(1) - .nullable() - .label(formatMessage({ id: 'opening_quantity_' })), - opening_date: Yup.date().when(['opening_quantity', 'opening_cost'], { - is: (quantity, cost) => !isBlank(quantity) && !isBlank(cost), - then: Yup.date() - .required() - .label(formatMessage({ id: 'opening_date_' })), - otherwise: Yup.date().nullable(), - }), }); export const transformItemFormData = (item, defaultValue) => { diff --git a/client/src/containers/Items/ItemFormInventorySection.js b/client/src/containers/Items/ItemFormInventorySection.js index f595635cc..efb2762fe 100644 --- a/client/src/containers/Items/ItemFormInventorySection.js +++ b/client/src/containers/Items/ItemFormInventorySection.js @@ -65,77 +65,6 @@ function ItemFormInventorySection({ accountsList, baseCurrency }) { )} - - {/*------------- Opening quantity ------------- */} - - {({ 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 } }) => ( - } - labelInfo={} - className={classNames( - 'form-group--select-list', - 'form-group--opening_date', - CLASSES.FILL, - )} - intent={inputIntent({ error, touched })} - helperText={} - inline={true} - > - { - form.setFieldValue('opening_date', value); - })} - helperText={} - popoverProps={{ position: Position.BOTTOM, minimal: true }} - /> - - )} - - - - {/*------------- Opening cost ------------- */} - - - {({ form, field: { value }, meta: { touched, error } }) => ( - } - labelInfo={} - className={'form-group--opening_cost'} - intent={inputIntent({ error, touched })} - helperText={} - inline={true} - > - - - { - form.setFieldValue('opening_cost', unformattedValue); - }} - /> - - - )} -