mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
fix: update financial forms to use new formatted amount utilities and add adjustment fields
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import { useFormikContext } from 'formik';
|
||||
import EstimateNumberDialog from '@/containers/Dialogs/EstimateNumberDialog';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
// @ts-nocheck
|
||||
import React, { useMemo } from 'react';
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { useFormikContext } from 'formik';
|
||||
import { x } from '@xstyled/emotion';
|
||||
|
||||
import EstimateFormHeaderFields from './EstimateFormHeaderFields';
|
||||
import { getEntriesTotal } from '@/containers/Entries/utils';
|
||||
import { Group, PageFormBigNumber } from '@/components';
|
||||
import { useEstimateTotalFormatted } from './utils';
|
||||
|
||||
// Estimate form top header.
|
||||
function EstimateFormHeader() {
|
||||
@@ -29,19 +27,10 @@ function EstimateFormHeader() {
|
||||
* @returns {React.ReactNode}
|
||||
*/
|
||||
function EstimateFormBigTotal() {
|
||||
const {
|
||||
values: { entries, currency_code },
|
||||
} = useFormikContext();
|
||||
|
||||
// Calculate the total due amount of bill entries.
|
||||
const totalDueAmount = useMemo(() => getEntriesTotal(entries), [entries]);
|
||||
const totalFormatted = useEstimateTotalFormatted();
|
||||
|
||||
return (
|
||||
<PageFormBigNumber
|
||||
label={intl.get('amount')}
|
||||
amount={totalDueAmount}
|
||||
currencyCode={currency_code}
|
||||
/>
|
||||
<PageFormBigNumber label={intl.get('amount')} amount={totalFormatted} />
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -245,6 +245,7 @@ export const useEstimateSubtotalFormatted = () => {
|
||||
*/
|
||||
export const useEstimateDiscount = () => {
|
||||
const { values } = useFormikContext();
|
||||
const subtotal = useEstimateSubtotal();
|
||||
const discount = toSafeNumber(values.discount);
|
||||
|
||||
return values?.discount_type === 'percentage'
|
||||
|
||||
Reference in New Issue
Block a user