mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
fix(webapp): code cleanup
This commit is contained in:
@@ -4,6 +4,7 @@ import { FastField } from 'formik';
|
||||
import ItemsEntriesTable from '@/containers/Entries/ItemsEntriesTable';
|
||||
import { useInvoiceFormContext } from './InvoiceFormProvider';
|
||||
import { entriesFieldShouldUpdate } from './utils';
|
||||
import { TaxType } from '@/interfaces/TaxRates';
|
||||
|
||||
/**
|
||||
* Invoice items entries editor field.
|
||||
@@ -33,7 +34,7 @@ export default function InvoiceItemsEntriesEditorField() {
|
||||
errors={error}
|
||||
linesNumber={4}
|
||||
currencyCode={values.currency_code}
|
||||
isInclusiveTax={values.inclusive_exclusive_tax === 'inclusive'}
|
||||
isInclusiveTax={values.inclusive_exclusive_tax === TaxType.Inclusive}
|
||||
/>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
import { TaxType } from '@/interfaces/TaxRates';
|
||||
|
||||
export const InclusiveButtonOptions = [
|
||||
{ key: 'inclusive', label: 'Inclusive of Tax' },
|
||||
{ key: 'exclusive', label: 'Exclusive of Tax' },
|
||||
{ key: TaxType.Inclusive, label: 'Inclusive of Tax' },
|
||||
{ key: TaxType.Exclusive, label: 'Exclusive of Tax' },
|
||||
];
|
||||
|
||||
@@ -46,7 +46,7 @@ export const defaultInvoice = {
|
||||
due_date: moment().format('YYYY-MM-DD'),
|
||||
delivered: '',
|
||||
invoice_no: '',
|
||||
inclusive_exclusive_tax: 'inclusive',
|
||||
inclusive_exclusive_tax: TaxType.Inclusive,
|
||||
// Holds the invoice number that entered manually only.
|
||||
invoice_no_manually: '',
|
||||
reference_no: '',
|
||||
@@ -172,8 +172,10 @@ export function transformValueToRequest(values) {
|
||||
...(values.invoice_no_manually && {
|
||||
invoice_no: values.invoice_no,
|
||||
}),
|
||||
is_inclusive_tax: values.inclusive_exclusive_tax === 'inclusive',
|
||||
entries: entries.map((entry) => ({ ...omit(entry, ['amount']) })),
|
||||
is_inclusive_tax: values.inclusive_exclusive_tax === TaxType.Inclusive,
|
||||
entries: entries.map((entry) => ({
|
||||
...omit(entry, ['amount', 'tax_amount', 'tax_rate']),
|
||||
})),
|
||||
delivered: false,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user