// @ts-nocheck import { useRef } from 'react'; import intl from 'react-intl-universal'; import * as R from 'ramda'; import { Button } from '@blueprintjs/core'; import { useFormikContext } from 'formik'; import { ExchangeRateInputGroup } from '@/components'; import { useCurrentOrganization } from '@/hooks/state'; import { useInvoiceIsForeignCustomer, useInvoiceTotal } from './utils'; import withSettings from '@/containers/Settings/withSettings'; import { useUpdateEffect } from '@/hooks'; import { transactionNumber } from '@/utils'; import withDialogActions from '@/containers/Dialog/withDialogActions'; import { DialogsName } from '@/constants/dialogs'; import { useSyncExRateToForm, withExchangeRateFetchingLoading, withExchangeRateItemEntriesPriceRecalc, } from '@/containers/Entries/withExRateItemEntriesPriceRecalc'; /** * Invoice exchange rate input field. * @returns {JSX.Element} */ const InvoiceExchangeRateInputFieldRoot = ({ ...props }) => { const currentOrganization = useCurrentOrganization(); const { values } = useFormikContext(); const isForeignCustomer = useInvoiceIsForeignCustomer(); // Can't continue if the customer is not foreign. if (!isForeignCustomer) { return null; } return ( ); }; /** * Invoice exchange rate input field. * @returns {JSX.Element} */ export const InvoiceExchangeRateInputField = R.compose( withExchangeRateFetchingLoading, withExchangeRateItemEntriesPriceRecalc, )(InvoiceExchangeRateInputFieldRoot); /** * Invoice project select. * @returns {JSX.Element} */ export function InvoiceProjectSelectButton({ label }) { return