mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
chrone: sperate client and server to different repos.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import React, { createContext, useContext } from 'react';
|
||||
|
||||
import { useAccounts } from 'hooks/query';
|
||||
import { FinancialHeaderLoadingSkeleton } from '../FinancialHeaderLoadingSkeleton';
|
||||
|
||||
const GLHeaderGeneralPanelContext = createContext();
|
||||
|
||||
/**
|
||||
* General ledger provider.
|
||||
*/
|
||||
function GLHeaderGeneralPanelProvider({ ...props }) {
|
||||
// Accounts list.
|
||||
const { data: accounts, isLoading: isAccountsLoading } = useAccounts();
|
||||
|
||||
// Provider
|
||||
const provider = {
|
||||
accounts,
|
||||
isAccountsLoading,
|
||||
};
|
||||
|
||||
const loading = isAccountsLoading;
|
||||
|
||||
return loading ? (
|
||||
<FinancialHeaderLoadingSkeleton />
|
||||
) : (
|
||||
<GLHeaderGeneralPanelContext.Provider value={provider} {...props} />
|
||||
);
|
||||
}
|
||||
|
||||
const useGLGeneralPanelContext = () => useContext(GLHeaderGeneralPanelContext);
|
||||
|
||||
export { GLHeaderGeneralPanelProvider, useGLGeneralPanelContext };
|
||||
@@ -0,0 +1,91 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import moment from 'moment';
|
||||
|
||||
import 'style/pages/FinancialStatements/GeneralLedger.scss';
|
||||
|
||||
import GeneralLedgerTable from './GeneralLedgerTable';
|
||||
import GeneralLedgerHeader from './GeneralLedgerHeader';
|
||||
|
||||
import DashboardPageContent from 'components/Dashboard/DashboardPageContent';
|
||||
import GeneralLedgerActionsBar from './GeneralLedgerActionsBar';
|
||||
import { GeneralLedgerProvider } from './GeneralLedgerProvider';
|
||||
import {
|
||||
GeneralLedgerSheetAlerts,
|
||||
GeneralLedgerSheetLoadingBar,
|
||||
} from './components';
|
||||
|
||||
import withGeneralLedgerActions from './withGeneralLedgerActions';
|
||||
import withCurrentOrganization from '../../Organization/withCurrentOrganization';
|
||||
|
||||
import { transformFilterFormToQuery } from 'containers/FinancialStatements/common';
|
||||
import { compose } from 'utils';
|
||||
|
||||
/**
|
||||
* General Ledger (GL) sheet.
|
||||
*/
|
||||
function GeneralLedger({
|
||||
// #withGeneralLedgerActions
|
||||
toggleGeneralLedgerFilterDrawer,
|
||||
|
||||
// #withSettings
|
||||
organizationName,
|
||||
}) {
|
||||
const [filter, setFilter] = useState({
|
||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
||||
basis: 'accural',
|
||||
accountsFilter: 'with-transactions',
|
||||
});
|
||||
|
||||
// Handle financial statement filter change.
|
||||
const handleFilterSubmit = useCallback(
|
||||
(filter) => {
|
||||
const parsedFilter = {
|
||||
...filter,
|
||||
fromDate: moment(filter.fromDate).format('YYYY-MM-DD'),
|
||||
toDate: moment(filter.toDate).format('YYYY-MM-DD'),
|
||||
};
|
||||
setFilter(parsedFilter);
|
||||
},
|
||||
[setFilter],
|
||||
);
|
||||
|
||||
// Hide the filter drawer once the page unmount.
|
||||
React.useEffect(
|
||||
() => () => {
|
||||
toggleGeneralLedgerFilterDrawer(false);
|
||||
},
|
||||
[toggleGeneralLedgerFilterDrawer],
|
||||
);
|
||||
|
||||
return (
|
||||
<GeneralLedgerProvider query={transformFilterFormToQuery(filter)}>
|
||||
<GeneralLedgerActionsBar />
|
||||
|
||||
<DashboardPageContent>
|
||||
<div class="financial-statement financial-statement--general-ledger">
|
||||
<GeneralLedgerHeader
|
||||
pageFilter={filter}
|
||||
onSubmitFilter={handleFilterSubmit}
|
||||
/>
|
||||
<GeneralLedgerSheetLoadingBar />
|
||||
<GeneralLedgerSheetAlerts />
|
||||
|
||||
<div class="financial-statement__body">
|
||||
<GeneralLedgerTable
|
||||
companyName={organizationName}
|
||||
generalLedgerQuery={filter}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</DashboardPageContent>
|
||||
</GeneralLedgerProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withGeneralLedgerActions,
|
||||
withCurrentOrganization(({ organization }) => ({
|
||||
organizationName: organization.name,
|
||||
})),
|
||||
)(GeneralLedger);
|
||||
@@ -0,0 +1,104 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
NavbarGroup,
|
||||
Button,
|
||||
Classes,
|
||||
NavbarDivider,
|
||||
Popover,
|
||||
PopoverInteractionKind,
|
||||
Position,
|
||||
} from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import Icon from 'components/Icon';
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
|
||||
import withGeneralLedger from './withGeneralLedger';
|
||||
import withGeneralLedgerActions from './withGeneralLedgerActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
import { useGeneralLedgerContext } from './GeneralLedgerProvider';
|
||||
|
||||
/**
|
||||
* General ledger - Actions bar.
|
||||
*/
|
||||
function GeneralLedgerActionsBar({
|
||||
// #withGeneralLedger
|
||||
isFilterDrawerOpen,
|
||||
|
||||
// #withGeneralLedgerActions
|
||||
toggleGeneralLedgerFilterDrawer: toggleDisplayFilterDrawer,
|
||||
}) {
|
||||
const { sheetRefresh } = useGeneralLedgerContext();
|
||||
|
||||
// Handle customize button click.
|
||||
const handleCustomizeClick = () => {
|
||||
toggleDisplayFilterDrawer();
|
||||
};
|
||||
|
||||
// Handle re-calculate button click.
|
||||
const handleRecalcReport = () => {
|
||||
sheetRefresh();
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
<NavbarGroup>
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--gray-highlight')}
|
||||
text={<T id={'recalc_report'} />}
|
||||
onClick={handleRecalcReport}
|
||||
icon={<Icon icon="refresh-16" iconSize={16} />}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--table-views')}
|
||||
icon={<Icon icon="cog-16" iconSize={16} />}
|
||||
text={
|
||||
isFilterDrawerOpen ? (
|
||||
<T id={'hide_customizer'} />
|
||||
) : (
|
||||
<T id={'customize_report'} />
|
||||
)
|
||||
}
|
||||
onClick={handleCustomizeClick}
|
||||
active={isFilterDrawerOpen}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
|
||||
<Popover
|
||||
interactionKind={PopoverInteractionKind.CLICK}
|
||||
position={Position.BOTTOM_LEFT}
|
||||
>
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--filter')}
|
||||
text={<T id={'filter'} />}
|
||||
icon={<Icon icon="filter-16" iconSize={16} />}
|
||||
/>
|
||||
</Popover>
|
||||
|
||||
<NavbarDivider />
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="print-16" iconSize={16} />}
|
||||
text={<T id={'print'} />}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="file-export-16" iconSize={16} />}
|
||||
text={<T id={'export'} />}
|
||||
/>
|
||||
</NavbarGroup>
|
||||
</DashboardActionsBar>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withGeneralLedger(({ generalLedgerFilterDrawer }) => ({
|
||||
isFilterDrawerOpen: generalLedgerFilterDrawer,
|
||||
})),
|
||||
withGeneralLedgerActions,
|
||||
)(GeneralLedgerActionsBar);
|
||||
@@ -0,0 +1,109 @@
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
import * as Yup from 'yup';
|
||||
import { Formik, Form } from 'formik';
|
||||
import { Tabs, Tab, Button, Intent } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
import FinancialStatementHeader from 'containers/FinancialStatements/FinancialStatementHeader';
|
||||
import GeneralLedgerHeaderGeneralPane from './GeneralLedgerHeaderGeneralPane';
|
||||
|
||||
import withGeneralLedger from './withGeneralLedger';
|
||||
import withGeneralLedgerActions from './withGeneralLedgerActions';
|
||||
|
||||
import { compose, transformToForm, saveInvoke } from 'utils';
|
||||
|
||||
/**
|
||||
* Geenral Ledger (GL) - Header.
|
||||
*/
|
||||
function GeneralLedgerHeader({
|
||||
// #ownProps
|
||||
onSubmitFilter,
|
||||
pageFilter,
|
||||
|
||||
// #withGeneralLedgerActions
|
||||
toggleGeneralLedgerFilterDrawer: toggleDisplayFilterDrawer,
|
||||
|
||||
// #withGeneralLedger
|
||||
isFilterDrawerOpen,
|
||||
}) {
|
||||
// Default values.
|
||||
const defaultValues = {
|
||||
fromDate: moment().toDate(),
|
||||
toDate: moment().toDate(),
|
||||
};
|
||||
|
||||
// Initial values.
|
||||
const initialValues = transformToForm(
|
||||
{
|
||||
...pageFilter,
|
||||
fromDate: moment(pageFilter.fromDate).toDate(),
|
||||
toDate: moment(pageFilter.toDate).toDate(),
|
||||
},
|
||||
defaultValues,
|
||||
);
|
||||
|
||||
// Validation schema.
|
||||
const validationSchema = Yup.object().shape({
|
||||
dateRange: Yup.string().optional(),
|
||||
fromDate: Yup.date().required(),
|
||||
toDate: Yup.date().min(Yup.ref('fromDate')).required(),
|
||||
});
|
||||
|
||||
// Handle form submit.
|
||||
const handleSubmit = (values, { setSubmitting }) => {
|
||||
saveInvoke(onSubmitFilter, values);
|
||||
toggleDisplayFilterDrawer();
|
||||
setSubmitting(false);
|
||||
};
|
||||
|
||||
// Handle cancel button click.
|
||||
const handleCancelClick = () => {
|
||||
toggleDisplayFilterDrawer(false);
|
||||
};
|
||||
|
||||
// Handle drawer close action.
|
||||
const handleDrawerClose = () => {
|
||||
toggleDisplayFilterDrawer(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<FinancialStatementHeader
|
||||
isOpen={isFilterDrawerOpen}
|
||||
drawerProps={{ onClose: handleDrawerClose }}
|
||||
>
|
||||
<Formik
|
||||
validationSchema={validationSchema}
|
||||
initialValues={initialValues}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
<Form>
|
||||
<Tabs animate={true} vertical={true} renderActiveTabPanelOnly={true}>
|
||||
<Tab
|
||||
id="general"
|
||||
title={<T id={'general'} />}
|
||||
panel={<GeneralLedgerHeaderGeneralPane />}
|
||||
/>
|
||||
</Tabs>
|
||||
|
||||
<div class="financial-header-drawer__footer">
|
||||
<Button className={'mr1'} intent={Intent.PRIMARY} type={'submit'}>
|
||||
<T id={'calculate_report'} />
|
||||
</Button>
|
||||
|
||||
<Button onClick={handleCancelClick} minimal={true}>
|
||||
<T id={'cancel'} />
|
||||
</Button>
|
||||
</div>
|
||||
</Form>
|
||||
</Formik>
|
||||
</FinancialStatementHeader>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withGeneralLedger(({ generalLedgerFilterDrawer }) => ({
|
||||
isFilterDrawerOpen: generalLedgerFilterDrawer,
|
||||
})),
|
||||
withGeneralLedgerActions,
|
||||
)(GeneralLedgerHeader);
|
||||
@@ -0,0 +1,54 @@
|
||||
import React from 'react';
|
||||
import { FormGroup, Classes } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { AccountsMultiSelect, Row, Col } from 'components';
|
||||
|
||||
import FinancialStatementDateRange from 'containers/FinancialStatements/FinancialStatementDateRange';
|
||||
import RadiosAccountingBasis from '../RadiosAccountingBasis';
|
||||
import FinancialAccountsFilter from '../FinancialAccountsFilter';
|
||||
import { GLHeaderGeneralPanelProvider } from './GLHeaderGeneralPaneProvider';
|
||||
|
||||
import { filterAccountsOptions } from './common';
|
||||
import { useGLGeneralPanelContext } from './GLHeaderGeneralPaneProvider';
|
||||
|
||||
/**
|
||||
* General ledger (GL) - Header - General panel.
|
||||
*/
|
||||
export default function GLHeaderGeneralPane() {
|
||||
return (
|
||||
<GLHeaderGeneralPanelProvider>
|
||||
<GLHeaderGeneralPaneContent />
|
||||
</GLHeaderGeneralPanelProvider>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* General ledger (GL) - Header - General panel - content.
|
||||
*/
|
||||
function GLHeaderGeneralPaneContent() {
|
||||
const { accounts } = useGLGeneralPanelContext();
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<FinancialStatementDateRange />
|
||||
<FinancialAccountsFilter
|
||||
items={filterAccountsOptions}
|
||||
initialSelectedItem={'all-accounts'}
|
||||
/>
|
||||
<Row>
|
||||
<Col xs={4}>
|
||||
<FormGroup
|
||||
label={<T id={'specific_accounts'} />}
|
||||
className={classNames('form-group--select-list', Classes.FILL)}
|
||||
>
|
||||
<AccountsMultiSelect items={accounts} />
|
||||
</FormGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<RadiosAccountingBasis key={'basis'} />
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import React, { createContext, useContext } from 'react';
|
||||
import FinancialReportPage from '../FinancialReportPage';
|
||||
import { useGeneralLedgerSheet, useAccounts } from 'hooks/query';
|
||||
|
||||
const GeneralLedgerContext = createContext();
|
||||
|
||||
/**
|
||||
* General ledger provider.
|
||||
*/
|
||||
function GeneralLedgerProvider({ query, ...props }) {
|
||||
const {
|
||||
data: generalLedger,
|
||||
isFetching,
|
||||
isLoading,
|
||||
refetch,
|
||||
} = useGeneralLedgerSheet(query, { keepPreviousData: true });
|
||||
|
||||
const provider = {
|
||||
generalLedger,
|
||||
sheetRefresh: refetch,
|
||||
isFetching,
|
||||
isLoading,
|
||||
};
|
||||
return (
|
||||
<FinancialReportPage name={'general-ledger-sheet'}>
|
||||
<GeneralLedgerContext.Provider value={provider} {...props} />
|
||||
</FinancialReportPage>
|
||||
);
|
||||
}
|
||||
|
||||
const useGeneralLedgerContext = () => useContext(GeneralLedgerContext);
|
||||
|
||||
export { GeneralLedgerProvider, useGeneralLedgerContext };
|
||||
@@ -0,0 +1,65 @@
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { defaultExpanderReducer } from 'utils';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
import FinancialSheet from 'components/FinancialSheet';
|
||||
import DataTable from 'components/DataTable';
|
||||
import TableVirtualizedListRows from 'components/Datatable/TableVirtualizedRows';
|
||||
import TableFastCell from 'components/Datatable/TableFastCell';
|
||||
|
||||
import { useGeneralLedgerContext } from './GeneralLedgerProvider';
|
||||
import { useGeneralLedgerTableColumns } from './components';
|
||||
|
||||
/**
|
||||
* General ledger table.
|
||||
*/
|
||||
export default function GeneralLedgerTable({ companyName }) {
|
||||
// General ledger context.
|
||||
const {
|
||||
generalLedger: { tableRows, query },
|
||||
isLoading,
|
||||
} = useGeneralLedgerContext();
|
||||
|
||||
// General ledger table columns.
|
||||
const columns = useGeneralLedgerTableColumns();
|
||||
|
||||
// Default expanded rows of general ledger table.
|
||||
const expandedRows = useMemo(() => defaultExpanderReducer(tableRows, 1), [
|
||||
tableRows,
|
||||
]);
|
||||
|
||||
const rowClassNames = (row) => [`row-type--${row.original.rowType}`];
|
||||
|
||||
return (
|
||||
<FinancialSheet
|
||||
companyName={companyName}
|
||||
sheetType={intl.get('general_ledger_sheet')}
|
||||
fromDate={query.from_date}
|
||||
toDate={query.to_date}
|
||||
name="general-ledger"
|
||||
loading={isLoading}
|
||||
fullWidth={true}
|
||||
>
|
||||
<DataTable
|
||||
className="bigcapital-datatable--financial-report"
|
||||
noResults={intl.get('this_report_does_not_contain_any_data_between_date_period')}
|
||||
columns={columns}
|
||||
data={tableRows}
|
||||
rowClassNames={rowClassNames}
|
||||
expanded={expandedRows}
|
||||
virtualizedRows={true}
|
||||
fixedItemSize={30}
|
||||
fixedSizeHeight={1000}
|
||||
expandable={true}
|
||||
expandToggleColumn={1}
|
||||
sticky={true}
|
||||
TableRowsRenderer={TableVirtualizedListRows}
|
||||
// #TableVirtualizedListRows props.
|
||||
vListrowHeight={28}
|
||||
vListOverscanRowCount={0}
|
||||
TableCellRenderer={TableFastCell}
|
||||
/>
|
||||
</FinancialSheet>
|
||||
);
|
||||
}
|
||||
14
src/containers/FinancialStatements/GeneralLedger/common.js
Normal file
14
src/containers/FinancialStatements/GeneralLedger/common.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
export const filterAccountsOptions = [
|
||||
{
|
||||
key: 'all-accounts',
|
||||
name: intl.get('all_accounts'),
|
||||
hint: intl.get('all_accounts_including_with_zero_balance'),
|
||||
},
|
||||
{
|
||||
key: 'with-transactions',
|
||||
name: intl.get('accounts_with_transactions'),
|
||||
hint: intl.get('include_accounts_once_has_transactions_on_given_date_period'),
|
||||
},
|
||||
];
|
||||
151
src/containers/FinancialStatements/GeneralLedger/components.js
Normal file
151
src/containers/FinancialStatements/GeneralLedger/components.js
Normal file
@@ -0,0 +1,151 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Button } from '@blueprintjs/core';
|
||||
import { Icon, If } from 'components';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
import { getForceWidth, getColumnWidth } from 'utils';
|
||||
import { useGeneralLedgerContext } from './GeneralLedgerProvider';
|
||||
import FinancialLoadingBar from '../FinancialLoadingBar';
|
||||
|
||||
/**
|
||||
* Retrieve the general ledger table columns.
|
||||
*/
|
||||
export function useGeneralLedgerTableColumns() {
|
||||
// General ledger context.
|
||||
const {
|
||||
generalLedger: { tableRows },
|
||||
} = useGeneralLedgerContext();
|
||||
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
Header: intl.get('date'),
|
||||
accessor: (row) => {
|
||||
if (row.rowType === 'ACCOUNT_ROW') {
|
||||
return (
|
||||
<span
|
||||
className={'force-width'}
|
||||
style={{ minWidth: getForceWidth(row.date) }}
|
||||
>
|
||||
{row.date}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return row.date;
|
||||
},
|
||||
className: 'date',
|
||||
textOverview: true,
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
Header: intl.get('account_name'),
|
||||
accessor: 'name',
|
||||
className: 'name',
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('transaction_type'),
|
||||
accessor: 'reference_type_formatted',
|
||||
className: 'transaction_type',
|
||||
width: 125,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('transaction_number'),
|
||||
accessor: 'reference_id',
|
||||
className: 'transaction_number',
|
||||
width: 100,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('description'),
|
||||
accessor: 'note',
|
||||
className: 'description',
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('credit'),
|
||||
accessor: 'formatted_credit',
|
||||
className: 'credit',
|
||||
width: getColumnWidth(tableRows, 'formatted_credit', {
|
||||
minWidth: 100,
|
||||
magicSpacing: 10,
|
||||
}),
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('debit'),
|
||||
accessor: 'formatted_debit',
|
||||
className: 'debit',
|
||||
width: getColumnWidth(tableRows, 'formatted_debit', {
|
||||
minWidth: 100,
|
||||
magicSpacing: 10,
|
||||
}),
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('amount'),
|
||||
accessor: 'formatted_amount',
|
||||
className: 'amount',
|
||||
width: getColumnWidth(tableRows, 'formatted_amount', {
|
||||
minWidth: 100,
|
||||
magicSpacing: 10,
|
||||
}),
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('running_balance'),
|
||||
accessor: 'formatted_running_balance',
|
||||
className: 'running_balance',
|
||||
width: getColumnWidth(tableRows, 'formatted_running_balance', {
|
||||
minWidth: 100,
|
||||
magicSpacing: 10,
|
||||
}),
|
||||
textOverview: true,
|
||||
},
|
||||
],
|
||||
[tableRows],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* General ledger sheet alerts.
|
||||
*/
|
||||
export function GeneralLedgerSheetAlerts() {
|
||||
const { generalLedger, isLoading, sheetRefresh } = useGeneralLedgerContext();
|
||||
|
||||
// Handle refetch the report sheet.
|
||||
const handleRecalcReport = () => {
|
||||
sheetRefresh();
|
||||
};
|
||||
// Can't display any error if the report is loading.
|
||||
if (isLoading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<If condition={generalLedger.meta.is_cost_compute_running}>
|
||||
<div class="alert-compute-running">
|
||||
<Icon icon="info-block" iconSize={12} />
|
||||
<T id={'just_a_moment_we_re_calculating_your_cost_transactions'} />
|
||||
<Button onClick={handleRecalcReport} minimal={true} small={true}>
|
||||
<T id={'refresh'} />
|
||||
</Button>
|
||||
</div>
|
||||
</If>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* General ledger sheet loading bar.
|
||||
*/
|
||||
export function GeneralLedgerSheetLoadingBar() {
|
||||
const { isFetching } = useGeneralLedgerContext();
|
||||
|
||||
return (
|
||||
<If condition={isFetching}>
|
||||
<FinancialLoadingBar />
|
||||
</If>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
getGeneralLedgerFilterDrawer
|
||||
} from 'store/financialStatement/financialStatements.selectors';
|
||||
|
||||
export default (mapState) => {
|
||||
const mapStateToProps = (state, props) => {
|
||||
const mapped = {
|
||||
generalLedgerFilterDrawer: getGeneralLedgerFilterDrawer(state, props),
|
||||
};
|
||||
return mapState ? mapState(mapped, state, props) : mapped;
|
||||
};
|
||||
return connect(mapStateToProps);
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
toggleGeneralLedgerFilterDrawer,
|
||||
} from 'store/financialStatement/financialStatements.actions';
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
toggleGeneralLedgerFilterDrawer: (toggle) =>
|
||||
dispatch(toggleGeneralLedgerFilterDrawer(toggle)),
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps);
|
||||
Reference in New Issue
Block a user