mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
Merge branch 'feature/multi-dimensions' of https://github.com/bigcapitalhq/client into feature/multi-dimensions
This commit is contained in:
@@ -2,7 +2,6 @@ import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import moment from 'moment';
|
||||
import { Money, ExchangeRateInputGroup } from 'components';
|
||||
import { safeSumBy, formattedAmount } from 'utils';
|
||||
import { MoneyFieldCell } from 'components/DataTableCells';
|
||||
import { useFormikContext } from 'formik';
|
||||
import { useCurrentOrganization } from 'hooks/state';
|
||||
@@ -12,36 +11,9 @@ function BillNumberAccessor(row) {
|
||||
return row?.bill_no ? row?.bill_no : '-';
|
||||
}
|
||||
|
||||
function IndexTableCell({ row: { index } }) {
|
||||
return <span>{index + 1}</span>;
|
||||
}
|
||||
|
||||
function BillDateCell({ value }) {
|
||||
return moment(value).format('YYYY MMM DD');
|
||||
}
|
||||
/**
|
||||
* Balance footer cell.
|
||||
*/
|
||||
function AmountFooterCell({ payload: { currencyCode }, rows }) {
|
||||
const total = safeSumBy(rows, 'original.amount');
|
||||
return <span>{formattedAmount(total, currencyCode)}</span>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Due amount footer cell.
|
||||
*/
|
||||
function DueAmountFooterCell({ payload: { currencyCode }, rows }) {
|
||||
const totalDueAmount = safeSumBy(rows, 'original.due_amount');
|
||||
return <span>{formattedAmount(totalDueAmount, currencyCode)}</span>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment amount footer cell.
|
||||
*/
|
||||
function PaymentAmountFooterCell({ payload: { currencyCode }, rows }) {
|
||||
const totalPaymentAmount = safeSumBy(rows, 'original.payment_amount');
|
||||
return <span>{formattedAmount(totalPaymentAmount, currencyCode)}</span>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mobey table cell.
|
||||
@@ -56,15 +28,6 @@ function MoneyTableCell({ row: { original }, value }) {
|
||||
export function usePaymentMadeEntriesTableColumns() {
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
Header: '#',
|
||||
accessor: 'index',
|
||||
Cell: IndexTableCell,
|
||||
width: 40,
|
||||
disableResizing: true,
|
||||
disableSortBy: true,
|
||||
className: 'index',
|
||||
},
|
||||
{
|
||||
Header: intl.get('Date'),
|
||||
id: 'bill_date',
|
||||
@@ -84,7 +47,6 @@ export function usePaymentMadeEntriesTableColumns() {
|
||||
Header: intl.get('bill_amount'),
|
||||
accessor: 'amount',
|
||||
Cell: MoneyTableCell,
|
||||
Footer: AmountFooterCell,
|
||||
disableSortBy: true,
|
||||
className: 'amount',
|
||||
},
|
||||
@@ -92,7 +54,6 @@ export function usePaymentMadeEntriesTableColumns() {
|
||||
Header: intl.get('amount_due'),
|
||||
accessor: 'due_amount',
|
||||
Cell: MoneyTableCell,
|
||||
Footer: DueAmountFooterCell,
|
||||
disableSortBy: true,
|
||||
className: 'due_amount',
|
||||
},
|
||||
@@ -100,7 +61,6 @@ export function usePaymentMadeEntriesTableColumns() {
|
||||
Header: intl.get('payment_amount'),
|
||||
accessor: 'payment_amount',
|
||||
Cell: MoneyFieldCell,
|
||||
Footer: PaymentAmountFooterCell,
|
||||
disableSortBy: true,
|
||||
className: 'payment_amount',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user