mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 23:30:32 +00:00
fix: itemPerfernce.
This commit is contained in:
@@ -3,6 +3,7 @@ import { Formik } from 'formik';
|
|||||||
import { Intent } from '@blueprintjs/core';
|
import { Intent } from '@blueprintjs/core';
|
||||||
import { AppToaster } from 'components';
|
import { AppToaster } from 'components';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
import { pick, omit } from 'lodash';
|
||||||
import { ItemPreferencesSchema } from './ItemPreferences.schema';
|
import { ItemPreferencesSchema } from './ItemPreferences.schema';
|
||||||
import ItemPreferencesForm from './ItemPreferencesForm';
|
import ItemPreferencesForm from './ItemPreferencesForm';
|
||||||
|
|
||||||
@@ -23,12 +24,16 @@ function ItemPreferencesFormPage({
|
|||||||
}) {
|
}) {
|
||||||
const { saveSettingMutate } = useItemPreferencesFormContext();
|
const { saveSettingMutate } = useItemPreferencesFormContext();
|
||||||
|
|
||||||
|
const itemPerferencesSettings = {
|
||||||
|
...omit(itemsSettings, ['tableSize']),
|
||||||
|
};
|
||||||
|
|
||||||
// Initial values.
|
// Initial values.
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
preferred_sell_account: '',
|
preferred_sell_account: '',
|
||||||
preferred_cost_account: '',
|
preferred_cost_account: '',
|
||||||
preferred_inventory_account: '',
|
preferred_inventory_account: '',
|
||||||
...transformGeneralSettings(itemsSettings),
|
...transformGeneralSettings(itemPerferencesSettings),
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -37,8 +42,10 @@ function ItemPreferencesFormPage({
|
|||||||
|
|
||||||
// Handle form submit.
|
// Handle form submit.
|
||||||
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
|
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
|
||||||
const options = optionsMapToArray(values)
|
const options = optionsMapToArray(values).map((option) => ({
|
||||||
.map((option) => ({ ...option, group: 'items' }));
|
...option,
|
||||||
|
group: 'items',
|
||||||
|
}));
|
||||||
|
|
||||||
const onSuccess = () => {
|
const onSuccess = () => {
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
|
|||||||
Reference in New Issue
Block a user