// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
import clsx from 'classnames';
import { FormattedMessage as T } from '@/components';
import {
Position,
Menu,
MenuItem,
MenuDivider,
Intent,
Popover,
Tag,
Button,
} from '@blueprintjs/core';
import { CLASSES } from '@/constants/classes';
import { safeCallback } from '@/utils';
import { FormatDateCell, Choose, Money, Icon, If, Can } from '@/components';
import { SaleReceiptAction, AbilitySubject } from '@/constants/abilityOption';
/**
* Receipts table row actions menu.
* @returns {React.JSX}
*/
export function ActionsMenu({
payload: { onEdit, onDelete, onClose, onSendMail, onViewDetails, onPrint },
row: { original: receipt },
}) {
return (
);
}
/**
* Actions cell.
*/
export function ActionsCell(props) {
return (
}
position={Position.RIGHT_BOTTOM}
>
} />
);
}
/**
* Status accessor.
*/
export function StatusAccessor(receipt) {
return (
);
}
/**
* Retrieve receipts table columns.
*/
export function useReceiptsTableColumns() {
return React.useMemo(
() => [
{
id: 'receipt_date',
Header: intl.get('receipt_date'),
accessor: 'formatted_receipt_date',
width: 140,
className: 'receipt_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: 'receipt_number',
Header: intl.get('receipt_number'),
accessor: 'receipt_number',
width: 140,
className: 'receipt_number',
clickable: true,
textOverview: true,
},
{
id: 'deposit_account',
Header: intl.get('deposit_account'),
accessor: 'deposit_account.name',
width: 140,
className: 'deposit_account',
clickable: true,
textOverview: true,
},
{
id: 'amount',
Header: intl.get('amount'),
accessor: (r) => ,
width: 140,
align: 'right',
clickable: true,
textOverview: true,
money: true,
className: clsx(CLASSES.FONT_BOLD),
},
{
id: 'status',
Header: intl.get('status'),
accessor: StatusAccessor,
width: 140,
className: 'status',
clickable: true,
},
{
id: 'reference_no',
Header: intl.get('reference_no'),
accessor: 'reference_no',
width: 140,
className: 'reference_no',
clickable: true,
textOverview: true,
},
],
[],
);
}