mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
refactor(APAgingSummary)
refactor(ARAgingSummary)
This commit is contained in:
@@ -31,6 +31,7 @@ export function FinancialSheet({
|
|||||||
minimal = false,
|
minimal = false,
|
||||||
fullWidth = false,
|
fullWidth = false,
|
||||||
currentDate = true,
|
currentDate = true,
|
||||||
|
className,
|
||||||
}) {
|
}) {
|
||||||
const format = 'DD MMMM YYYY';
|
const format = 'DD MMMM YYYY';
|
||||||
const formattedFromDate = useMemo(
|
const formattedFromDate = useMemo(
|
||||||
@@ -59,7 +60,11 @@ export function FinancialSheet({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FinancialSheetRoot minimal={minimal} fullWidth={fullWidth}>
|
<FinancialSheetRoot
|
||||||
|
minimal={minimal}
|
||||||
|
fullWidth={fullWidth}
|
||||||
|
className={className}
|
||||||
|
>
|
||||||
{companyName && <FinancialSheetTitle>{companyName}</FinancialSheetTitle>}
|
{companyName && <FinancialSheetTitle>{companyName}</FinancialSheetTitle>}
|
||||||
{sheetType && <FinancialSheetType>{sheetType}</FinancialSheetType>}
|
{sheetType && <FinancialSheetType>{sheetType}</FinancialSheetType>}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import { FinancialStatement } from 'components';
|
|||||||
|
|
||||||
import APAgingSummaryHeader from './APAgingSummaryHeader';
|
import APAgingSummaryHeader from './APAgingSummaryHeader';
|
||||||
import APAgingSummaryActionsBar from './APAgingSummaryActionsBar';
|
import APAgingSummaryActionsBar from './APAgingSummaryActionsBar';
|
||||||
import APAgingSummaryTable from './APAgingSummaryTable';
|
import { APAgingSummaryBody } from './APAgingSummaryBody';
|
||||||
|
|
||||||
import DashboardPageContent from 'components/Dashboard/DashboardPageContent';
|
import DashboardPageContent from 'components/Dashboard/DashboardPageContent';
|
||||||
import { APAgingSummaryProvider } from './APAgingSummaryProvider';
|
import { APAgingSummaryProvider } from './APAgingSummaryProvider';
|
||||||
import { APAgingSummarySheetLoadingBar } from './components';
|
import { APAgingSummarySheetLoadingBar } from './components';
|
||||||
@@ -67,7 +68,7 @@ function APAgingSummary({
|
|||||||
pageFilter={filter}
|
pageFilter={filter}
|
||||||
onSubmitFilter={handleFilterSubmit}
|
onSubmitFilter={handleFilterSubmit}
|
||||||
/>
|
/>
|
||||||
<APAgingSummaryTable organizationName={organizationName} />
|
<APAgingSummaryBody organizationName={organizationName} />
|
||||||
</FinancialStatement>
|
</FinancialStatement>
|
||||||
</DashboardPageContent>
|
</DashboardPageContent>
|
||||||
</APAgingSummaryProvider>
|
</APAgingSummaryProvider>
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { TableStyle } from 'common';
|
|||||||
import { useAPAgingSummaryContext } from './APAgingSummaryProvider';
|
import { useAPAgingSummaryContext } from './APAgingSummaryProvider';
|
||||||
import { useAPAgingSummaryColumns } from './components';
|
import { useAPAgingSummaryColumns } from './components';
|
||||||
|
|
||||||
|
import { tableRowTypesToClassnames } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AP aging summary table sheet.
|
* AP aging summary table sheet.
|
||||||
*/
|
*/
|
||||||
@@ -24,8 +26,6 @@ export default function APAgingSummaryTable({
|
|||||||
// AP aging summary columns.
|
// AP aging summary columns.
|
||||||
const columns = useAPAgingSummaryColumns();
|
const columns = useAPAgingSummaryColumns();
|
||||||
|
|
||||||
const rowClassNames = (row) => [`row-type--${row.original.rowType}`];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FinancialSheet
|
<FinancialSheet
|
||||||
companyName={organizationName}
|
companyName={organizationName}
|
||||||
@@ -37,7 +37,7 @@ export default function APAgingSummaryTable({
|
|||||||
<APAgingSummaryDataTable
|
<APAgingSummaryDataTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={tableRows}
|
data={tableRows}
|
||||||
rowClassNames={rowClassNames}
|
rowClassNames={tableRowTypesToClassnames}
|
||||||
noInitialFetch={true}
|
noInitialFetch={true}
|
||||||
sticky={true}
|
sticky={true}
|
||||||
styleName={TableStyle.Constrant}
|
styleName={TableStyle.Constrant}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ function ReceivableAgingSummarySheet({
|
|||||||
<ARAgingSummarySheetLoadingBar />
|
<ARAgingSummarySheetLoadingBar />
|
||||||
|
|
||||||
<DashboardPageContent>
|
<DashboardPageContent>
|
||||||
<FinancialStatement name={'AR-aging-summary'}>
|
<FinancialStatement>
|
||||||
<ARAgingSummaryHeader
|
<ARAgingSummaryHeader
|
||||||
pageFilter={filter}
|
pageFilter={filter}
|
||||||
onSubmitFilter={handleFilterSubmit}
|
onSubmitFilter={handleFilterSubmit}
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ import React from 'react';
|
|||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
|
|
||||||
import ARAgingSummaryTable from './ARAgingSummaryTable';
|
import ARAgingSummaryTable from './ARAgingSummaryTable';
|
||||||
import {
|
import { FinancialReportBody } from '../FinancialReportPage';
|
||||||
FinancialReportBody,
|
import { FinancialSheetSkeleton } from '../../../components';
|
||||||
FinancialSheetSkeleton,
|
|
||||||
} from '../../../components';
|
|
||||||
|
|
||||||
import withCurrentOrganization from '../../../containers/Organization/withCurrentOrganization';
|
import withCurrentOrganization from '../../../containers/Organization/withCurrentOrganization';
|
||||||
import { useARAgingSummaryContext } from './ARAgingSummaryProvider';
|
import { useARAgingSummaryContext } from './ARAgingSummaryProvider';
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { TableStyle } from 'common';
|
|||||||
import { useARAgingSummaryContext } from './ARAgingSummaryProvider';
|
import { useARAgingSummaryContext } from './ARAgingSummaryProvider';
|
||||||
import { useARAgingSummaryColumns } from './components';
|
import { useARAgingSummaryColumns } from './components';
|
||||||
|
|
||||||
|
import { tableRowTypesToClassnames } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AR aging summary table sheet.
|
* AR aging summary table sheet.
|
||||||
*/
|
*/
|
||||||
@@ -21,8 +23,6 @@ export default function ReceivableAgingSummaryTable({
|
|||||||
// AR aging summary columns.
|
// AR aging summary columns.
|
||||||
const columns = useARAgingSummaryColumns();
|
const columns = useARAgingSummaryColumns();
|
||||||
|
|
||||||
const rowClassNames = (row) => [`row-type--${row.original.rowType}`];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FinancialSheet
|
<FinancialSheet
|
||||||
companyName={organizationName}
|
companyName={organizationName}
|
||||||
@@ -34,7 +34,7 @@ export default function ReceivableAgingSummaryTable({
|
|||||||
<ARAgingSummaryDataTable
|
<ARAgingSummaryDataTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={ARAgingSummary.tableRows}
|
data={ARAgingSummary.tableRows}
|
||||||
rowClassNames={rowClassNames}
|
rowClassNames={tableRowTypesToClassnames}
|
||||||
noInitialFetch={true}
|
noInitialFetch={true}
|
||||||
sticky={true}
|
sticky={true}
|
||||||
styleName={TableStyle.Constrant}
|
styleName={TableStyle.Constrant}
|
||||||
@@ -51,6 +51,25 @@ const ARAgingSummaryDataTable = styled(DataTable)`
|
|||||||
padding-top: 0.32rem;
|
padding-top: 0.32rem;
|
||||||
padding-bottom: 0.32rem;
|
padding-bottom: 0.32rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:not(.no-results) {
|
||||||
|
.td {
|
||||||
|
border-bottom: 0;
|
||||||
|
padding-top: 0.4rem;
|
||||||
|
padding-bottom: 0.4rem;
|
||||||
|
}
|
||||||
|
&:not(:first-child) .td {
|
||||||
|
border-top: 1px solid transparent;
|
||||||
|
}
|
||||||
|
&.row_type--total {
|
||||||
|
font-weight: 500;
|
||||||
|
|
||||||
|
.td {
|
||||||
|
border-top: 1px solid #bbb;
|
||||||
|
border-bottom: 3px double #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ export default function BalanceSheetTable({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<FinancialSheet
|
<FinancialSheet
|
||||||
name="balance-sheet"
|
|
||||||
companyName={companyName}
|
companyName={companyName}
|
||||||
sheetType={intl.get('balance_sheet')}
|
sheetType={intl.get('balance_sheet')}
|
||||||
asDate={query.to_date}
|
asDate={query.to_date}
|
||||||
|
|||||||
@@ -17,20 +17,17 @@ export default function PurchasesByItemsTable({ companyName }) {
|
|||||||
// Purchases by items context.
|
// Purchases by items context.
|
||||||
const {
|
const {
|
||||||
purchaseByItems: { tableRows, query },
|
purchaseByItems: { tableRows, query },
|
||||||
isLoading,
|
|
||||||
} = usePurchaseByItemsContext();
|
} = usePurchaseByItemsContext();
|
||||||
|
|
||||||
// Purchases by items table columns.
|
// Purchases by items table columns.
|
||||||
const columns = usePurchasesByItemsTableColumns();
|
const columns = usePurchasesByItemsTableColumns();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FinancialSheet
|
<PurchasesByItemsSheet
|
||||||
companyName={companyName}
|
companyName={companyName}
|
||||||
sheetType={intl.get('purchases_by_items')}
|
sheetType={intl.get('purchases_by_items')}
|
||||||
fromDate={query.from_date}
|
fromDate={query.from_date}
|
||||||
toDate={query.to_date}
|
toDate={query.to_date}
|
||||||
name="purchases-by-items"
|
|
||||||
loading={isLoading}
|
|
||||||
>
|
>
|
||||||
<PurchasesByItemsDataTable
|
<PurchasesByItemsDataTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
@@ -45,10 +42,14 @@ export default function PurchasesByItemsTable({ companyName }) {
|
|||||||
)}
|
)}
|
||||||
styleName={TableStyle.Constrant}
|
styleName={TableStyle.Constrant}
|
||||||
/>
|
/>
|
||||||
</FinancialSheet>
|
</PurchasesByItemsSheet>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const PurchasesByItemsSheet = styled(FinancialSheet)`
|
||||||
|
min-width: 850px;
|
||||||
|
`;
|
||||||
|
|
||||||
const PurchasesByItemsDataTable = styled(DataTable)`
|
const PurchasesByItemsDataTable = styled(DataTable)`
|
||||||
.table {
|
.table {
|
||||||
.tbody {
|
.tbody {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { DataTable, FinancialSheet } from 'components';
|
import { DataTable, FinancialSheet } from 'components';
|
||||||
|
|
||||||
@@ -23,15 +24,14 @@ export default function SalesByItemsTable({ companyName }) {
|
|||||||
const columns = useSalesByItemsTableColumns();
|
const columns = useSalesByItemsTableColumns();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FinancialSheet
|
<SalesByItemsSheet
|
||||||
companyName={companyName}
|
companyName={companyName}
|
||||||
sheetType={intl.get('sales_by_items')}
|
sheetType={intl.get('sales_by_items')}
|
||||||
fromDate={query.from_date}
|
fromDate={query.from_date}
|
||||||
toDate={query.to_date}
|
toDate={query.to_date}
|
||||||
name="sales-by-items"
|
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
>
|
>
|
||||||
<DataTable
|
<SalesByItemsDataTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={tableRows}
|
data={tableRows}
|
||||||
expandable={true}
|
expandable={true}
|
||||||
@@ -44,6 +44,27 @@ export default function SalesByItemsTable({ companyName }) {
|
|||||||
)}
|
)}
|
||||||
styleName={TableStyle.Constrant}
|
styleName={TableStyle.Constrant}
|
||||||
/>
|
/>
|
||||||
</FinancialSheet>
|
</SalesByItemsSheet>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SalesByItemsSheet = styled(FinancialSheet)`
|
||||||
|
min-width: 850px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const SalesByItemsDataTable = styled(DataTable)`
|
||||||
|
.table {
|
||||||
|
.tbody {
|
||||||
|
.tr .td {
|
||||||
|
border-bottom: 0;
|
||||||
|
padding-top: 0.4rem;
|
||||||
|
padding-bottom: 0.4rem;
|
||||||
|
}
|
||||||
|
.tr.row_type--total .td {
|
||||||
|
border-top: 1px solid #bbb;
|
||||||
|
font-weight: 500;
|
||||||
|
border-bottom: 3px double #000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export const ARAgingSummaryTableRowsMapper = (sheet, total) => {
|
|||||||
const agingRow = mapAging(customer.aging);
|
const agingRow = mapAging(customer.aging);
|
||||||
|
|
||||||
rows.push({
|
rows.push({
|
||||||
rowType: 'customer',
|
row_types: 'customer',
|
||||||
name: customer.customer_name,
|
name: customer.customer_name,
|
||||||
...agingRow,
|
...agingRow,
|
||||||
current: customer.current.formatted_amount,
|
current: customer.current.formatted_amount,
|
||||||
@@ -129,7 +129,7 @@ export const ARAgingSummaryTableRowsMapper = (sheet, total) => {
|
|||||||
...rows,
|
...rows,
|
||||||
{
|
{
|
||||||
name: '',
|
name: '',
|
||||||
rowType: 'total',
|
row_types: 'total',
|
||||||
current: sheet.total.current.formatted_amount,
|
current: sheet.total.current.formatted_amount,
|
||||||
...mapAging(sheet.total.aging),
|
...mapAging(sheet.total.aging),
|
||||||
total: sheet.total.total.formatted_amount,
|
total: sheet.total.total.formatted_amount,
|
||||||
@@ -150,7 +150,7 @@ export const APAgingSummaryTableRowsMapper = (sheet, total) => {
|
|||||||
const agingRow = mapAging(vendor.aging);
|
const agingRow = mapAging(vendor.aging);
|
||||||
|
|
||||||
rows.push({
|
rows.push({
|
||||||
rowType: 'vendor',
|
row_types: 'vendor',
|
||||||
name: vendor.vendor_name,
|
name: vendor.vendor_name,
|
||||||
...agingRow,
|
...agingRow,
|
||||||
current: vendor.current.formatted_amount,
|
current: vendor.current.formatted_amount,
|
||||||
@@ -164,7 +164,7 @@ export const APAgingSummaryTableRowsMapper = (sheet, total) => {
|
|||||||
...rows,
|
...rows,
|
||||||
{
|
{
|
||||||
name: '',
|
name: '',
|
||||||
rowType: 'total',
|
row_types: 'total',
|
||||||
current: sheet.total.current.formatted_amount,
|
current: sheet.total.current.formatted_amount,
|
||||||
...mapAging(sheet.total.aging),
|
...mapAging(sheet.total.aging),
|
||||||
total: sheet.total.total.formatted_amount,
|
total: sheet.total.total.formatted_amount,
|
||||||
@@ -182,7 +182,7 @@ export const inventoryValuationReducer = (sheet) => {
|
|||||||
}
|
}
|
||||||
if (sheet.total) {
|
if (sheet.total) {
|
||||||
results.push({
|
results.push({
|
||||||
rowType: 'total',
|
row_types: 'total',
|
||||||
...sheet.total,
|
...sheet.total,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ export const purchasesByItemsReducer = (sheet) => {
|
|||||||
}
|
}
|
||||||
if (sheet.total) {
|
if (sheet.total) {
|
||||||
results.push({
|
results.push({
|
||||||
rowType: 'total',
|
row_types: 'total',
|
||||||
...sheet.total,
|
...sheet.total,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ export const salesByItemsReducer = (sheet) => {
|
|||||||
}
|
}
|
||||||
if (sheet.total) {
|
if (sheet.total) {
|
||||||
results.push({
|
results.push({
|
||||||
rowType: 'total',
|
row_types: 'total',
|
||||||
...sheet.total,
|
...sheet.total,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,25 +13,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.tbody{
|
.tbody{
|
||||||
.tr:not(.no-results) {
|
|
||||||
.td{
|
|
||||||
border-bottom: 0;
|
|
||||||
padding-top: 0.4rem;
|
|
||||||
padding-bottom: 0.4rem;
|
|
||||||
}
|
|
||||||
&:not(:first-child) .td{
|
|
||||||
border-top: 1px solid transparent;
|
|
||||||
}
|
|
||||||
&.row-type--total{
|
|
||||||
font-weight: 500;
|
|
||||||
|
|
||||||
.td{
|
|
||||||
border-top: 1px solid #BBB;
|
|
||||||
border-bottom: 3px double #333;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,59 +14,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tbody {
|
.tbody {
|
||||||
.tr .td {
|
|
||||||
padding-top: 0.2rem;
|
|
||||||
padding-bottom: 0.2rem;
|
|
||||||
border-top-color: transparent;
|
|
||||||
border-bottom-color: transparent;
|
|
||||||
|
|
||||||
&.date {
|
|
||||||
>div {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.force-width {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tr:not(.no-results) .td {
|
|
||||||
border-left: 1px solid #ececec;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tr:last-child .td {
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tr.row-type {
|
|
||||||
&--ITEM {
|
|
||||||
.td {
|
|
||||||
&.transaction_type {
|
|
||||||
border-left-color: transparent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:not(:first-child).is-expanded .td {
|
|
||||||
border-top: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&--ITEM,
|
|
||||||
&--OPENING_ENTRY,
|
|
||||||
&--CLOSING_ENTRY {
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--ITEM {
|
|
||||||
&.is-expanded {
|
|
||||||
.td.value .cell-inner {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,18 +12,7 @@
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.tbody {
|
|
||||||
.tr .td {
|
|
||||||
border-bottom: 0;
|
|
||||||
padding-top: 0.4rem;
|
|
||||||
padding-bottom: 0.4rem;
|
|
||||||
}
|
|
||||||
.tr.row_type--total .td {
|
|
||||||
border-top: 1px solid #bbb;
|
|
||||||
font-weight: 500;
|
|
||||||
border-bottom: 3px double #000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user