diff --git a/client/src/components/DataTable.js b/client/src/components/DataTable.js index 25bb97c7d..510ec6f39 100644 --- a/client/src/components/DataTable.js +++ b/client/src/components/DataTable.js @@ -121,16 +121,21 @@ export default function DataTable({ // Renders table row. const RenderRow = useCallback(({ style = {}, row }) => { - prepareRow(row); + prepareRow(row); + const rowClasses = rowClassNames && rowClassNames(row.original); + return ( -
+
{row.cells.map((cell) => { return
{ cell.render('Cell') }
})}
); - }, [prepareRow]); + }, [prepareRow, rowClassNames]); // Renders virtualize circle table rows. const RenderVirtualizedRows = useCallback(({ index, style }) => { diff --git a/client/src/components/FinancialSheet.js b/client/src/components/FinancialSheet.js index af78c3165..11fa5b958 100644 --- a/client/src/components/FinancialSheet.js +++ b/client/src/components/FinancialSheet.js @@ -1,40 +1,59 @@ -import React, { Children } from 'react'; +import React, { useMemo, useCallback } from 'react'; import moment from 'moment'; import classnames from 'classnames'; import LoadingIndicator from 'components/LoadingIndicator'; export default function FinancialSheet({ - companyTitle, + companyName, sheetType, - date, + fromDate, + toDate, children, accountingBasis, name, loading, className, + basis, }) { - const formattedDate = moment(date).format('DD MMMM YYYY') + const formattedFromDate = moment(fromDate).format('DD MMMM YYYY'); + const formattedToDate = moment(toDate).format('DD MMMM YYYY'); const nameModifer = name ? `financial-sheet--${name}` : ''; + const methodsLabels = useMemo(() => ({ + 'cash': 'Cash', + 'accural': 'Accural', + }), []); + const getBasisLabel = useCallback((b) => methodsLabels[b], [methodsLabels]); + const basisLabel = useMemo(() => getBasisLabel(basis), [getBasisLabel, basis]); + return (
- -

{ companyTitle }

+ + +
+

+ { companyName } +

{ sheetType }
-
From { formattedDate } | To { formattedDate }
+
+ From { formattedFromDate } | To { formattedToDate } +
{ children }
-
{ accountingBasis }
-
- Accounting Basis: Accural -
- + { (basisLabel) && ( +
+ Accounting Basis: { basisLabel } +
+ )} +
); } \ No newline at end of file diff --git a/client/src/components/LoadingIndicator.js b/client/src/components/LoadingIndicator.js index 19f1db616..cad74aa56 100644 --- a/client/src/components/LoadingIndicator.js +++ b/client/src/components/LoadingIndicator.js @@ -27,7 +27,7 @@ export default function LoadingIndicator({
{ children }
), [children, componentStyle]); - const maybeRenderComponent = rendered && renderComponent; + const maybeRenderComponent = (rendered && children) && renderComponent; const maybeRenderLoadingSpinner = loading && loadingComponent; return ( diff --git a/client/src/connectors/Settings.connect.js b/client/src/connectors/Settings.connect.js new file mode 100644 index 000000000..b7a21d0da --- /dev/null +++ b/client/src/connectors/Settings.connect.js @@ -0,0 +1,13 @@ +import {connect} from 'react-redux'; + +export const mapStateToProps = (state, props) => { + return { + organizationSettings: state.settings.data.organization, + }; +}; + +export const mapDispatchToProps = (dispatch) => ({ + +}); + +export default connect(mapStateToProps, mapDispatchToProps); \ No newline at end of file diff --git a/client/src/containers/Dashboard/FinancialStatements/BalanceSheet/BalanceSheet.js b/client/src/containers/Dashboard/FinancialStatements/BalanceSheet/BalanceSheet.js index 94cdfed07..526fb3181 100644 --- a/client/src/containers/Dashboard/FinancialStatements/BalanceSheet/BalanceSheet.js +++ b/client/src/containers/Dashboard/FinancialStatements/BalanceSheet/BalanceSheet.js @@ -5,12 +5,12 @@ import useAsync from 'hooks/async'; import BalanceSheetConnect from 'connectors/BalanceSheet.connect'; import {useIntl} from 'react-intl'; import BalanceSheetHeader from './BalanceSheetHeader'; -import LoadingIndicator from 'components/LoadingIndicator'; import BalanceSheetTable from './BalanceSheetTable'; import moment from 'moment'; import DashboardPageContent from 'components/Dashboard/DashboardPageContent'; import DashboardInsider from 'components/Dashboard/DashboardInsider'; import BalanceSheetActionsBar from './BalanceSheetActionsBar'; +import SettingsConnect from 'connectors/Settings.connect'; function BalanceSheet({ fetchBalanceSheet, @@ -18,6 +18,7 @@ function BalanceSheet({ balanceSheetLoading, getBalanceSheetIndex, getBalanceSheet, + organizationSettings }) { const intl = useIntl(); const [filter, setFilter] = useState({ @@ -70,6 +71,7 @@ function BalanceSheet({
@@ -83,4 +85,5 @@ function BalanceSheet({ export default compose( DashboardConnect, BalanceSheetConnect, + SettingsConnect, )(BalanceSheet); \ No newline at end of file diff --git a/client/src/containers/Dashboard/FinancialStatements/BalanceSheet/BalanceSheetTable.js b/client/src/containers/Dashboard/FinancialStatements/BalanceSheet/BalanceSheetTable.js index 0925a53c0..e0278177b 100644 --- a/client/src/containers/Dashboard/FinancialStatements/BalanceSheet/BalanceSheetTable.js +++ b/client/src/containers/Dashboard/FinancialStatements/BalanceSheet/BalanceSheetTable.js @@ -11,6 +11,7 @@ import { } from 'utils'; function BalanceSheetTable({ + companyName, balanceSheetAccounts, balanceSheetColumns, balanceSheetQuery, @@ -110,9 +111,11 @@ function BalanceSheetTable({ return ( { return (types.indexOf(rowType) === -1) ? '' : value; @@ -76,7 +77,7 @@ function JournalSheetTable({ return ( @@ -78,5 +81,6 @@ function ProfitLossSheet({ export default compose( DashboardConnect, - ProfitLossSheetConnect + ProfitLossSheetConnect, + SettingsConnect, )(ProfitLossSheet); \ No newline at end of file diff --git a/client/src/containers/Dashboard/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js b/client/src/containers/Dashboard/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js index 224edd270..08ffbf19f 100644 --- a/client/src/containers/Dashboard/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js +++ b/client/src/containers/Dashboard/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js @@ -9,11 +9,11 @@ import { compose, defaultExpanderReducer } from 'utils'; function ProfitLossSheetTable({ loading, - data, onFetchData, profitLossTableRows, profitLossQuery, - profitLossColumns + profitLossColumns, + companyName, }) { const columns = useMemo(() => [ { @@ -113,11 +113,12 @@ function ProfitLossSheetTable({ return ( + loading={loading} + basis={profitLossQuery.basis}> { + + }, +}); \ No newline at end of file diff --git a/client/src/store/settings/settings.selectors.js b/client/src/store/settings/settings.selectors.js new file mode 100644 index 000000000..e69de29bb diff --git a/client/src/store/settings/settings.type.js b/client/src/store/settings/settings.type.js new file mode 100644 index 000000000..7a62d56e8 --- /dev/null +++ b/client/src/store/settings/settings.type.js @@ -0,0 +1,5 @@ + + +export default { + +}; \ No newline at end of file diff --git a/client/src/store/types.js b/client/src/store/types.js index 31359f5be..307f75f93 100644 --- a/client/src/store/types.js +++ b/client/src/store/types.js @@ -11,6 +11,7 @@ import resources from './resources/resource.types'; import users from './users/users.types'; import financialStatements from './financialStatement/financialStatements.types'; import itemCategories from './itemCategories/itemsCategory.type'; +import settings from './settings/settings.type'; export default { ...authentication, @@ -25,5 +26,6 @@ export default { ...resources, ...users, ...financialStatements, - ...itemCategories + ...itemCategories, + ...settings }; diff --git a/client/src/style/pages/financial-statements.scss b/client/src/style/pages/financial-statements.scss index 8690ef6a1..bc843e823 100644 --- a/client/src/style/pages/financial-statements.scss +++ b/client/src/style/pages/financial-statements.scss @@ -35,6 +35,7 @@ justify-content: center; align-items: center; } + } .financial-sheet{ @@ -76,6 +77,20 @@ color: #777; } } + .tr.no-results{ + .td{ + flex-direction: column; + padding: 20px; + color: #666; + align-items: center; + } + } + } + + &__inner{ + &.is-loading{ + display: none; + } } &__basis{ color: #888; @@ -85,8 +100,7 @@ font-size: 12px; } .dashboard__loading-indicator{ - margin-left: auto; - margin-right: auto; + margin: 60px auto 0; } &--expended{ @@ -106,7 +120,7 @@ &--journal{ .financial-sheet__table{ .tbody{ - .tr .td{ + .tr:not(.no-results) .td{ padding: 0.4rem; color: #444; border-bottom-color: #F0F0F0;