mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
- Fix typo ONWERS_DRAWING -> OWNERS_DRAWING in server constants - Change OwnerDrawing -> owner_drawing for consistency in webapp - Fix typo TRANSACRIONS_TYPE -> TRANSACTIONS_TYPE - Fix typo OnwersDrawing -> OwnerDrawing - Add missing Icon and FDateInput imports - Add dark mode styling for BranchRowDivider Co-Authored-By: Claude Code <noreply@anthropic.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
// @ts-nocheck
|
|
import React, { useMemo } from 'react';
|
|
import { useFormikContext } from 'formik';
|
|
|
|
import OtherExpnseFormFields from './OtherExpense/OtherExpnseFormFields';
|
|
import OwnerDrawingsFormFields from './OwnerDrawings/OwnerDrawingsFormFields';
|
|
import TransferToAccountFormFields from './TransferToAccount/TransferToAccountFormFields';
|
|
import { MoneyOutFieldsProvider } from './MoneyOutFieldsProvider';
|
|
|
|
/**
|
|
* Money out content fields.
|
|
* Switches between form fields based on the given transaction type.
|
|
* @returns {JSX.Element}
|
|
*/
|
|
function MoneyOutContentFields() {
|
|
const { values } = useFormikContext();
|
|
|
|
const transactionType = useMemo(() => {
|
|
switch (values.transaction_type) {
|
|
case 'owner_drawing':
|
|
return <OwnerDrawingsFormFields />;
|
|
|
|
case 'other_expense':
|
|
return <OtherExpnseFormFields />;
|
|
|
|
case 'transfer_to_account':
|
|
return <TransferToAccountFormFields />;
|
|
default:
|
|
break;
|
|
}
|
|
}, [values.transaction_type]);
|
|
|
|
// Cannot continue if transaction type or account is not selected.
|
|
if (!values.transaction_type || !values.cashflow_account_id) return null;
|
|
|
|
return <MoneyOutFieldsProvider>{transactionType}</MoneyOutFieldsProvider>;
|
|
}
|
|
|
|
export default MoneyOutContentFields;
|