mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
21 lines
547 B
TypeScript
21 lines
547 B
TypeScript
// @ts-nocheck
|
|
import React from 'react';
|
|
import { FInputGroup } from '@/components';
|
|
import { useFormikContext } from 'formik';
|
|
|
|
export function FInputGroupComponent({ toField, ...props }) {
|
|
const { values, setFieldValue } = useFormikContext();
|
|
const { expenseQuantity, expenseUnitPrice } = values;
|
|
const total = expenseQuantity * expenseUnitPrice;
|
|
|
|
const handleBlur = () => {
|
|
setFieldValue(toField, total);
|
|
};
|
|
|
|
const inputGroupProps = {
|
|
onBlur: handleBlur,
|
|
...props,
|
|
};
|
|
return <FInputGroup {...inputGroupProps} />;
|
|
}
|