From 1cba4b5f18a9e202746f0750624d353ba22c9268 Mon Sep 17 00:00:00 2001
From: elforjani13 <39470382+elforjani13@users.noreply.github.com>
Date: Tue, 23 Nov 2021 20:29:35 +0200
Subject: [PATCH] feat: add bill & payment made ability.
---
.../BillDrawer/BillDetailActionsBar.js | 56 ++++++++++------
.../PaymentMadeDetailActionsBar.js | 39 ++++++-----
.../Bills/BillsLanding/BillsActionsBar.js | 16 +++--
.../Bills/BillsLanding/components.js | 64 +++++++++++--------
.../PaymentsLanding/PaymentMadeActionsBar.js | 21 ++++--
.../PaymentsLanding/components.js | 36 +++++++----
6 files changed, 143 insertions(+), 89 deletions(-)
diff --git a/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js b/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js
index 8a14d3795..05d450b43 100644
--- a/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js
+++ b/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js
@@ -16,7 +16,12 @@ import withDialogActions from 'containers/Dialog/withDialogActions';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
-import { If, Icon, FormattedMessage as T } from 'components';
+import { Can, If, Icon, FormattedMessage as T } from 'components';
+import {
+ Bill_Abilities,
+ Payment_Made_Abilities,
+ AbilitySubject,
+} from '../../../common/abilityOption';
import { safeCallback, compose } from 'utils';
@@ -53,29 +58,38 @@ function BillDetailActionsBar({
return (
- }
- text={}
- onClick={safeCallback(onEditBill)}
- />
-
-
+
}
- text={}
- onClick={handleQuickBillPayment}
+ icon={}
+ text={}
+ onClick={safeCallback(onEditBill)}
/>
-
-
- }
- text={}
- intent={Intent.DANGER}
- onClick={safeCallback(onDeleteBill)}
- />
+
+
+
+
+ }
+ text={}
+ onClick={handleQuickBillPayment}
+ />
+
+
+
+
+ }
+ text={}
+ intent={Intent.DANGER}
+ onClick={safeCallback(onDeleteBill)}
+ />
+
);
diff --git a/src/containers/Drawers/PaymentMadeDetailDrawer/PaymentMadeDetailActionsBar.js b/src/containers/Drawers/PaymentMadeDetailDrawer/PaymentMadeDetailActionsBar.js
index 4c3d4eb47..8ad09b10f 100644
--- a/src/containers/Drawers/PaymentMadeDetailDrawer/PaymentMadeDetailActionsBar.js
+++ b/src/containers/Drawers/PaymentMadeDetailDrawer/PaymentMadeDetailActionsBar.js
@@ -16,8 +16,11 @@ import withDialogActions from 'containers/Dialog/withDialogActions';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
-import { Icon, FormattedMessage as T } from 'components';
-
+import { Can, Icon, FormattedMessage as T } from 'components';
+import {
+ Payment_Made_Abilities,
+ AbilitySubject,
+} from '../../../common/abilityOption';
import { compose } from 'utils';
/**
@@ -48,20 +51,24 @@ function PaymentMadeDetailActionsBar({
return (
- }
- text={}
- onClick={handleEditPaymentMade}
- />
-
- }
- text={}
- intent={Intent.DANGER}
- onClick={handleDeletePaymentMade}
- />
+
+ }
+ text={}
+ onClick={handleEditPaymentMade}
+ />
+
+
+
+ }
+ text={}
+ intent={Intent.DANGER}
+ onClick={handleDeletePaymentMade}
+ />
+
);
diff --git a/src/containers/Purchases/Bills/BillsLanding/BillsActionsBar.js b/src/containers/Purchases/Bills/BillsLanding/BillsActionsBar.js
index d021d63b2..78ca384f0 100644
--- a/src/containers/Purchases/Bills/BillsLanding/BillsActionsBar.js
+++ b/src/containers/Purchases/Bills/BillsLanding/BillsActionsBar.js
@@ -14,12 +14,14 @@ import { useHistory } from 'react-router-dom';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
import {
If,
+ Can,
FormattedMessage as T,
DashboardActionViewsList,
DashboardFilterButton,
AdvancedFilterPopover,
DashboardRowsHeightButton,
} from 'components';
+import { Bill_Abilities, AbilitySubject } from '../../../../common/abilityOption';
import withBillsActions from './withBillsActions';
import withBills from './withBills';
@@ -86,12 +88,14 @@ function BillActionsBar({
onChange={handleTabChange}
/>
- }
- text={}
- onClick={handleClickNewBill}
- />
+
+ }
+ text={}
+ onClick={handleClickNewBill}
+ />
+
-
- }
- text={intl.get('edit_bill')}
- onClick={safeCallback(onEdit, original)}
- />
+
+
+ }
+ text={intl.get('edit_bill')}
+ onClick={safeCallback(onEdit, original)}
+ />
-
- }
- text={intl.get('mark_as_opened')}
- onClick={safeCallback(onOpen, original)}
- />
-
-
- }
- text={intl.get('add_payment')}
- onClick={safeCallback(onQuick, original)}
- />
-
+
+ }
+ text={intl.get('mark_as_opened')}
+ onClick={safeCallback(onOpen, original)}
+ />
+
+
+
+
+ }
+ text={intl.get('add_payment')}
+ onClick={safeCallback(onQuick, original)}
+ />
+
+
}
text={intl.get('allocate_landed_coast')}
onClick={safeCallback(onAllocateLandedCost, original)}
/>
- }
- />
+
+ }
+ />
+
);
}
diff --git a/src/containers/Purchases/PaymentMades/PaymentsLanding/PaymentMadeActionsBar.js b/src/containers/Purchases/PaymentMades/PaymentsLanding/PaymentMadeActionsBar.js
index b3c8776c0..069833b27 100644
--- a/src/containers/Purchases/PaymentMades/PaymentsLanding/PaymentMadeActionsBar.js
+++ b/src/containers/Purchases/PaymentMades/PaymentsLanding/PaymentMadeActionsBar.js
@@ -14,6 +14,7 @@ import { useHistory } from 'react-router-dom';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
import {
If,
+ Can,
FormattedMessage as T,
DashboardActionViewsList,
DashboardFilterButton,
@@ -29,6 +30,10 @@ import withSettings from 'containers/Settings/withSettings';
import { usePaymentMadesListContext } from './PaymentMadesListProvider';
import { useRefreshPaymentMades } from 'hooks/query/paymentMades';
+import {
+ Payment_Made_Abilities,
+ AbilitySubject,
+} from '../../../../common/abilityOption';
import { compose } from 'utils';
@@ -70,7 +75,7 @@ function PaymentMadeActionsBar({
const handleRefreshBtnClick = () => {
refresh();
};
-
+
// Handle table row size change.
const handleTableRowSizeChange = (size) => {
addSetting('billPayments', 'tableSize', size);
@@ -85,12 +90,14 @@ function PaymentMadeActionsBar({
onChange={handleTabChange}
/>
- }
- text={}
- onClick={handleClickNewPaymentMade}
- />
+
+ }
+ text={}
+ onClick={handleClickNewPaymentMade}
+ />
+
-
- }
- text={intl.get('edit_payment_made')}
- onClick={safeCallback(onEdit, original)}
- />
- }
- />
+
+
+
+ }
+ text={intl.get('edit_payment_made')}
+ onClick={safeCallback(onEdit, original)}
+ />
+
+
+ }
+ />
+
);
}