fix(webapp): use all drawers name from common enum object

This commit is contained in:
Ahmed Bouhuolia
2023-06-14 19:51:14 +02:00
parent 01c27b56ef
commit d1a09e3b15
99 changed files with 286 additions and 186 deletions

View File

@@ -31,6 +31,7 @@ import {
import { BillMenuItem } from './utils';
import { safeCallback, compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
function BillDetailActionsBar({
// #withDialogActions
@@ -49,7 +50,7 @@ function BillDetailActionsBar({
// Handle edit bill.
const onEditBill = () => {
history.push(`/bills/${billId}/edit`);
closeDrawer('bill-drawer');
closeDrawer(DRAWERS.BILL_DETAILS);
};
// Handle convert to vendor credit.
@@ -57,7 +58,7 @@ function BillDetailActionsBar({
history.push(`/vendor-credits/new?from_bill_id=${billId}`, {
billId: billId,
});
closeDrawer('bill-drawer');
closeDrawer(DRAWERS.BILL_DETAILS);
};
// Handle delete bill.

View File

@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useBill, useBillLocatedLandedCost } from '@/hooks/query';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
import { DRAWERS } from '@/constants/drawers';
const BillDrawerContext = React.createContext();
@@ -38,7 +39,7 @@ function BillDrawerProvider({ billId, ...props }) {
return (
<DrawerLoading loading={loading}>
<DrawerHeaderContent
name="bill-drawer"
name={DRAWERS.BILL_DETAILS}
title={intl.get('bill.drawer.title', {
number: bill.bill_number ? `(${bill.bill_number})` : null,
})}

View File

@@ -12,6 +12,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/**
* Bill payment transactions datatable.
@@ -48,7 +49,7 @@ function BillPaymentTransactionTable({
// Handles edit bill payment transactions.
const handleEditBillPaymentTransactions = ({ bill_payment_id }) => {
history.push(`/payment-mades/${bill_payment_id}/edit`);
closeDrawer('bill-drawer');
closeDrawer(DRAWERS.BILL_DETAILS);
};
return (

View File

@@ -11,12 +11,12 @@ import { useLocatedLandedCostColumns, ActionsMenu } from './components';
import { useBillDrawerContext } from './BillDrawerProvider';
import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { TableStyle } from '@/constants';
import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/**
* Located landed cost table.
@@ -25,9 +25,6 @@ function LocatedLandedCostTable({
// #withAlertsActions
openAlert,
// #withDialogActions
openDialog,
// #withDrawerActions
openDrawer,
}) {
@@ -48,12 +45,12 @@ function LocatedLandedCostTable({
switch (from_transaction_type) {
case 'Expense':
openDrawer('expense-drawer', { expenseId: from_transaction_id });
openDrawer(DRAWERS.EXPENSE_DETAILS, { expenseId: from_transaction_id });
break;
case 'Bill':
default:
openDrawer('bill-drawer', { billId: from_transaction_id });
openDrawer(DRAWERS.BILL_DETAILS, { billId: from_transaction_id });
break;
}
};
@@ -79,6 +76,5 @@ function LocatedLandedCostTable({
export default compose(
withAlertsActions,
withDialogActions,
withDrawerActions,
)(LocatedLandedCostTable);