import React from 'react';
import {
Intent,
Button,
Popover,
Menu,
MenuItem,
MenuDivider,
Position,
} from '@blueprintjs/core';
import { FormattedMessage as T } from 'components';
import intl from 'react-intl-universal';
import moment from 'moment';
import { Money, Icon } from 'components';
import { safeCallback } from 'utils';
/**
* Table actions menu.
*/
export function ActionsMenu({
row: { original: paymentReceive },
payload: { onEdit, onDelete, onDrawer },
}) {
return (
);
}
/**
* Amount accessor.
*/
export function AmountAccessor(row) {
return ;
}
/**
* Payment date accessor.
*/
export function PaymentDateAccessor(row) {
return moment(row.payment_date).format('YYYY MMM DD');
}
/**
* Actions cell.
*/
export function ActionsCell(props) {
return (
}
position={Position.RIGHT_BOTTOM}
>
} />
);
}
/**
* Retrieve payment receives columns.
*/
export function usePaymentReceivesColumns() {
return React.useMemo(
() => [
{
id: 'payment_date',
Header: intl.get('payment_date'),
accessor: PaymentDateAccessor,
width: 140,
className: 'payment_date',
},
{
id: 'customer',
Header: intl.get('customer_name'),
accessor: 'customer.display_name',
width: 160,
className: 'customer_id',
},
{
id: 'amount',
Header: intl.get('amount'),
accessor: AmountAccessor,
width: 120,
className: 'amount',
},
{
id: 'payment_receive_no',
Header: intl.get('payment_receive_no'),
accessor: (row) =>
row.payment_receive_no ? `#${row.payment_receive_no}` : null,
width: 140,
className: 'payment_receive_no',
},
{
id: 'deposit_account',
Header: intl.get('deposit_account'),
accessor: 'deposit_account.name',
width: 140,
className: 'deposit_account_id',
},
{
id: 'reference_no',
Header: intl.get('reference_no'),
accessor: 'reference_no',
width: 140,
className: 'reference_no',
}
],
[],
);
}