Files
bigcapital/src/containers/FinancialStatements/ARAgingSummary/ARAgingSummaryTable.js
2022-02-16 18:44:10 +02:00

75 lines
1.8 KiB
JavaScript

import React from 'react';
import intl from 'react-intl-universal';
import styled from 'styled-components';
import { ReportDataTable, FinancialSheet } from 'components';
import { TableStyle } from 'common';
import { useARAgingSummaryContext } from './ARAgingSummaryProvider';
import { useARAgingSummaryColumns } from './components';
import { tableRowTypesToClassnames } from 'utils';
/**
* AR aging summary table sheet.
*/
export default function ReceivableAgingSummaryTable({
// #ownProps
organizationName,
}) {
// AR aging summary report context.
const { ARAgingSummary, isARAgingLoading } = useARAgingSummaryContext();
// AR aging summary columns.
const columns = useARAgingSummaryColumns();
return (
<FinancialSheet
companyName={organizationName}
sheetType={intl.get('receivable_aging_summary')}
asDate={new Date()}
loading={isARAgingLoading}
>
<ARAgingSummaryDataTable
columns={columns}
data={ARAgingSummary.tableRows}
rowClassNames={tableRowTypesToClassnames}
noInitialFetch={true}
sticky={true}
styleName={TableStyle.Constrant}
/>
</FinancialSheet>
);
}
const ARAgingSummaryDataTable = styled(ReportDataTable)`
.table {
.tbody .tr {
.td {
border-bottom: 0;
padding-top: 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;
}
}
}
}
}
`;