mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
feat: assign default sell/purchase tax rates to items (#261)
This commit is contained in:
@@ -29,14 +29,16 @@ import {
|
||||
costPriceFieldShouldUpdate,
|
||||
costAccountFieldShouldUpdate,
|
||||
purchaseDescFieldShouldUpdate,
|
||||
taxRateFieldShouldUpdate,
|
||||
} from './utils';
|
||||
import { compose, inputIntent } from '@/utils';
|
||||
import { TaxRatesSelect } from '@/components/TaxRates/TaxRatesSelect';
|
||||
|
||||
/**
|
||||
* Item form body.
|
||||
*/
|
||||
function ItemFormBody({ organization: { base_currency } }) {
|
||||
const { accounts } = useItemFormContext();
|
||||
const { accounts, taxRates } = useItemFormContext();
|
||||
const { values } = useFormikContext();
|
||||
|
||||
return (
|
||||
@@ -111,7 +113,20 @@ function ItemFormBody({ organization: { base_currency } }) {
|
||||
filterByParentTypes={[ACCOUNT_PARENT_TYPE.INCOME]}
|
||||
fill={true}
|
||||
allowCreate={true}
|
||||
fastField={true}
|
||||
fastField={true}
|
||||
/>
|
||||
</FFormGroup>
|
||||
|
||||
{/*------------- Sell Tax Rate ------------- */}
|
||||
<FFormGroup
|
||||
name={'sell_tax_rate_id'}
|
||||
label={'Tax Rate'}
|
||||
inline={true}
|
||||
>
|
||||
<TaxRatesSelect
|
||||
name={'sell_tax_rate_id'}
|
||||
items={taxRates}
|
||||
allowCreate
|
||||
/>
|
||||
</FFormGroup>
|
||||
|
||||
@@ -213,6 +228,24 @@ function ItemFormBody({ organization: { base_currency } }) {
|
||||
/>
|
||||
</FFormGroup>
|
||||
|
||||
{/*------------- Purchase Tax Rate ------------- */}
|
||||
<FFormGroup
|
||||
name={'purchase_tax_rate_id'}
|
||||
label={'Tax Rate'}
|
||||
inline={true}
|
||||
fastField={true}
|
||||
shouldUpdateDeps={{ taxRates }}
|
||||
shouldUpdate={taxRateFieldShouldUpdate}
|
||||
>
|
||||
<TaxRatesSelect
|
||||
name={'purchase_tax_rate_id'}
|
||||
items={taxRates}
|
||||
allowCreate={true}
|
||||
fastField={true}
|
||||
shouldUpdateDeps={{ taxRates }}
|
||||
/>
|
||||
</FFormGroup>
|
||||
|
||||
<FastField
|
||||
name={'purchase_description'}
|
||||
purchasable={values.purchasable}
|
||||
|
||||
Reference in New Issue
Block a user