feat : bill transaction delete alert.

This commit is contained in:
elforjani3
2021-07-23 22:30:36 +02:00
parent 76c6cb3699
commit d0c2be90bf
7 changed files with 193 additions and 16 deletions

View File

@@ -1,22 +1,37 @@
import React from 'react';
import { DataTable } from 'components';
import { useLocatedLandedCostColumns, ActionsMenu } from './components';
import { useBillDrawerContext } from './BillDrawerProvider';
import withAlertsActions from 'containers/Alert/withAlertActions';
import { compose } from 'utils';
/**
* Located landed cost table.
*/
function LocatedLandedCostTable() {
function LocatedLandedCostTable({
// #withAlertsActions
openAlert,
}) {
const columns = useLocatedLandedCostColumns();
const { transactions } = useBillDrawerContext();
const DATA = [
{
name: 'INV-1000',
amount: '10.000.000',
allocation_method: 'Bill',
},
];
// Handle the transaction delete action.
const handleDeleteTransaction = ({ id }) => {
openAlert('transaction-delete', { BillId: id });
};
return <DataTable columns={columns} data={DATA} ContextMenu={ActionsMenu} />;
return (
<DataTable
columns={columns}
data={transactions}
ContextMenu={ActionsMenu}
payload={{
onDelete: handleDeleteTransaction,
}}
/>
);
}
export default LocatedLandedCostTable;
export default compose(withAlertsActions)(LocatedLandedCostTable);