re-structure to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 01:02:31 +02:00
parent 8242ec64ba
commit 7a0a13f9d5
10400 changed files with 46966 additions and 17223 deletions

View File

@@ -0,0 +1,47 @@
// @ts-nocheck
import React from 'react';
import { DataTable, Card } from '@/components';
import { TableStyle } from '@/constants';
import withAlertsActions from '@/containers/Alert/withAlertActions';
import { useVendorCreditDetailDrawerContext } from '../VendorCreditDetailDrawerProvider';
import {
useRefundCreditTransactionsTableColumns,
ActionsMenu,
} from './components';
import { compose } from '@/utils';
/**
* Refund vendor transactions table.
*/
function RefundVendorCreditTransactionsTable({
// #withAlertsActions
openAlert,
}) {
const { refundVendorCredit } = useVendorCreditDetailDrawerContext();
const columns = useRefundCreditTransactionsTableColumns();
// Handle delete refund vendor credit.
const handleDeleteRefundVendorCredit = ({ id }) => {
openAlert('refund-vendor-delete', { vendorCreditId: id });
};
return (
<Card>
<DataTable
columns={columns}
data={refundVendorCredit}
ContextMenu={ActionsMenu}
styleName={TableStyle.Constrant}
payload={{
onDelete: handleDeleteRefundVendorCredit,
}}
/>
</Card>
);
}
export default compose(withAlertsActions)(RefundVendorCreditTransactionsTable);

View File

@@ -0,0 +1,61 @@
// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
import { Intent, MenuItem, Menu } from '@blueprintjs/core';
import { Can, FormatDateCell, Icon } from '@/components';
import { safeCallback } from '@/utils';
import { VendorCreditAction, AbilitySubject } from '@/constants/abilityOption';
/**
* Actions menu.
*/
export function ActionsMenu({ payload: { onDelete }, row: { original } }) {
return (
<Menu>
<Can I={VendorCreditAction.Delete} a={AbilitySubject.VendorCredit}>
<MenuItem
icon={<Icon icon="trash-16" iconSize={16} />}
text={intl.get('delete_transaction')}
intent={Intent.DANGER}
onClick={safeCallback(onDelete, original)}
/>
</Can>
</Menu>
);
}
export function useRefundCreditTransactionsTableColumns() {
return React.useMemo(
() => [
{
Header: intl.get('date'),
accessor: 'formatted_date',
Cell: FormatDateCell,
width: 100,
className: 'date',
},
{
Header: intl.get('refund_vendor_credit.column.amount'),
accessor: 'formtted_amount',
width: 100,
className: 'amount',
align: 'right',
},
{
Header: intl.get('refund_vendor_credit.column.withdrawal_account'),
accessor: ({ deposit_account }) => deposit_account.name,
width: 100,
className: 'deposit_account',
},
{
id: 'reference_no',
Header: intl.get('reference_no'),
accessor: 'reference_no',
width: 100,
className: 'reference_no',
textOverview: true,
},
],
[],
);
}