feat: add refund transactions.

This commit is contained in:
elforjani13
2021-12-05 19:30:52 +02:00
parent ab48e6092a
commit 2a48d9be51
24 changed files with 688 additions and 17 deletions

View File

@@ -13,6 +13,7 @@ import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import withDialogActions from 'containers/Dialog/withDialogActions';
import withSettings from '../../../Settings/withSettings';
import { useVendorsCreditNoteTableColumns, ActionsMenu } from './components';
@@ -33,6 +34,9 @@ function VendorsCreditNoteDataTable({
// #withDrawerActions
openDrawer,
// #withDialogAction
openDialog,
// #withSettings
creditNoteTableSize,
}) {
@@ -92,6 +96,10 @@ function VendorsCreditNoteDataTable({
});
};
const handleRefundCreditVendor = ({ id }) => {
openDialog('refund-vendor-credit', { vendorCreditId: id });
};
return (
<DashboardContentTable>
<DataTable
@@ -118,6 +126,7 @@ function VendorsCreditNoteDataTable({
onViewDetails: handleViewDetailVendorCredit,
onDelete: handleDeleteVendorCreditNote,
onEdit: hanldeEditVendorCreditNote,
onRefund: handleRefundCreditVendor,
}}
/>
</DashboardContentTable>
@@ -129,6 +138,7 @@ export default compose(
withVendorsCreditNotesActions,
withAlertsActions,
withDrawerActions,
withDialogActions,
withSettings(({ vendorsCreditNoteSetting }) => ({
creditNoteTableSize: vendorsCreditNoteSetting?.tableSize,
})),

View File

@@ -25,7 +25,7 @@ import { formattedAmount, safeCallback, calculateStatus } from 'utils';
* Actions menu.
*/
export function ActionsMenu({
payload: { onEdit, onDelete, onViewDetails },
payload: { onEdit, onDelete, onRefund, onViewDetails },
row: { original },
}) {
return (
@@ -41,6 +41,11 @@ export function ActionsMenu({
text={intl.get('vendor_credits.action.edit_vendor_credit')}
onClick={safeCallback(onEdit, original)}
/>
<MenuItem
icon={<Icon icon="quick-payment-16" />}
text={intl.get('vendor_credits.action.refund_vendor_credit')}
onClick={safeCallback(onRefund, original)}
/>
<MenuItem
text={intl.get('vendor_credits.action.delete_vendor_credit')}
intent={Intent.DANGER}

View File

@@ -4,6 +4,10 @@ const VendorCreditDeleteAlert = React.lazy(() =>
import('../../Alerts/VendorCeditNotes/VendorCreditDeleteAlert'),
);
const RefundVendorCreditDeleteAlert = React.lazy(() =>
import('../../Alerts/VendorCeditNotes/RefundVendorCreditDeleteAlert'),
);
/**
* Vendor Credit notes alerts.
*/
@@ -12,4 +16,8 @@ export default [
name: 'vendor-credit-delete',
component: VendorCreditDeleteAlert,
},
{
name: 'refund-vendor-delete',
component: RefundVendorCreditDeleteAlert,
},
];