import React, { useMemo, useCallback } from 'react'; import moment from 'moment'; import classnames from 'classnames'; import LoadingIndicator from 'components/LoadingIndicator'; import { FormattedMessage as T, useIntl } from 'react-intl'; export default function FinancialSheet({ companyName, sheetType, fromDate, toDate, children, accountingBasis, name, loading, className, basis, }) { const formattedFromDate = moment(fromDate).format('DD MMMM YYYY'); const formattedToDate = moment(toDate).format('DD MMMM YYYY'); const nameModifer = name ? `financial-sheet--${name}` : ''; const { formatMessage } = useIntl(); const methodsLabels = useMemo( () => ({ cash: formatMessage({id:'cash'}), accrual: formatMessage({id:'accrual'}), }), [] ); const getBasisLabel = useCallback((b) => methodsLabels[b], [methodsLabels]); const basisLabel = useMemo(() => getBasisLabel(basis), [ getBasisLabel, basis, ]); return (