import React from 'react';
import {
Intent,
Classes,
Tooltip,
Position,
Tag,
Button,
MenuItem,
Menu,
MenuDivider,
Popover,
} from '@blueprintjs/core';
import { FormattedMessage as T } from 'react-intl';
import moment from 'moment';
import { Choose, Money, If, Icon } from 'components';
import { safeCallback } from 'utils';
import { formatMessage } from 'services/intl';
/**
* Amount accessor.
*/
export const AmountAccessor = (r) => (
}
position={Position.RIGHT_TOP}
boundary={'viewport'}
>
);
/**
* Amount popover content line.
*/
export const AmountPopoverContentLine = ({ journalEntry }) => {
const isCredit = !!journalEntry.credit;
const isDebit = !!journalEntry.debit;
const { account } = journalEntry;
return (
C. USD -{' '}
{account.name} ({account.code})
D. USD -{' '}
{account.name} ({account.code})
);
};
/**
* Amount popover content.
*/
export function AmountPopoverContent({ journalEntries }) {
const journalLinesProps = journalEntries.map((journalEntry) => ({
journalEntry,
accountId: journalEntry.account_id,
}));
return (
{journalLinesProps.map(({ journalEntry, accountId }) => (
))}
);
}
/**
* Publish column accessor.
*/
export const StatusAccessor = (row) => {
return (
);
};
/**
* Date accessor.
*/
export const DateAccessor = (row) => {
return moment(row.date).format('YYYY MMM DD');
};
/**
* Note column accessor.
*/
export function NoteAccessor(row) {
return (
);
}
/**
* Table actions cell.
*/
export const ActionsCell = (props) => {
return (
}
position={Position.RIGHT_BOTTOM}
>
} />
);
};
/**
* Actions menu of the table.
*/
export const ActionsMenu = ({
payload: { onPublish, onEdit, onDelete },
row: { original },
}) => {
return (
);
};