import React, { useMemo } from 'react';
import { Menu, MenuItem, MenuDivider, Intent } from '@blueprintjs/core';
import clsx from 'classnames';
import intl from 'react-intl-universal';
import { Can, Icon, Money, If, AvaterCell } from 'components';
import { CustomerAction, AbilitySubject } from '../../../common/abilityOption';
import { safeCallback } from 'utils';
/**
* Actions menu.
*/
export function ActionsMenu({
row: { original },
payload: {
onEdit,
onDelete,
onDuplicate,
onInactivate,
onActivate,
onViewDetails,
},
}) {
return (
);
}
/**
* 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: '',
Cell: AvaterCell,
className: 'avatar',
width: 45,
disableResizing: true,
disableSortBy: true,
clickable: true,
},
{
id: 'display_name',
Header: intl.get('display_name'),
accessor: 'display_name',
className: 'display_name',
width: 150,
clickable: true,
},
{
id: 'company_name',
Header: intl.get('company_name'),
accessor: 'company_name',
className: 'company_name',
width: 150,
clickable: true,
},
{
id: 'work_phone',
Header: intl.get('work_phone'),
accessor: PhoneNumberAccessor,
className: 'phone_number',
width: 100,
clickable: true,
},
{
id: 'balance',
Header: intl.get('receivable_balance'),
accessor: BalanceAccessor,
align: 'right',
width: 100,
clickable: true,
},
],
[],
);
}