fix(WarehouseTransfer).

This commit is contained in:
a.bouhuolia
2022-03-20 16:43:49 +02:00
parent 89b28903fa
commit 29fbcf1f1c
17 changed files with 129 additions and 193 deletions

View File

@@ -62,7 +62,6 @@ export default function PaymentReceiveItemsTable({
currencyCode,
}}
noResults={noResultsMessage}
footer={true}
/>
</CloudLoadingIndicator>
);

View File

@@ -4,7 +4,6 @@ import intl from 'react-intl-universal';
import { Money } from 'components';
import { MoneyFieldCell } from 'components/DataTableCells';
import { safeSumBy, formattedAmount } from 'utils';
/**
* Invoice date cell.
@@ -13,13 +12,6 @@ function InvoiceDateCell({ value }) {
return <span>{moment(value).format('YYYY MMM DD')}</span>;
}
/**
* Index table cell.
*/
function IndexCell({ row: { index } }) {
return <span>{index + 1}</span>;
}
/**
* Invoice number table cell accessor.
*/
@@ -27,30 +19,6 @@ function InvNumberCellAccessor(row) {
return row?.invoice_no ? `#${row?.invoice_no || ''}` : '-';
}
/**
* Balance footer cell.
*/
function BalanceFooterCell({ 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.
*/
@@ -58,33 +26,17 @@ function MoneyTableCell({ row: { original }, value }) {
return <Money amount={value} currency={original.currency_code} />;
}
function DateFooterCell() {
return intl.get('total')
}
/**
* Retrieve payment receive form entries columns.
*/
export const usePaymentReceiveEntriesColumns = () => {
return React.useMemo(
() => [
{
Header: '#',
accessor: 'index',
Cell: IndexCell,
width: 40,
disableResizing: true,
disableSortBy: true,
className: 'index',
},
{
Header: intl.get('Date'),
Header: 'Invoice date',
id: 'invoice_date',
accessor: 'invoice_date',
Cell: InvoiceDateCell,
Footer: DateFooterCell,
disableSortBy: true,
disableResizing: true,
width: 250,
@@ -99,7 +51,6 @@ export const usePaymentReceiveEntriesColumns = () => {
{
Header: intl.get('invoice_amount'),
accessor: 'amount',
Footer: BalanceFooterCell,
Cell: MoneyTableCell,
disableSortBy: true,
width: 100,
@@ -108,7 +59,6 @@ export const usePaymentReceiveEntriesColumns = () => {
{
Header: intl.get('amount_due'),
accessor: 'due_amount',
Footer: DueAmountFooterCell,
Cell: MoneyTableCell,
disableSortBy: true,
width: 150,
@@ -118,7 +68,6 @@ export const usePaymentReceiveEntriesColumns = () => {
Header: intl.get('payment_amount'),
accessor: 'payment_amount',
Cell: MoneyFieldCell,
Footer: PaymentAmountFooterCell,
disableSortBy: true,
width: 150,
className: 'payment_amount',