import React, { useMemo } from 'react';
import {
Button,
Popover,
Menu,
MenuItem,
MenuDivider,
Position,
Intent,
} from '@blueprintjs/core';
import { Icon, Money, If } from 'components';
import { safeCallback } from 'utils';
import { firstLettersArgs } from 'utils';
import intl from 'react-intl-universal';
/**
* Actions menu.
*/
export function ActionsMenu({
row: { original },
payload: { onEdit, onDelete, onDuplicate, onInactivate, onActivate },
}) {
return (
);
}
/**
* Avatar cell.
*/
export function AvatarCell(row) {
return {firstLettersArgs(row.display_name)};
}
/**
* Phone number accessor.
*/
export function PhoneNumberAccessor(row) {
return {row.work_phone}
;
}
/**
* Balance accessor.
*/
export function BalanceAccessor(row) {
return ;
}
/**
* Retrieve customers table columns.
*/
export function useCustomersTableColumns() {
return useMemo(
() => [
{
id: 'avatar',
Header: '',
accessor: AvatarCell,
className: 'avatar',
width: 45,
disableResizing: true,
disableSortBy: true,
},
{
id: 'display_name',
Header: intl.get('display_name'),
accessor: 'display_name',
className: 'display_name',
width: 150,
},
{
id: 'company_name',
Header: intl.get('company_name'),
accessor: 'company_name',
className: 'company_name',
width: 150,
},
{
id: 'work_phone',
Header: intl.get('work_phone'),
accessor: PhoneNumberAccessor,
className: 'phone_number',
width: 100,
},
{
id: 'balance',
Header: intl.get('receivable_balance'),
accessor: BalanceAccessor,
className: 'receivable_balance',
width: 100,
},
],
[],
);
}