// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
import {
Button,
Popover,
Menu,
MenuItem,
MenuDivider,
Position,
Tooltip,
Intent,
Classes,
} from '@blueprintjs/core';
import { Can, Icon, Money, If, AvaterCell } from '@/components';
import { VendorAction, AbilitySubject } from '@/constants/abilityOption';
import { safeCallback, firstLettersArgs } from '@/utils';
/**
* Actions menu.
*/
export function ActionsMenu({
row: { original },
payload: {
onEdit,
onDelete,
onDuplicate,
onInactivate,
onActivate,
onViewDetails,
},
}) {
return (
);
}
/**
* Actions cell.
*/
export function ActionsCell(props) {
return (
}
position={Position.RIGHT_BOTTOM}
>
} />
);
}
/**
* Avatar table accessor.
*/
export function AvatarAccessor(row) {
return {firstLettersArgs(row.display_name)};
}
/**
* Phone number accessor.
*/
export function PhoneNumberAccessor(row) {
return {row.work_phone}
;
}
/**
* Balance accessor.
*/
export function BalanceAccessor({ closing_balance, currency_code }) {
return ;
}
/**
* Note column accessor.
*/
export function NoteAccessor(row) {
return (
);
}
/**
* Retrieve the vendors table columns.
*/
export function useVendorsTableColumns() {
return React.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('phone_number'),
accessor: PhoneNumberAccessor,
className: 'work_phone',
width: 100,
clickable: true,
},
{
id: 'note',
Header: intl.get('note'),
accessor: NoteAccessor,
disableSortBy: true,
width: 85,
clickable: true,
},
{
id: 'balance',
Header: intl.get('receivable_balance'),
accessor: BalanceAccessor,
align: 'right',
width: 100,
clickable: true,
},
],
[],
);
}