mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
Merge pull request #159 from bigcapitalhq/abouhuolia/big-24-adjustment-type-options-do-not-show-up-2
fix(webapp): adjustment type options do not show up
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
import intl from 'react-intl-universal';
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{ name: intl.get('decrement'), value: 'decrement' },
|
|
||||||
{ name: intl.get('increment'), value: 'increment' },
|
|
||||||
]
|
|
||||||
@@ -4,7 +4,6 @@ export * from './tableStyle';
|
|||||||
export * from './features';
|
export * from './features';
|
||||||
export * from './cellTypes';
|
export * from './cellTypes';
|
||||||
export * from './classes';
|
export * from './classes';
|
||||||
export * from './adjustmentType';
|
|
||||||
export * from './cashflowOptions';
|
export * from './cashflowOptions';
|
||||||
|
|
||||||
export const Align = { Left: 'left', Right: 'right', Center: 'center' };
|
export const Align = { Left: 'left', Right: 'right', Center: 'center' };
|
||||||
|
|||||||
@@ -34,16 +34,17 @@ import {
|
|||||||
toSafeNumber,
|
toSafeNumber,
|
||||||
} from '@/utils';
|
} from '@/utils';
|
||||||
import { Features, CLASSES } from '@/constants';
|
import { Features, CLASSES } from '@/constants';
|
||||||
import adjustmentType from '@/constants/adjustmentType';
|
|
||||||
|
|
||||||
import { useInventoryAdjContext } from './InventoryAdjustmentFormProvider';
|
import { useInventoryAdjContext } from './InventoryAdjustmentFormProvider';
|
||||||
|
import { useFeatureCan } from '@/hooks/state';
|
||||||
|
|
||||||
|
import InventoryAdjustmentQuantityFields from './InventoryAdjustmentQuantityFields';
|
||||||
import {
|
import {
|
||||||
diffQuantity,
|
diffQuantity,
|
||||||
useSetPrimaryBranchToForm,
|
useSetPrimaryBranchToForm,
|
||||||
useSetPrimaryWarehouseToForm,
|
useSetPrimaryWarehouseToForm,
|
||||||
|
useGetAdjustmentTypeOptions,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import { useFeatureCan } from '@/hooks/state';
|
|
||||||
import InventoryAdjustmentQuantityFields from './InventoryAdjustmentQuantityFields';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inventory adjustment form dialogs fields.
|
* Inventory adjustment form dialogs fields.
|
||||||
@@ -52,6 +53,9 @@ export default function InventoryAdjustmentFormDialogFields() {
|
|||||||
// Features guard.
|
// Features guard.
|
||||||
const { featureCan } = useFeatureCan();
|
const { featureCan } = useFeatureCan();
|
||||||
|
|
||||||
|
// Retrieves memorized adjustment types options.
|
||||||
|
const adjustmentTypes = useGetAdjustmentTypeOptions();
|
||||||
|
|
||||||
const dateFieldRef = useAutofocus();
|
const dateFieldRef = useAutofocus();
|
||||||
|
|
||||||
// Inventory adjustment dialog context.
|
// Inventory adjustment dialog context.
|
||||||
@@ -149,7 +153,7 @@ export default function InventoryAdjustmentFormDialogFields() {
|
|||||||
className={classNames(CLASSES.FILL, 'form-group--type')}
|
className={classNames(CLASSES.FILL, 'form-group--type')}
|
||||||
>
|
>
|
||||||
<ListSelect
|
<ListSelect
|
||||||
items={adjustmentType}
|
items={adjustmentTypes}
|
||||||
onItemSelect={(type) => {
|
onItemSelect={(type) => {
|
||||||
const result = diffQuantity(
|
const result = diffQuantity(
|
||||||
toSafeNumber(values.quantity),
|
toSafeNumber(values.quantity),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React, { useMemo } from 'react';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
import { useFormikContext } from 'formik';
|
import { useFormikContext } from 'formik';
|
||||||
import { useInventoryAdjContext } from './InventoryAdjustmentFormProvider';
|
import { useInventoryAdjContext } from './InventoryAdjustmentFormProvider';
|
||||||
import { first } from 'lodash';
|
import { first } from 'lodash';
|
||||||
@@ -48,3 +49,12 @@ export const useSetPrimaryBranchToForm = () => {
|
|||||||
}
|
}
|
||||||
}, [isBranchesSuccess, setFieldValue, branches]);
|
}, [isBranchesSuccess, setFieldValue, branches]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getAdjustmentTypeOptions = () => [
|
||||||
|
{ name: intl.get('decrement'), value: 'decrement' },
|
||||||
|
{ name: intl.get('increment'), value: 'increment' },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const useGetAdjustmentTypeOptions = () => {
|
||||||
|
return useMemo(() => getAdjustmentTypeOptions(), []);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
INVENTORY_ADJUSTMENTS_TABLE_STATE_SET: 'INVENTORY_ADJUSTMENTS/TABLE_STATE_SET',
|
INVENTORY_ADJUSTMENTS_TABLE_STATE_SET:
|
||||||
};
|
'INVENTORY_ADJUSTMENTS/TABLE_STATE_SET',
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user