mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
fix : cash flow statment & inventoey item Details.
This commit is contained in:
@@ -12,7 +12,10 @@ import CashFlowStatementActionsBar from './CashFlowStatementActionsBar';
|
|||||||
import withSettings from 'containers/Settings/withSettings';
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
import withCashFlowStatementActions from './withCashFlowStatementActions';
|
import withCashFlowStatementActions from './withCashFlowStatementActions';
|
||||||
import { CashFlowStatementProvider } from './CashFlowStatementProvider';
|
import { CashFlowStatementProvider } from './CashFlowStatementProvider';
|
||||||
import { CashFlowStatementLoadingBar } from './components';
|
import {
|
||||||
|
CashFlowStatementLoadingBar,
|
||||||
|
CashFlowStatementAlerts,
|
||||||
|
} from './components';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -65,6 +68,7 @@ function CashFlowStatement({
|
|||||||
onNumberFormatSubmit={handleNumberFormatSubmit}
|
onNumberFormatSubmit={handleNumberFormatSubmit}
|
||||||
/>
|
/>
|
||||||
<CashFlowStatementLoadingBar />
|
<CashFlowStatementLoadingBar />
|
||||||
|
<CashFlowStatementAlerts />
|
||||||
<DashboardPageContent>
|
<DashboardPageContent>
|
||||||
<FinancialStatement>
|
<FinancialStatement>
|
||||||
<CashFlowStatementHeader
|
<CashFlowStatementHeader
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { If } from 'components';
|
import { Button } from '@blueprintjs/core';
|
||||||
|
import { Icon, If } from 'components';
|
||||||
|
|
||||||
import { dynamicColumns } from './utils';
|
import { dynamicColumns } from './utils';
|
||||||
import { useCashFlowStatementContext } from './CashFlowStatementProvider';
|
import { useCashFlowStatementContext } from './CashFlowStatementProvider';
|
||||||
@@ -10,10 +11,13 @@ import FinancialLoadingBar from '../FinancialLoadingBar';
|
|||||||
*/
|
*/
|
||||||
export const useCashFlowStatementColumns = () => {
|
export const useCashFlowStatementColumns = () => {
|
||||||
const {
|
const {
|
||||||
cashFlowStatement: { columns, data },
|
cashFlowStatement: { columns, tableRows },
|
||||||
} = useCashFlowStatementContext();
|
} = useCashFlowStatementContext();
|
||||||
|
|
||||||
return React.useMemo(() => dynamicColumns(columns, data), [columns, data]);
|
return React.useMemo(
|
||||||
|
() => dynamicColumns(columns, tableRows),
|
||||||
|
[columns, tableRows],
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,3 +31,34 @@ export function CashFlowStatementLoadingBar() {
|
|||||||
</If>
|
</If>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cash flow statement alter
|
||||||
|
*/
|
||||||
|
export function CashFlowStatementAlerts() {
|
||||||
|
const { cashFlowStatement, isCashFlowLoading, refetchCashFlow } =
|
||||||
|
useCashFlowStatementContext();
|
||||||
|
|
||||||
|
// Handle refetch the report sheet.
|
||||||
|
const handleRecalcReport = () => {
|
||||||
|
refetchCashFlow();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Can't display any error if the report is loading
|
||||||
|
if (isCashFlowLoading) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<If condition={cashFlowStatement.meta.is_cost_compute_running}>
|
||||||
|
<div className="alert-compute-running">
|
||||||
|
<Icon icon="info-block" iconSize={12} /> Just a moment! We're
|
||||||
|
calculating your cost transactions and this doesn't take much time.
|
||||||
|
Please check after sometime.
|
||||||
|
<Button onClick={handleRecalcReport} minimal={true} small={true}>
|
||||||
|
Refresh
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</If>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ const dateRangeMapper = (data, index, column) => ({
|
|||||||
width: getColumnWidth(data, `cells.${index}.value`, { minWidth: 100 }),
|
width: getColumnWidth(data, `cells.${index}.value`, { minWidth: 100 }),
|
||||||
className: `date-period ${column.key}`,
|
className: `date-period ${column.key}`,
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
|
textOverview: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,11 +41,10 @@ const totalMapper = (data, index, column) => ({
|
|||||||
className: 'total',
|
className: 'total',
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
Cell: CellTextSpan,
|
Cell: CellTextSpan,
|
||||||
width: getColumnWidth(data, `cells[${index}].value`, { minWidth: 100 }),
|
width: getColumnWidth(data, `cells[${index}].value`, { minWidth: 100 }),
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detarmines the given string starts with `date-range` string.
|
* Detarmines the given string starts with `date-range` string.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ import InventoryItemDetailsTable from './InventoryItemDetailsTable';
|
|||||||
import withInventoryItemDetailsActions from './withInventoryItemDetailsActions';
|
import withInventoryItemDetailsActions from './withInventoryItemDetailsActions';
|
||||||
import withSettings from 'containers/Settings/withSettings';
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
import { InventoryItemDetailsProvider } from './InventoryItemDetailsProvider';
|
import { InventoryItemDetailsProvider } from './InventoryItemDetailsProvider';
|
||||||
import { InventoryItemDetailsLoadingBar } from './components';
|
import {
|
||||||
|
InventoryItemDetailsLoadingBar,
|
||||||
|
InventoryItemDetailsAlerts,
|
||||||
|
} from './components';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -26,7 +29,6 @@ function InventoryItemDetails({
|
|||||||
//#withInventoryItemDetailsActions
|
//#withInventoryItemDetailsActions
|
||||||
toggleInventoryItemDetailsFilterDrawer: toggleFilterDrawer,
|
toggleInventoryItemDetailsFilterDrawer: toggleFilterDrawer,
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
const [filter, setFilter] = useState({
|
const [filter, setFilter] = useState({
|
||||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
||||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
||||||
@@ -58,6 +60,8 @@ function InventoryItemDetails({
|
|||||||
onNumberFormatSubmit={handleNumberFormatSubmit}
|
onNumberFormatSubmit={handleNumberFormatSubmit}
|
||||||
/>
|
/>
|
||||||
<InventoryItemDetailsLoadingBar />
|
<InventoryItemDetailsLoadingBar />
|
||||||
|
<InventoryItemDetailsAlerts />
|
||||||
|
|
||||||
<DashboardPageContent>
|
<DashboardPageContent>
|
||||||
<FinancialStatement>
|
<FinancialStatement>
|
||||||
<div className={'financial-statement--inventory-details'}>
|
<div className={'financial-statement--inventory-details'}>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { If } from 'components';
|
import { Button } from '@blueprintjs/core';
|
||||||
|
import { Icon, If } from 'components';
|
||||||
|
|
||||||
import { dynamicColumns } from './utils';
|
import { dynamicColumns } from './utils';
|
||||||
import FinancialLoadingBar from '../FinancialLoadingBar';
|
import FinancialLoadingBar from '../FinancialLoadingBar';
|
||||||
@@ -10,14 +11,17 @@ import { useInventoryItemDetailsContext } from './InventoryItemDetailsProvider';
|
|||||||
*/
|
*/
|
||||||
export const useInventoryItemDetailsColumns = () => {
|
export const useInventoryItemDetailsColumns = () => {
|
||||||
const {
|
const {
|
||||||
inventoryItemDetails: { columns, data },
|
inventoryItemDetails: { columns, tableRows },
|
||||||
} = useInventoryItemDetailsContext();
|
} = useInventoryItemDetailsContext();
|
||||||
|
|
||||||
return React.useMemo(() => dynamicColumns(columns, data), [columns, data]);
|
return React.useMemo(
|
||||||
|
() => dynamicColumns(columns, tableRows),
|
||||||
|
[columns, tableRows],
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cash inventory item details loading bar.
|
* inventory item details loading bar.
|
||||||
*/
|
*/
|
||||||
export function InventoryItemDetailsLoadingBar() {
|
export function InventoryItemDetailsLoadingBar() {
|
||||||
const { isInventoryItemDetailsLoading } = useInventoryItemDetailsContext();
|
const { isInventoryItemDetailsLoading } = useInventoryItemDetailsContext();
|
||||||
@@ -27,3 +31,37 @@ export function InventoryItemDetailsLoadingBar() {
|
|||||||
</If>
|
</If>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* inventory item details alerts
|
||||||
|
*/
|
||||||
|
export function InventoryItemDetailsAlerts() {
|
||||||
|
const {
|
||||||
|
inventoryItemDetails,
|
||||||
|
isInventoryItemDetailsLoading,
|
||||||
|
inventoryItemDetailsRefetch,
|
||||||
|
} = useInventoryItemDetailsContext();
|
||||||
|
|
||||||
|
// Handle refetch the report sheet.
|
||||||
|
const handleRecalcReport = () => {
|
||||||
|
inventoryItemDetailsRefetch();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Can't display any error if the report is loading
|
||||||
|
if (isInventoryItemDetailsLoading) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<If condition={inventoryItemDetails.meta.is_cost_compute_running}>
|
||||||
|
<div className="alert-compute-running">
|
||||||
|
<Icon icon="info-block" iconSize={12} /> Just a moment! We're
|
||||||
|
calculating your cost transactions and this doesn't take much time.
|
||||||
|
Please check after sometime.
|
||||||
|
<Button onClick={handleRecalcReport} minimal={true} small={true}>
|
||||||
|
Refresh
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</If>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ const columnsMapper = (data, index, column) => ({
|
|||||||
magicSpacing: 10,
|
magicSpacing: 10,
|
||||||
}),
|
}),
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
|
// textOverview: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -420,13 +420,15 @@ export function useCashFlowStatementReport(query, props) {
|
|||||||
{
|
{
|
||||||
select: (res) => ({
|
select: (res) => ({
|
||||||
columns: res.data.table.columns,
|
columns: res.data.table.columns,
|
||||||
data: res.data.table.data,
|
query: res.data.query,
|
||||||
|
meta: res.data.meta,
|
||||||
tableRows: res.data.table.data,
|
tableRows: res.data.table.data,
|
||||||
}),
|
}),
|
||||||
defaultData: {
|
defaultData: {
|
||||||
tableRows: [],
|
tableRows: [],
|
||||||
data: [],
|
|
||||||
columns: [],
|
columns: [],
|
||||||
|
query: {},
|
||||||
|
meta: {},
|
||||||
},
|
},
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
@@ -436,7 +438,7 @@ export function useCashFlowStatementReport(query, props) {
|
|||||||
/**
|
/**
|
||||||
* Retrieve inventory item detail report.
|
* Retrieve inventory item detail report.
|
||||||
*/
|
*/
|
||||||
export function useInventoryItemDetailsReport(query, props) {
|
export function useInventoryItemDetailsReport(query, props) {
|
||||||
return useRequestQuery(
|
return useRequestQuery(
|
||||||
[t.FINANCIAL_REPORT, t.INVENTORY_ITEM_DETAILS, query],
|
[t.FINANCIAL_REPORT, t.INVENTORY_ITEM_DETAILS, query],
|
||||||
{
|
{
|
||||||
@@ -450,15 +452,17 @@ export function useCashFlowStatementReport(query, props) {
|
|||||||
{
|
{
|
||||||
select: (res) => ({
|
select: (res) => ({
|
||||||
columns: res.data.table.columns,
|
columns: res.data.table.columns,
|
||||||
data: res.data.table.data,
|
query: res.data.query,
|
||||||
|
meta: res.data.meta,
|
||||||
tableRows: res.data.table.data,
|
tableRows: res.data.table.data,
|
||||||
}),
|
}),
|
||||||
defaultData: {
|
defaultData: {
|
||||||
tableRows: [],
|
tableRows: [],
|
||||||
data: [],
|
|
||||||
columns: [],
|
columns: [],
|
||||||
|
query: {},
|
||||||
|
meta: {},
|
||||||
},
|
},
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user