import React from 'react';
import {
Intent,
Tag,
Button,
Popover,
Menu,
MenuItem,
MenuDivider,
Position,
} from '@blueprintjs/core';
import { Money, Choose, Icon, If } from 'components';
import { FormattedMessage as T } from 'components';
import intl from 'react-intl-universal';
import { safeCallback } from 'utils';
import moment from 'moment';
/**
* Status accessor.
*/
export const statusAccessor = (row) => (
);
/**
* Actions menu.
*/
export function ActionsMenu({
row: { original },
payload: {
onEdit,
onDeliver,
onReject,
onApprove,
onDelete,
onDrawer,
onConvert,
onViewDetails,
onPrint,
},
}) {
return (
);
}
function DateCell({ value }) {
return moment(value).format('YYYY MMM DD');
}
function AmountAccessor({ amount, currency_code }) {
return ;
}
function ActionsCell(props) {
return (
}
position={Position.RIGHT_BOTTOM}
>
} />
);
}
export function useEstiamtesTableColumns() {
return React.useMemo(
() => [
{
id: 'estimate_date',
Header: intl.get('estimate_date'),
accessor: 'estimate_date',
Cell: DateCell,
width: 140,
className: 'estimate_date',
clickable: true,
textOverview: true,
},
{
id: 'customer',
Header: intl.get('customer_name'),
accessor: 'customer.display_name',
width: 140,
className: 'customer_id',
clickable: true,
textOverview: true,
},
{
id: 'expiration_date',
Header: intl.get('expiration_date'),
accessor: 'expiration_date',
Cell: DateCell,
width: 140,
className: 'expiration_date',
clickable: true,
textOverview: true,
},
{
id: 'estimate_number',
Header: intl.get('estimate_number'),
accessor: (row) =>
row.estimate_number ? `#${row.estimate_number}` : null,
width: 140,
className: 'estimate_number',
clickable: true,
textOverview: true,
},
{
id: 'amount',
Header: intl.get('amount'),
accessor: AmountAccessor,
width: 140,
className: 'amount',
clickable: true,
},
{
id: 'status',
Header: intl.get('status'),
accessor: (row) => statusAccessor(row),
width: 140,
className: 'status',
clickable: true,
},
{
id: 'reference_no',
Header: intl.get('reference_no'),
accessor: 'reference',
width: 90,
className: 'reference',
clickable: true,
textOverview: true,
},
],
[],
);
}