mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
Merge remote-tracking branch 'origin/feature/breadcrumb/fix_localize'
This commit is contained in:
@@ -2,10 +2,11 @@ import React, { useEffect, useCallback, useState, useMemo } from 'react';
|
||||
import moment from 'moment';
|
||||
import GeneralLedgerTable from 'containers/FinancialStatements/GeneralLedger/GeneralLedgerTable';
|
||||
import { useQuery } from 'react-query';
|
||||
import { useIntl } from 'react-intl';
|
||||
|
||||
import GeneralLedgerHeader from './GeneralLedgerHeader';
|
||||
|
||||
import {compose} from 'utils';
|
||||
import { compose } from 'utils';
|
||||
|
||||
import DashboardInsider from 'components/Dashboard/DashboardInsider'
|
||||
import DashboardPageContent from 'components/Dashboard/DashboardPageContent';
|
||||
@@ -30,6 +31,7 @@ function GeneralLedger({
|
||||
// #withSettings
|
||||
organizationSettings,
|
||||
}) {
|
||||
const { formatMessage } = useIntl()
|
||||
const [filter, setFilter] = useState({
|
||||
from_date: moment().startOf('year').format('YYYY-MM-DD'),
|
||||
to_date: moment().endOf('year').format('YYYY-MM-DD'),
|
||||
@@ -40,7 +42,7 @@ function GeneralLedger({
|
||||
|
||||
// Change page title of the dashboard.
|
||||
useEffect(() => {
|
||||
changePageTitle('General Ledger');
|
||||
changePageTitle(formatMessage({id:'general_ledger'}));
|
||||
}, []);
|
||||
|
||||
const fetchAccounts = useQuery(['accounts-list'],
|
||||
@@ -74,7 +76,7 @@ function GeneralLedger({
|
||||
setRefetch(true);
|
||||
}, [setFilter]);
|
||||
|
||||
const handleFilterChanged = () => {};
|
||||
const handleFilterChanged = () => { };
|
||||
|
||||
return (
|
||||
<DashboardInsider>
|
||||
|
||||
@@ -14,6 +14,7 @@ import Icon from 'components/Icon';
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'
|
||||
import classNames from 'classnames';
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
/**
|
||||
* General ledger actions bar.
|
||||
@@ -34,7 +35,7 @@ export default function GeneralLedgerActionsBar({
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--table-views')}
|
||||
icon={<Icon icon='cog' />}
|
||||
text='Customize Report'
|
||||
text={<T id={'customize_report'}/>}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
|
||||
@@ -45,19 +46,19 @@ export default function GeneralLedgerActionsBar({
|
||||
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--filter')}
|
||||
text="Filter"
|
||||
text={<T id={'filter'}/>}
|
||||
icon={ <Icon icon="filter" /> } />
|
||||
</Popover>
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='file-export' />}
|
||||
text='Print'
|
||||
text={<T id={'print'}/>}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='file-export' />}
|
||||
text='Export'
|
||||
text={<T id={'export'}/>}
|
||||
/>
|
||||
</NavbarGroup>
|
||||
</DashboardActionsBar>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, {useState, useMemo, useEffect, useCallback} from 'react';
|
||||
import FinancialStatementHeader from 'containers/FinancialStatements/FinancialStatementHeader';
|
||||
import {useIntl} from 'react-intl';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
import {
|
||||
Button,
|
||||
FormGroup,
|
||||
@@ -19,13 +20,12 @@ import FinancialStatementDateRange from 'containers/FinancialStatements/Financia
|
||||
import * as Yup from 'yup';
|
||||
import RadiosAccountingBasis from '../RadiosAccountingBasis';
|
||||
|
||||
|
||||
function GeneralLedgerHeader({
|
||||
onSubmitFilter,
|
||||
pageFilter,
|
||||
accounts,
|
||||
}) {
|
||||
const intl = useIntl();
|
||||
const {formatMessage} = useIntl();
|
||||
|
||||
const formik = useFormik({
|
||||
enableReinitialize: true,
|
||||
@@ -64,7 +64,7 @@ function GeneralLedgerHeader({
|
||||
<Row>
|
||||
<Col sm={3}>
|
||||
<FormGroup
|
||||
label={'Specific Accounts'}
|
||||
label={<T id={'specific_accounts'}/>}
|
||||
className={classNames('form-group--select-list', Classes.FILL)}
|
||||
>
|
||||
<AccountsMultiSelect
|
||||
@@ -84,7 +84,7 @@ function GeneralLedgerHeader({
|
||||
onClick={handleSubmitClick}
|
||||
disabled={formik.isSubmitting}
|
||||
className={'button--submit-filter mt2'}>
|
||||
{ 'Calculate Report' }
|
||||
<T id={'calculate_report'}/>
|
||||
</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
defaultExpanderReducer,
|
||||
compose
|
||||
} from 'utils';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
import FinancialSheet from 'components/FinancialSheet';
|
||||
import DataTable from 'components/DataTable';
|
||||
@@ -31,9 +32,10 @@ function GeneralLedgerTable({
|
||||
generalLedgerTableRows,
|
||||
generalLedgerQuery,
|
||||
}) {
|
||||
|
||||
// Account name column accessor.
|
||||
const accountNameAccessor = useCallback((row) => {
|
||||
switch(row.rowType) {
|
||||
switch (row.rowType) {
|
||||
case ROW_TYPE.OPENING_BALANCE:
|
||||
return 'Opening Balance';
|
||||
case ROW_TYPE.CLOSING_BALANCE:
|
||||
@@ -59,32 +61,32 @@ function GeneralLedgerTable({
|
||||
const transaction = cell.row.original
|
||||
|
||||
if (transaction.rowType === ROW_TYPE.ACCOUNT) {
|
||||
return (!cell.row.isExpanded) ?
|
||||
return (!cell.row.isExpanded) ?
|
||||
(<Money amount={transaction.closing.amount} currency={"USD"} />) : '';
|
||||
}
|
||||
return (<Money amount={transaction.amount} currency={"USD"} />);
|
||||
}, []);
|
||||
|
||||
const referenceLink = useCallback((row) => {
|
||||
return (<a href="">{ row.referenceId }</a>);
|
||||
return (<a href="">{row.referenceId}</a>);
|
||||
});
|
||||
|
||||
const { formatMessage } = useIntl();
|
||||
const columns = useMemo(() => [
|
||||
{
|
||||
// Build our expander column
|
||||
id: 'expander', // Make sure it has an ID
|
||||
className: 'expander',
|
||||
className: 'expander',
|
||||
Header: ({
|
||||
getToggleAllRowsExpandedProps,
|
||||
isAllRowsExpanded
|
||||
}) => (
|
||||
<span {...getToggleAllRowsExpandedProps()} className="toggle">
|
||||
{isAllRowsExpanded ?
|
||||
(<span class="arrow-down" />) :
|
||||
(<span class="arrow-right" />)
|
||||
}
|
||||
</span>
|
||||
),
|
||||
<span {...getToggleAllRowsExpandedProps()} className="toggle">
|
||||
{isAllRowsExpanded ?
|
||||
(<span class="arrow-down" />) :
|
||||
(<span class="arrow-right" />)
|
||||
}
|
||||
</span>
|
||||
),
|
||||
Cell: ({ row }) =>
|
||||
// Use the row.canExpand and row.getToggleRowExpandedProps prop getter
|
||||
// to build the toggle for expanding a row
|
||||
@@ -110,37 +112,37 @@ function GeneralLedgerTable({
|
||||
disableResizing: true,
|
||||
},
|
||||
{
|
||||
Header: 'Account Name',
|
||||
Header: formatMessage({id:'account_name'}),
|
||||
accessor: accountNameAccessor,
|
||||
className: "name",
|
||||
},
|
||||
{
|
||||
Header: 'Date',
|
||||
Header: formatMessage({id:'date'}),
|
||||
accessor: dateAccessor,
|
||||
className: "date",
|
||||
},
|
||||
{
|
||||
Header: 'Transaction Type',
|
||||
Header: formatMessage({id:'transaction_type'}),
|
||||
accessor: 'referenceType',
|
||||
className: 'transaction_type',
|
||||
},
|
||||
{
|
||||
Header: 'Trans. NUM',
|
||||
Header: formatMessage({id:'trans_num'}),
|
||||
accessor: referenceLink,
|
||||
className: 'transaction_number'
|
||||
},
|
||||
{
|
||||
Header: 'Description',
|
||||
Header: formatMessage({id:'description'}),
|
||||
accessor: 'note',
|
||||
className: 'description',
|
||||
},
|
||||
{
|
||||
Header: 'Amount',
|
||||
Header: formatMessage({id:'amount'}),
|
||||
Cell: amountCell,
|
||||
className: 'amount'
|
||||
},
|
||||
{
|
||||
Header: 'Balance',
|
||||
Header: formatMessage({id:'balance'}),
|
||||
Cell: amountCell,
|
||||
className: 'balance',
|
||||
},
|
||||
@@ -172,7 +174,7 @@ function GeneralLedgerTable({
|
||||
expanded={expandedRows}
|
||||
virtualizedRows={true}
|
||||
fixedItemSize={37}
|
||||
fixedSizeHeight={1000} />
|
||||
fixedSizeHeight={1000} />
|
||||
</FinancialSheet>
|
||||
);
|
||||
}
|
||||
@@ -201,4 +203,4 @@ export default compose(
|
||||
generalLedgerSheetLoading,
|
||||
generalLedgerQuery
|
||||
})),
|
||||
)(GeneralLedgerTable);
|
||||
)(GeneralLedgerTable);
|
||||
|
||||
Reference in New Issue
Block a user