mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
re-structure to monorepo.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import intl from 'react-intl-universal';
|
||||
import * as R from 'ramda';
|
||||
|
||||
import { DataTable, CurrencyTag, TableSkeletonRows } from '@/components';
|
||||
import { TableStyle } from '@/constants';
|
||||
|
||||
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
|
||||
import { useGLEntriesTableColumns } from './utils';
|
||||
|
||||
/**
|
||||
* Journal entries table.
|
||||
*/
|
||||
export default function JournalEntriesTable({ transactions, ...restProps }) {
|
||||
const columns = useGLEntriesTableColumns();
|
||||
|
||||
return (
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={transactions}
|
||||
styleName={TableStyle.Constrant}
|
||||
TableLoadingRenderer={TableSkeletonRows}
|
||||
{...restProps}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {React.JSX}
|
||||
*/
|
||||
export function AmountDisplayedBaseCurrencyMessageJSX({
|
||||
organization: { base_currency: baseCurrency },
|
||||
}) {
|
||||
return (
|
||||
<Message>
|
||||
{intl.get('journal_entries.amount_displayed_base_currency')}
|
||||
<CurrencyTag>{baseCurrency}</CurrencyTag>
|
||||
</Message>
|
||||
);
|
||||
}
|
||||
|
||||
export const AmountDisplayedBaseCurrencyMessage = R.compose(
|
||||
withCurrentOrganization(),
|
||||
)(AmountDisplayedBaseCurrencyMessageJSX);
|
||||
|
||||
const Message = styled.div`
|
||||
font-size: 10px;
|
||||
margin-bottom: 12px;
|
||||
`;
|
||||
50
packages/webapp/src/containers/JournalEntriesTable/utils.tsx
Normal file
50
packages/webapp/src/containers/JournalEntriesTable/utils.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import moment from 'moment';
|
||||
|
||||
|
||||
export const useGLEntriesTableColumns = () => {
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
Header: intl.get('date'),
|
||||
accessor: ({ formatted_date }) =>
|
||||
moment(formatted_date).format('YYYY MMM DD'),
|
||||
width: 140,
|
||||
className: 'date',
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('account_name'),
|
||||
accessor: 'account_name',
|
||||
width: 140,
|
||||
className: 'account_name',
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('contact'),
|
||||
accessor: 'contactTypeFormatted',
|
||||
width: 140,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('credit'),
|
||||
accessor: ({ credit }) => credit.formatted_amount,
|
||||
width: 100,
|
||||
className: 'credit',
|
||||
align: 'right',
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('debit'),
|
||||
accessor: ({ debit }) => debit.formatted_amount,
|
||||
width: 100,
|
||||
className: 'debit',
|
||||
textOverview: true,
|
||||
align: 'right',
|
||||
},
|
||||
],
|
||||
[],
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user