diff --git a/packages/webapp/src/components/Customers/CustomerDrawerLink.tsx b/packages/webapp/src/components/Customers/CustomerDrawerLink.tsx
index 099ec0a5b..dc9f8965a 100644
--- a/packages/webapp/src/components/Customers/CustomerDrawerLink.tsx
+++ b/packages/webapp/src/components/Customers/CustomerDrawerLink.tsx
@@ -4,6 +4,7 @@ import * as R from 'ramda';
import { ButtonLink } from '../Button';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
function CustomerDrawerLinkComponent({
// #ownProps
@@ -16,7 +17,7 @@ function CustomerDrawerLinkComponent({
}) {
// Handle view customer drawer.
const handleCustomerDrawer = (event) => {
- openDrawer('customer-detail-drawer', { customerId });
+ openDrawer(DRAWERS.CUSTOMER_DETAILS, { customerId });
event.preventDefault();
};
diff --git a/packages/webapp/src/components/DrawersContainer.tsx b/packages/webapp/src/components/DrawersContainer.tsx
index af5267f63..2d1a372e8 100644
--- a/packages/webapp/src/components/DrawersContainer.tsx
+++ b/packages/webapp/src/components/DrawersContainer.tsx
@@ -31,28 +31,28 @@ import { DRAWERS } from '@/constants/drawers';
export default function DrawersContainer() {
return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
);
}
diff --git a/packages/webapp/src/components/Vendors/VendorDrawerLink.tsx b/packages/webapp/src/components/Vendors/VendorDrawerLink.tsx
index 909928f06..b0ff65daf 100644
--- a/packages/webapp/src/components/Vendors/VendorDrawerLink.tsx
+++ b/packages/webapp/src/components/Vendors/VendorDrawerLink.tsx
@@ -4,6 +4,7 @@ import * as R from 'ramda';
import { ButtonLink } from '../Button';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
function VendorDrawerLinkComponent({
// #ownProps
@@ -16,7 +17,7 @@ function VendorDrawerLinkComponent({
}) {
// Handle view customer drawer.
const handleVendorDrawer = (event) => {
- openDrawer('vendor-detail-drawer', { vendorId });
+ openDrawer(DRAWERS.VENDOR_DETAILS, { vendorId });
event.preventDefault();
};
diff --git a/packages/webapp/src/constants/drawers.ts b/packages/webapp/src/constants/drawers.ts
index 3d25e93ef..6663990be 100644
--- a/packages/webapp/src/constants/drawers.ts
+++ b/packages/webapp/src/constants/drawers.ts
@@ -1,25 +1,25 @@
// @ts-nocheck
export enum DRAWERS {
- ACCOUNT = 'account-drawer',
- JOURNAL = 'journal-drawer',
- EXPENSE = 'expense-drawer',
- BILL = 'bill-drawer',
- INVOICE = 'invoice-detail-drawer',
- RECEIPT = 'receipt-detail-drawer',
- PAYMENT_RECEIVE = 'payment-receive-detail-drawer',
- PAYMENT_MADE = 'payment-made-drawer',
- ESTIMATE = 'estimate-detail-drawer',
- ITEM = 'item-detail-drawer',
- CUSTOMER = 'customer-detail-drawer',
- VENDOR = 'vendor-detail-drawer',
- INVENTORY_ADJUSTMENT = 'inventory-adjustment-drawer',
- CASHFLOW_TRNASACTION = 'cashflow-transaction-drawer',
+ ACCOUNT_DETAILS = 'account-drawer',
+ JOURNAL_DETAILS = 'journal-drawer',
+ EXPENSE_DETAILS = 'expense-drawer',
+ BILL_DETAILS = 'bill-drawer',
+ INVOICE_DETAILS = 'invoice-detail-drawer',
+ RECEIPT_DETAILS = 'receipt-detail-drawer',
+ PAYMENT_RECEIVE_DETAILS = 'payment-receive-detail-drawer',
+ PAYMENT_MADE_DETAILS = 'payment-made-drawer',
+ ESTIMATE_DETAILS = 'estimate-detail-drawer',
+ ITEM_DETAILS = 'item-detail-drawer',
+ CUSTOMER_DETAILS = 'customer-detail-drawer',
+ VENDOR_DETAILS = 'vendor-detail-drawer',
+ INVENTORY_ADJUSTMENT_DETAILS = 'inventory-adjustment-drawer',
+ CASHFLOW_TRNASACTION_DETAILS = 'cashflow-transaction-drawer',
QUICK_CREATE_CUSTOMER = 'quick-create-customer',
QUICK_CREATE_ITEM = 'quick-create-item',
QUICK_WRITE_VENDOR = 'quick-write-vendor',
- CREDIT_NOTE = 'credit-note-detail-drawer',
- VENDOR_CREDIT = 'vendor-credit-detail-drawer',
- REFUND_CREDIT_NOTE = 'refund-credit-detail-drawer',
- REFUND_VENDOR_CREDIT = 'refund-vendor-detail-drawer',
- WAREHOUSE_TRANSFER = 'warehouse-transfer-detail-drawer',
+ CREDIT_NOTE_DETAILS = 'credit-note-detail-drawer',
+ VENDOR_CREDIT_DETAILS = 'vendor-credit-detail-drawer',
+ REFUND_CREDIT_NOTE_DETAILS = 'refund-credit-detail-drawer',
+ REFUND_VENDOR_CREDIT_DETAILS = 'refund-vendor-detail-drawer',
+ WAREHOUSE_TRANSFER_DETAILS = 'warehouse-transfer-detail-drawer',
}
diff --git a/packages/webapp/src/containers/Accounting/JournalsLanding/ManualJournalsDataTable.tsx b/packages/webapp/src/containers/Accounting/JournalsLanding/ManualJournalsDataTable.tsx
index 7f4f14f2f..9aad7d99c 100644
--- a/packages/webapp/src/containers/Accounting/JournalsLanding/ManualJournalsDataTable.tsx
+++ b/packages/webapp/src/containers/Accounting/JournalsLanding/ManualJournalsDataTable.tsx
@@ -25,6 +25,7 @@ import { useMemorizedColumnsWidths } from '@/hooks';
import { useManualJournalsColumns } from './utils';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Manual journals data-table.
@@ -79,14 +80,16 @@ function ManualJournalsDataTable({
// Handle view detail journal.
const handleViewDetailJournal = ({ id }) => {
- openDrawer('journal-drawer', {
+ openDrawer(DRAWERS.JOURNAL_DETAILS, {
manualJournalId: id,
});
};
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('journal-drawer', { manualJournalId: cell.row.original.id });
+ openDrawer(DRAWERS.JOURNAL_DETAILS, {
+ manualJournalId: cell.row.original.id,
+ });
};
// Local storage memorizing columns widths.
diff --git a/packages/webapp/src/containers/Accounting/ManualJournalUniversalSearch.tsx b/packages/webapp/src/containers/Accounting/ManualJournalUniversalSearch.tsx
index 60c623ccc..cdd68ad09 100644
--- a/packages/webapp/src/containers/Accounting/ManualJournalUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Accounting/ManualJournalUniversalSearch.tsx
@@ -3,6 +3,7 @@ import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, ManualJournalAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
/**
* Universal search manual journal item select action.
@@ -17,7 +18,7 @@ function JournalUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.MANUAL_JOURNAL) {
- openDrawer('journal-drawer', { manualJournalId: resourceId });
+ openDrawer(DRAWERS.JOURNAL_DETAILS, { manualJournalId: resourceId });
onAction && onAction();
}
return null;
diff --git a/packages/webapp/src/containers/Accounts/AccountUniversalSearch.tsx b/packages/webapp/src/containers/Accounts/AccountUniversalSearch.tsx
index cb3701a3c..67cb1a5dc 100644
--- a/packages/webapp/src/containers/Accounts/AccountUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Accounts/AccountUniversalSearch.tsx
@@ -5,6 +5,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { AbilitySubject, AccountAction } from '@/constants/abilityOption';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
+import { DRAWERS } from '@/constants/drawers';
function AccountUniversalSearchItemSelectComponent({
// #ownProps
@@ -16,7 +17,7 @@ function AccountUniversalSearchItemSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.ACCOUNT) {
- openDrawer('account-drawer', { accountId: resourceId });
+ openDrawer(DRAWERS.ACCOUNT_DETAILS, { accountId: resourceId });
onAction && onAction();
}
return null;
@@ -28,8 +29,8 @@ export const AccountUniversalSearchItemSelect = withDrawerActions(
/**
* Transformes account item to search item.
- * @param {*} account
- * @returns
+ * @param {*} account
+ * @returns
*/
const accountToSearch = (account) => ({
id: account.id,
diff --git a/packages/webapp/src/containers/Accounts/AccountsDataTable.tsx b/packages/webapp/src/containers/Accounts/AccountsDataTable.tsx
index 2c5270c34..dfa4b90be 100644
--- a/packages/webapp/src/containers/Accounts/AccountsDataTable.tsx
+++ b/packages/webapp/src/containers/Accounts/AccountsDataTable.tsx
@@ -23,6 +23,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Accounts data-table.
@@ -71,7 +72,7 @@ function AccountsDataTable({
// Handle view detail account.
const handleViewDetailAccount = ({ id }) => {
- openDrawer('account-drawer', { accountId: id });
+ openDrawer(DRAWERS.ACCOUNT_DETAILS, { accountId: id });
};
// Handle new child button click.
@@ -84,7 +85,7 @@ function AccountsDataTable({
};
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('account-drawer', { accountId: cell.row.original.id });
+ openDrawer(DRAWERS.ACCOUNT_DETAILS, { accountId: cell.row.original.id });
};
// Local storage memorizing columns widths.
const [initialColumnsWidths, , handleColumnResizing] =
diff --git a/packages/webapp/src/containers/Alerts/Accounts/AccountDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/Accounts/AccountDeleteAlert.tsx
index 6ac79a11a..352081444 100644
--- a/packages/webapp/src/containers/Alerts/Accounts/AccountDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/Accounts/AccountDeleteAlert.tsx
@@ -16,6 +16,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeleteAccount } from '@/hooks/query';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Account delete alerts.
@@ -48,7 +49,7 @@ function AccountDeleteAlert({
intent: Intent.SUCCESS,
});
closeAlert(name);
- closeDrawer('account-drawer');
+ closeDrawer(DRAWERS.ACCOUNT_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/Bills/BillDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/Bills/BillDeleteAlert.tsx
index 8d972b439..b1acd287a 100644
--- a/packages/webapp/src/containers/Alerts/Bills/BillDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/Bills/BillDeleteAlert.tsx
@@ -11,6 +11,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { handleDeleteErrors } from '@/containers/Purchases/Bills/BillForm/utils';
import { useDeleteBill } from '@/hooks/query';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Bill delete alert.
@@ -43,8 +44,7 @@ function BillDeleteAlert({
message: intl.get('the_bill_has_been_deleted_successfully'),
intent: Intent.SUCCESS,
});
-
- closeDrawer('bill-drawer');
+ closeDrawer(DRAWERS.BILL_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/CashFlow/AccountDeleteTransactionAlert.tsx b/packages/webapp/src/containers/Alerts/CashFlow/AccountDeleteTransactionAlert.tsx
index a26038764..02df2c71c 100644
--- a/packages/webapp/src/containers/Alerts/CashFlow/AccountDeleteTransactionAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/CashFlow/AccountDeleteTransactionAlert.tsx
@@ -15,6 +15,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Account delete transaction alert.
@@ -48,7 +49,7 @@ function AccountDeleteTransactionAlert({
message: intl.get('cash_flow_transaction.delete.alert_message'),
intent: Intent.SUCCESS,
});
- closeDrawer('cashflow-transaction-drawer');
+ closeDrawer(DRAWERS.CASHFLOW_TRNASACTION_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/CreditNotes/CreditNoteDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/CreditNotes/CreditNoteDeleteAlert.tsx
index 7536b9631..f8c2ba341 100644
--- a/packages/webapp/src/containers/Alerts/CreditNotes/CreditNoteDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/CreditNotes/CreditNoteDeleteAlert.tsx
@@ -15,6 +15,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeleteCreditNote } from '@/hooks/query';
import { handleDeleteErrors } from '@/containers/Sales/CreditNotes/CreditNotesLanding/utils';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Credit note delete alert.
@@ -46,7 +47,7 @@ function CreditNoteDeleteAlert({
message: intl.get('credit_note.alert.delete_message'),
intent: Intent.SUCCESS,
});
- closeDrawer('credit-note-detail-drawer');
+ closeDrawer(DRAWERS.CREDIT_NOTE_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/CreditNotes/RefundCreditNoteDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/CreditNotes/RefundCreditNoteDeleteAlert.tsx
index 6af08e01d..7ee5aa8de 100644
--- a/packages/webapp/src/containers/Alerts/CreditNotes/RefundCreditNoteDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/CreditNotes/RefundCreditNoteDeleteAlert.tsx
@@ -11,6 +11,7 @@ import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Refund credit transactions delete alert
@@ -42,7 +43,7 @@ function RefundCreditNoteDeleteAlert({
message: intl.get('refund_credit_transactions.alert.delete_message'),
intent: Intent.SUCCESS,
});
- closeDrawer('refund-credit-detail-drawer');
+ closeDrawer(DRAWERS.REFUND_CREDIT_NOTE_DETAILS);
})
.catch(() => {})
.finally(() => {
diff --git a/packages/webapp/src/containers/Alerts/Customers/CustomerDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/Customers/CustomerDeleteAlert.tsx
index b65964870..57d343e43 100644
--- a/packages/webapp/src/containers/Alerts/Customers/CustomerDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/Customers/CustomerDeleteAlert.tsx
@@ -15,6 +15,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeleteCustomer } from '@/hooks/query';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Customer delete alert.
@@ -47,7 +48,7 @@ function CustomerDeleteAlert({
message: intl.get('the_customer_has_been_deleted_successfully'),
intent: Intent.SUCCESS,
});
- closeDrawer('customer-detail-drawer');
+ closeDrawer(DRAWERS.CUSTOMER_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/Estimates/EstimateDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/Estimates/EstimateDeleteAlert.tsx
index ff2c8c30b..7ef7e5a41 100644
--- a/packages/webapp/src/containers/Alerts/Estimates/EstimateDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/Estimates/EstimateDeleteAlert.tsx
@@ -15,6 +15,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Estimate delete alert.
@@ -47,7 +48,7 @@ function EstimateDeleteAlert({
message: intl.get('the_estimate_has_been_deleted_successfully'),
intent: Intent.SUCCESS,
});
- closeDrawer('estimate-detail-drawer');
+ closeDrawer(DRAWERS.ESTIMATE_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/Expenses/ExpenseDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/Expenses/ExpenseDeleteAlert.tsx
index f2bc19890..84985060f 100644
--- a/packages/webapp/src/containers/Alerts/Expenses/ExpenseDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/Expenses/ExpenseDeleteAlert.tsx
@@ -10,6 +10,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeleteExpense } from '@/hooks/query';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Expense delete alert.
@@ -42,7 +43,7 @@ function ExpenseDeleteAlert({
}),
intent: Intent.SUCCESS,
});
- closeDrawer('expense-drawer');
+ closeDrawer(DRAWERS.EXPENSE_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/Invoices/InvoiceDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/Invoices/InvoiceDeleteAlert.tsx
index 7b03f9950..17d4c7b3c 100644
--- a/packages/webapp/src/containers/Alerts/Invoices/InvoiceDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/Invoices/InvoiceDeleteAlert.tsx
@@ -16,6 +16,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Invoice delete alert.
@@ -48,7 +49,7 @@ function InvoiceDeleteAlert({
message: intl.get('the_invoice_has_been_deleted_successfully'),
intent: Intent.SUCCESS,
});
- closeDrawer('invoice-detail-drawer');
+ closeDrawer(DRAWERS.INVOICE_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.tsx
index b412f4a92..dfedafa80 100644
--- a/packages/webapp/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.tsx
@@ -14,6 +14,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeleteInventoryAdjustment } from '@/hooks/query';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Inventory Adjustment delete alerts.
@@ -49,7 +50,7 @@ function InventoryAdjustmentDeleteAlert({
),
intent: Intent.SUCCESS,
});
- closeDrawer('inventory-adjustment-drawer');
+ closeDrawer(DRAWERS.INVENTORY_ADJUSTMENT_DETAILS);
})
.catch((errors) => {})
.finally(() => {
diff --git a/packages/webapp/src/containers/Alerts/Items/ItemDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/Items/ItemDeleteAlert.tsx
index af2425f8f..6d1d46f71 100644
--- a/packages/webapp/src/containers/Alerts/Items/ItemDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/Items/ItemDeleteAlert.tsx
@@ -17,6 +17,7 @@ import withItemsActions from '@/containers/Items/withItemsActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Item delete alerts.
@@ -54,7 +55,7 @@ function ItemDeleteAlert({
});
// Reset to page number one.
setItemsTableState({ page: 1 });
- closeDrawer('item-detail-drawer');
+ closeDrawer(DRAWERS.ITEM_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/ManualJournals/JournalDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/ManualJournals/JournalDeleteAlert.tsx
index 922767d7b..741bd05e6 100644
--- a/packages/webapp/src/containers/Alerts/ManualJournals/JournalDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/ManualJournals/JournalDeleteAlert.tsx
@@ -10,6 +10,7 @@ import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Journal delete alert.
@@ -45,7 +46,7 @@ function JournalDeleteAlert({
intent: Intent.SUCCESS,
});
closeAlert(name);
- closeDrawer('journal-drawer');
+ closeDrawer(DRAWERS.JOURNAL_DETAILS);
})
.catch(() => {
closeAlert(name);
diff --git a/packages/webapp/src/containers/Alerts/PaymentMades/PaymentMadeDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/PaymentMades/PaymentMadeDeleteAlert.tsx
index 32b0c32c7..1a89b782a 100644
--- a/packages/webapp/src/containers/Alerts/PaymentMades/PaymentMadeDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/PaymentMades/PaymentMadeDeleteAlert.tsx
@@ -11,6 +11,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeletePaymentMade } from '@/hooks/query';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Payment made delete alert.
@@ -44,7 +45,7 @@ function PaymentMadeDeleteAlert({
message: intl.get('the_payment_made_has_been_deleted_successfully'),
intent: Intent.SUCCESS,
});
- closeDrawer('payment-made-detail-drawer');
+ closeDrawer(DRAWERS.PAYMENT_MADE_DETAILS);
})
.finally(() => {
closeAlert(name);
diff --git a/packages/webapp/src/containers/Alerts/PaymentReceives/PaymentReceiveDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/PaymentReceives/PaymentReceiveDeleteAlert.tsx
index f7fe58471..ad360a66f 100644
--- a/packages/webapp/src/containers/Alerts/PaymentReceives/PaymentReceiveDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/PaymentReceives/PaymentReceiveDeleteAlert.tsx
@@ -15,6 +15,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Payment receive delete alert.
@@ -50,7 +51,7 @@ function PaymentReceiveDeleteAlert({
),
intent: Intent.SUCCESS,
});
- closeDrawer('payment-receive-detail-drawer');
+ closeDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS);
})
.catch(() => {})
.finally(() => {
diff --git a/packages/webapp/src/containers/Alerts/Receipts/ReceiptDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/Receipts/ReceiptDeleteAlert.tsx
index 124b6b451..e5a3b42c4 100644
--- a/packages/webapp/src/containers/Alerts/Receipts/ReceiptDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/Receipts/ReceiptDeleteAlert.tsx
@@ -15,6 +15,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Invoice alert.
@@ -47,7 +48,7 @@ function NameDeleteAlert({
message: intl.get('the_receipt_has_been_deleted_successfully'),
intent: Intent.SUCCESS,
});
- closeDrawer('receipt-detail-drawer');
+ closeDrawer(DRAWERS.RECEIPT_DETAILS);
})
.catch(() => {})
.finally(() => {
diff --git a/packages/webapp/src/containers/Alerts/VendorCeditNotes/RefundVendorCreditDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/VendorCeditNotes/RefundVendorCreditDeleteAlert.tsx
index a8cf4fc4e..1a3388ad5 100644
--- a/packages/webapp/src/containers/Alerts/VendorCeditNotes/RefundVendorCreditDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/VendorCeditNotes/RefundVendorCreditDeleteAlert.tsx
@@ -10,6 +10,7 @@ import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Refund Vendor transactions delete alert.
@@ -43,7 +44,7 @@ function RefundVendorCreditDeleteAlert({
),
intent: Intent.SUCCESS,
});
- closeDrawer('refund-vendor-detail-drawer');
+ closeDrawer(DRAWERS.REFUND_VENDOR_CREDIT_DETAILS);
})
.catch(() => {})
.finally(() => {
diff --git a/packages/webapp/src/containers/Alerts/VendorCeditNotes/VendorCreditDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/VendorCeditNotes/VendorCreditDeleteAlert.tsx
index 440c5972c..35d2f76c6 100644
--- a/packages/webapp/src/containers/Alerts/VendorCeditNotes/VendorCreditDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/VendorCeditNotes/VendorCreditDeleteAlert.tsx
@@ -14,6 +14,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { handleDeleteErrors } from '@/containers/Purchases/CreditNotes/CreditNotesLanding/utils';
import { useDeleteVendorCredit } from '@/hooks/query';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Vendor Credit delete alert.
@@ -45,7 +46,7 @@ function VendorCreditDeleteAlert({
message: intl.get('vendor_credits.alert.delete_message'),
intent: Intent.SUCCESS,
});
- closeDrawer('vendor-credit-detail-drawer');
+ closeDrawer(DRAWERS.VENDOR_CREDIT_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/Vendors/VendorDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/Vendors/VendorDeleteAlert.tsx
index d170a34ec..cfa1323d2 100644
--- a/packages/webapp/src/containers/Alerts/Vendors/VendorDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/Vendors/VendorDeleteAlert.tsx
@@ -16,6 +16,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Vendor delete alert.
@@ -48,7 +49,7 @@ function VendorDeleteAlert({
message: intl.get('the_vendor_has_been_deleted_successfully'),
intent: Intent.SUCCESS,
});
- closeDrawer('vendor-detail-drawer');
+ closeDrawer(DRAWERS.VENDOR_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/Alerts/WarehousesTransfer/WarehouseTransferDeleteAlert.tsx b/packages/webapp/src/containers/Alerts/WarehousesTransfer/WarehouseTransferDeleteAlert.tsx
index 317c04ef4..fbe2cad3d 100644
--- a/packages/webapp/src/containers/Alerts/WarehousesTransfer/WarehouseTransferDeleteAlert.tsx
+++ b/packages/webapp/src/containers/Alerts/WarehousesTransfer/WarehouseTransferDeleteAlert.tsx
@@ -14,6 +14,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Warehouse transfer delete alert
@@ -48,7 +49,7 @@ function WarehouseTransferDeleteAlert({
message: intl.get('warehouse_transfer.alert.delete_message'),
intent: Intent.SUCCESS,
});
- closeDrawer('warehouse-transfer-detail-drawer');
+ closeDrawer(DRAWERS.WAREHOUSE_TRANSFER_DETAILS);
})
.catch(
({
diff --git a/packages/webapp/src/containers/CashFlow/AccountTransactions/utils.tsx b/packages/webapp/src/containers/CashFlow/AccountTransactions/utils.tsx
index 924db13b4..c76ebb813 100644
--- a/packages/webapp/src/containers/CashFlow/AccountTransactions/utils.tsx
+++ b/packages/webapp/src/containers/CashFlow/AccountTransactions/utils.tsx
@@ -9,6 +9,7 @@ import {
import { Select } from '@blueprintjs/select';
import { Icon } from '@/components';
+import { DRAWERS } from '@/constants/drawers';
export const CashFlowMenuItems = ({
text,
@@ -53,40 +54,40 @@ export const CashFlowMenuItems = ({
export const handleCashFlowTransactionType = (reference, openDrawer) => {
switch (reference.reference_type) {
case 'SaleReceipt':
- return openDrawer('receipt-detail-drawer', {
+ return openDrawer(DRAWERS.RECEIPT_DETAILS, {
receiptId: reference.reference_id,
});
case 'Journal':
- return openDrawer('journal-drawer', {
+ return openDrawer(DRAWERS.JOURNAL_DETAILS, {
manualJournalId: reference.reference_id,
});
case 'Expense':
- return openDrawer('expense-drawer', {
+ return openDrawer(DRAWERS.EXPENSE_DETAILS, {
expenseId: reference.reference_id,
});
case 'PaymentReceive':
- return openDrawer('payment-receive-detail-drawer', {
+ return openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, {
paymentReceiveId: reference.reference_id,
});
case 'BillPayment':
- return openDrawer('payment-made-detail-drawer', {
+ return openDrawer(DRAWERS.PAYMENT_MADE_DETAILS, {
paymentMadeId: reference.reference_id,
});
case 'RefundCreditNote':
- return openDrawer('refund-credit-detail-drawer', {
+ return openDrawer(DRAWERS.REFUND_CREDIT_NOTE_DETAILS, {
refundTransactionId: reference.reference_id,
});
case 'RefundVendorCredit':
- return openDrawer('refund-vendor-detail-drawer', {
+ return openDrawer(DRAWERS.REFUND_VENDOR_CREDIT_DETAILS, {
refundTransactionId: reference.reference_id,
});
case 'InventoryAdjustment':
- return openDrawer('inventory-adjustment-drawer', {
+ return openDrawer(DRAWERS.INVENTORY_ADJUSTMENT_DETAILS, {
inventoryId: reference.reference_id,
});
default:
- return openDrawer('cashflow-transaction-drawer', {
+ return openDrawer(DRAWERS.CASHFLOW_TRNASACTION_DETAILS, {
referenceId: reference.reference_id,
});
}
diff --git a/packages/webapp/src/containers/CashFlow/CashFlowAccounts/CashflowAccountsGrid.tsx b/packages/webapp/src/containers/CashFlow/CashFlowAccounts/CashflowAccountsGrid.tsx
index 18f7cbd4e..9e05e3585 100644
--- a/packages/webapp/src/containers/CashFlow/CashFlowAccounts/CashflowAccountsGrid.tsx
+++ b/packages/webapp/src/containers/CashFlow/CashFlowAccounts/CashflowAccountsGrid.tsx
@@ -28,6 +28,7 @@ import withDialogActions from '@/containers/Dialog/withDialogActions';
import { AccountDialogAction } from '@/containers/Dialogs/AccountDialog/utils';
import { safeCallback } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
const CASHFLOW_SKELETON_N = 4;
@@ -63,7 +64,7 @@ function CashflowBankAccount({
}) {
// Handle view detail account.
const handleViewClick = () => {
- openDrawer('account-drawer', { accountId: account.id });
+ openDrawer(DRAWERS.ACCOUNT_DETAILS, { accountId: account.id });
};
// Handle delete action account.
const handleDeleteClick = () => {
diff --git a/packages/webapp/src/containers/Customers/CustomersLanding/CustomersTable.tsx b/packages/webapp/src/containers/Customers/CustomersLanding/CustomersTable.tsx
index f886e4eab..ac94d7500 100644
--- a/packages/webapp/src/containers/Customers/CustomersLanding/CustomersTable.tsx
+++ b/packages/webapp/src/containers/Customers/CustomersLanding/CustomersTable.tsx
@@ -24,6 +24,7 @@ import { useCustomersListContext } from './CustomersListProvider';
import { useMemorizedColumnsWidths } from '@/hooks';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Customers table.
@@ -108,12 +109,12 @@ function CustomersTable({
// Handle view detail contact.
const handleViewDetailCustomer = ({ id }) => {
- openDrawer('customer-detail-drawer', { customerId: id });
+ openDrawer(DRAWERS.CUSTOMER_DETAILS, { customerId: id });
};
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('customer-detail-drawer', { customerId: cell.row.original.id });
+ openDrawer(DRAWERS.CUSTOMER_DETAILS, { customerId: cell.row.original.id });
};
if (isEmptyStatus) {
diff --git a/packages/webapp/src/containers/Customers/CustomersUniversalSearch.tsx b/packages/webapp/src/containers/Customers/CustomersUniversalSearch.tsx
index a1574564d..5c34a6628 100644
--- a/packages/webapp/src/containers/Customers/CustomersUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Customers/CustomersUniversalSearch.tsx
@@ -2,9 +2,11 @@
import intl from 'react-intl-universal';
import { AbilitySubject, CustomerAction } from '@/constants/abilityOption';
-import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
+import { DRAWERS } from '@/constants/drawers';
+
function CustomerUniversalSearchSelectComponent({
resourceType,
resourceId,
@@ -14,7 +16,7 @@ function CustomerUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.CUSTOMER) {
- openDrawer('customer-detail-drawer', { customerId: resourceId });
+ openDrawer(DRAWERS.CUSTOMER_DETAILS, { customerId: resourceId });
onAction && onAction();
}
return null;
diff --git a/packages/webapp/src/containers/Drawers/AccountDrawer/AccountDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/AccountDrawer/AccountDrawerProvider.tsx
index 62f7fa66f..607a59bd4 100644
--- a/packages/webapp/src/containers/Drawers/AccountDrawer/AccountDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/AccountDrawer/AccountDrawerProvider.tsx
@@ -2,6 +2,7 @@
import React from 'react';
import { useAccount, useAccountTransactions } from '@/hooks/query';
import { DrawerHeaderContent, DrawerLoading } from '@/components';
+import { DRAWERS } from '@/constants/drawers';
const AccountDrawerContext = React.createContext();
@@ -33,7 +34,7 @@ function AccountDrawerProvider({ accountId, name, ...props }) {
return (
-
+
);
diff --git a/packages/webapp/src/containers/Drawers/BillDrawer/BillDetailActionsBar.tsx b/packages/webapp/src/containers/Drawers/BillDrawer/BillDetailActionsBar.tsx
index 0a73fb9d2..83b33906a 100644
--- a/packages/webapp/src/containers/Drawers/BillDrawer/BillDetailActionsBar.tsx
+++ b/packages/webapp/src/containers/Drawers/BillDrawer/BillDetailActionsBar.tsx
@@ -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.
diff --git a/packages/webapp/src/containers/Drawers/BillDrawer/BillDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/BillDrawer/BillDrawerProvider.tsx
index 8047f8893..4ed8620a8 100644
--- a/packages/webapp/src/containers/Drawers/BillDrawer/BillDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/BillDrawer/BillDrawerProvider.tsx
@@ -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 (
{
history.push(`/payment-mades/${bill_payment_id}/edit`);
- closeDrawer('bill-drawer');
+ closeDrawer(DRAWERS.BILL_DETAILS);
};
return (
diff --git a/packages/webapp/src/containers/Drawers/BillDrawer/LocatedLandedCostTable.tsx b/packages/webapp/src/containers/Drawers/BillDrawer/LocatedLandedCostTable.tsx
index 7d050d917..7b0d25ab1 100644
--- a/packages/webapp/src/containers/Drawers/BillDrawer/LocatedLandedCostTable.tsx
+++ b/packages/webapp/src/containers/Drawers/BillDrawer/LocatedLandedCostTable.tsx
@@ -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);
diff --git a/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerProvider.tsx
index 4d4f69c58..567455785 100644
--- a/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerProvider.tsx
@@ -4,6 +4,7 @@ import intl from 'react-intl-universal';
import { useCashflowTransaction } from '@/hooks/query';
import { DrawerLoading, DrawerHeaderContent } from '@/components';
+import { DRAWERS } from '@/constants/drawers';
const CashflowTransactionDrawerContext = React.createContext();
@@ -32,7 +33,7 @@ function CashflowTransactionDrawerProvider({ referenceId, ...props }) {
return (
{
history.push(`/credit-notes/${creditNoteId}/edit`);
- closeDrawer('credit-note-detail-drawer');
+ closeDrawer(DRAWERS.CREDIT_NOTE_DETAILS);
};
const handleRefundCreditNote = () => {
diff --git a/packages/webapp/src/containers/Drawers/CreditNoteDetailDrawer/CreditNoteDetailDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/CreditNoteDetailDrawer/CreditNoteDetailDrawerProvider.tsx
index a27b8b280..ec80c726b 100644
--- a/packages/webapp/src/containers/Drawers/CreditNoteDetailDrawer/CreditNoteDetailDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/CreditNoteDetailDrawer/CreditNoteDetailDrawerProvider.tsx
@@ -10,6 +10,7 @@ import {
import { Features } from '@/constants';
import { useFeatureCan } from '@/hooks/state';
import { DrawerHeaderContent, DrawerLoading } from '@/components';
+import { DRAWERS } from '@/constants/drawers';
const CreditNoteDetailDrawerContext = React.createContext();
@@ -72,7 +73,7 @@ function CreditNoteDetailDrawerProvider({ creditNoteId, ...props }) {
}
>
{
history.push('/invoices/new');
- closeDrawer('customer-detail-drawer');
+ closeDrawer(DRAWERS.CUSTOMER_DETAILS);
};
// Handle new receipt button click.
const handleNewReceiptClick = () => {
history.push('/receipts/new');
- closeDrawer('customer-detail-drawer');
+ closeDrawer(DRAWERS.CUSTOMER_DETAILS);
};
// Handle new payment receive button click.
const handleNewPaymentClick = () => {
history.push('/payment-receives/new');
- closeDrawer('customer-detail-drawer');
+ closeDrawer(DRAWERS.CUSTOMER_DETAILS);
};
// Handle new estimate button click.
const handleNewEstimateClick = () => {
history.push('/estimates/new');
- closeDrawer('customer-detail-drawer');
+ closeDrawer(DRAWERS.CUSTOMER_DETAILS);
};
// Handles delete customer click.
const handleDeleteCustomer = () => {
@@ -82,7 +83,7 @@ function CustomerDetailsActionsBar({
// Handles edit customer click.
const handleEditContact = () => {
history.push(`/customers/${customerId}/edit`);
- closeDrawer('customer-details-drawer');
+ closeDrawer(DRAWERS.CUSTOMER_DETAILS);
};
// Handle edit opening balance click.
const handleEditOpeningBalance = () => {
diff --git a/packages/webapp/src/containers/Drawers/CustomerDetailsDrawer/CustomerDetailsDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/CustomerDetailsDrawer/CustomerDetailsDrawerProvider.tsx
index 1468ce748..cc3b87e24 100644
--- a/packages/webapp/src/containers/Drawers/CustomerDetailsDrawer/CustomerDetailsDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/CustomerDetailsDrawer/CustomerDetailsDrawerProvider.tsx
@@ -2,6 +2,7 @@
import React from 'react';
import { useCustomer } from '@/hooks/query';
import { DrawerHeaderContent, DrawerLoading } from '@/components';
+import { DRAWERS } from '@/constants/drawers';
const ContactDetailDrawerContext = React.createContext();
@@ -26,7 +27,7 @@ function CustomerDetailsDrawerProvider({ customerId, ...props }) {
return (
diff --git a/packages/webapp/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.tsx b/packages/webapp/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.tsx
index c8c7ca06f..6f1ca3e91 100644
--- a/packages/webapp/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.tsx
+++ b/packages/webapp/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.tsx
@@ -25,6 +25,7 @@ import {
} from '@/components';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Estimate read-only details actions bar of the drawer.
@@ -48,7 +49,7 @@ function EstimateDetailActionsBar({
// Handle edit sale estimate.
const handleEditEstimate = () => {
history.push(`/estimates/${estimateId}/edit`);
- closeDrawer('estimate-detail-drawer');
+ closeDrawer(DRAWERS.ESTIMATE_DETAILS);
};
// Handle delete sale estimate.
diff --git a/packages/webapp/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailDrawerProvider.tsx
index 8bf449324..959c2f451 100644
--- a/packages/webapp/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailDrawerProvider.tsx
@@ -5,6 +5,7 @@ import { Features } from '@/constants';
import { useEstimate } from '@/hooks/query';
import { useFeatureCan } from '@/hooks/state';
import { DrawerHeaderContent, DrawerLoading } from '@/components';
+import { DRAWERS } from '@/constants/drawers';
const EstimateDetailDrawerContext = React.createContext();
@@ -29,7 +30,7 @@ function EstimateDetailDrawerProvider({ estimateId, ...props }) {
return (
{
history.push(`/expenses/${expense.id}/edit`);
- closeDrawer('expense-drawer');
+ closeDrawer(DRAWERS.EXPENSE_DETAILS);
};
// Handle the expense delete action.
diff --git a/packages/webapp/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerProvider.tsx
index 4373db16d..123dc3da7 100644
--- a/packages/webapp/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/ExpenseDrawer/ExpenseDrawerProvider.tsx
@@ -5,6 +5,7 @@ import { useExpense } from '@/hooks/query';
import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { Features } from '@/constants';
import { useFeatureCan } from '@/hooks/state';
+import { DRAWERS } from '@/constants/drawers';
const ExpenseDrawerDrawerContext = React.createContext();
@@ -36,7 +37,7 @@ function ExpenseDrawerProvider({ expenseId, ...props }) {
return (
diff --git a/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailActionsBar.tsx b/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailActionsBar.tsx
index 1a3dbc7bd..425664b10 100644
--- a/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailActionsBar.tsx
+++ b/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailActionsBar.tsx
@@ -30,6 +30,7 @@ import {
import { compose } from '@/utils';
import { BadDebtMenuItem } from './utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Invoice details action bar.
@@ -52,7 +53,7 @@ function InvoiceDetailActionsBar({
// Handle edit sale invoice.
const handleEditInvoice = () => {
history.push(`/invoices/${invoiceId}/edit`);
- closeDrawer('invoice-detail-drawer');
+ closeDrawer(DRAWERS.INVOICE_DETAILS);
};
// Handle convert to invoice.
@@ -60,7 +61,7 @@ function InvoiceDetailActionsBar({
history.push(`/credit-notes/new?from_invoice_id=${invoiceId}`, {
invoiceId: invoiceId,
});
- closeDrawer('invoice-detail-drawer');
+ closeDrawer(DRAWERS.INVOICE_DETAILS);
};
// Handle delete sale invoice.
diff --git a/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailDrawerProvider.tsx
index 46e3462af..77f8e7ab6 100644
--- a/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailDrawerProvider.tsx
@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { Features } from '@/constants';
import { useInvoice } from '@/hooks/query';
import { useFeatureCan } from '@/hooks/state';
+import { DRAWERS } from '@/constants/drawers';
const InvoiceDetailDrawerContext = React.createContext();
/**
@@ -28,7 +29,7 @@ function InvoiceDetailDrawerProvider({ invoiceId, ...props }) {
return (
{
history.push(`/payment-receives/${payment_receive_id}/edit`);
- closeDrawer('invoice-detail-drawer');
+ closeDrawer(DRAWERS.INVOICE_DETAILS);
};
return (
diff --git a/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemDetailActionsBar.tsx b/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemDetailActionsBar.tsx
index 0213e8509..732b977a0 100644
--- a/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemDetailActionsBar.tsx
+++ b/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemDetailActionsBar.tsx
@@ -23,6 +23,7 @@ import {
} from '@/components';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Item action-bar of readonly details drawer.
@@ -42,7 +43,7 @@ function ItemDetailActionsBar({
// Handle edit item.
const handleEditItem = () => {
history.push(`/items/${itemId}/edit`);
- closeDrawer('item-detail-drawer');
+ closeDrawer(DRAWERS.ITEM_DETAILS);
};
// Handle delete item.
diff --git a/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemDetailDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemDetailDrawerProvider.tsx
index 7e8e629b7..6a3abd4e8 100644
--- a/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemDetailDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemDetailDrawerProvider.tsx
@@ -3,6 +3,7 @@ import React from 'react';
import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useItem } from '@/hooks/query';
import { inactiveStatus } from './utlis';
+import { DRAWERS } from '@/constants/drawers';
const ItemDetailDrawerContext = React.createContext();
@@ -30,7 +31,7 @@ function ItemDetailDrawerProvider({ itemId, ...props }) {
return (
diff --git a/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemPaymentTransactions/BillPaymentTransactions/index.tsx b/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemPaymentTransactions/BillPaymentTransactions/index.tsx
index 875737599..cbdfefa5f 100644
--- a/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemPaymentTransactions/BillPaymentTransactions/index.tsx
+++ b/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemPaymentTransactions/BillPaymentTransactions/index.tsx
@@ -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 data table.
@@ -48,7 +49,7 @@ function BillPaymentTransactions({
// Handles edit payment transactions.
const handleEditPaymentTransactions = ({ bill_id }) => {
history.push(`/bills/${bill_id}/edit`);
- closeDrawer('item-detail-drawer');
+ closeDrawer(DRAWERS.ITEM_DETAILS);
};
return (
{
history.push(`/estimates/${estimate_id}/edit`);
- closeDrawer('item-detail-drawer');
+ closeDrawer(DRAWERS.ITEM_DETAILS);
};
return (
diff --git a/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemPaymentTransactions/InvoicePaymentTransactions/index.tsx b/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemPaymentTransactions/InvoicePaymentTransactions/index.tsx
index c8133878f..70e14a724 100644
--- a/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemPaymentTransactions/InvoicePaymentTransactions/index.tsx
+++ b/packages/webapp/src/containers/Drawers/ItemDetailDrawer/ItemPaymentTransactions/InvoicePaymentTransactions/index.tsx
@@ -16,6 +16,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Invoice payment transactions.
@@ -52,7 +53,7 @@ function InvoicePaymentTransactions({
// Handles edit payment transactions.
const handleEditPaymentTransactions = ({ invoice_id }) => {
history.push(`/invoices/${invoice_id}/edit`);
- closeDrawer('item-detail-drawer');
+ closeDrawer(DRAWERS.ITEM_DETAILS);
};
return (
{
history.push(`/receipts/${receipt_id}/edit`);
- closeDrawer('item-detail-drawer');
+ closeDrawer(DRAWERS.ITEM_DETAILS);
};
return (
diff --git a/packages/webapp/src/containers/Drawers/ManualJournalDrawer/ManualJournalDrawerActionBar.tsx b/packages/webapp/src/containers/Drawers/ManualJournalDrawer/ManualJournalDrawerActionBar.tsx
index 7d23324c1..90cb60879 100644
--- a/packages/webapp/src/containers/Drawers/ManualJournalDrawer/ManualJournalDrawerActionBar.tsx
+++ b/packages/webapp/src/containers/Drawers/ManualJournalDrawer/ManualJournalDrawerActionBar.tsx
@@ -22,6 +22,7 @@ import { useManualJournalDrawerContext } from './ManualJournalDrawerProvider';
import { ManualJournalAction, AbilitySubject } from '@/constants/abilityOption';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Manual journal action bar.
@@ -39,7 +40,7 @@ function ManualJournalDrawerActionBar({
// Handle edit manual journal action.
const handleEditManualJournal = () => {
history.push(`/manual-journals/${manualJournalId}/edit`);
- closeDrawer('journal-drawer');
+ closeDrawer(DRAWERS.JOURNAL_DETAILS);
};
// Handle manual journal delete action.
diff --git a/packages/webapp/src/containers/Drawers/ManualJournalDrawer/ManualJournalDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/ManualJournalDrawer/ManualJournalDrawerProvider.tsx
index c103bc9dd..49f1bb673 100644
--- a/packages/webapp/src/containers/Drawers/ManualJournalDrawer/ManualJournalDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/ManualJournalDrawer/ManualJournalDrawerProvider.tsx
@@ -3,6 +3,7 @@ import React from 'react';
import intl from 'react-intl-universal';
import { useJournal } from '@/hooks/query';
import { DrawerLoading, DrawerHeaderContent } from '@/components';
+import { DRAWERS } from '@/constants/drawers';
const ManualJournalDrawerContext = React.createContext();
@@ -31,7 +32,7 @@ function ManualJournalDrawerProvider({ manualJournalId, ...props }) {
return (
{
history.push(`/payment-mades/${paymentMadeId}/edit`);
- closeDrawer('payment-made-detail-drawer');
+ closeDrawer(DRAWERS.PAYMENT_MADE_DETAILS);
};
// Handle delete payment made.
diff --git a/packages/webapp/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.tsx b/packages/webapp/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.tsx
index 62aa88cc5..6ca7a4d50 100644
--- a/packages/webapp/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.tsx
+++ b/packages/webapp/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.tsx
@@ -21,9 +21,13 @@ import {
FormattedMessage as T,
DrawerActionsBar,
} from '@/components';
-import { PaymentReceiveAction, AbilitySubject } from '@/constants/abilityOption';
+import {
+ PaymentReceiveAction,
+ AbilitySubject,
+} from '@/constants/abilityOption';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Payment receive actions bar.
@@ -46,7 +50,7 @@ function PaymentReceiveActionsBar({
// Handle edit payment receive.
const handleEditPaymentReceive = () => {
history.push(`/payment-receives/${paymentReceiveId}/edit`);
- closeDrawer('payment-receive-detail-drawer');
+ closeDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS);
};
// Handle delete payment receive.
diff --git a/packages/webapp/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.tsx b/packages/webapp/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.tsx
index 8f169944b..4278c826a 100644
--- a/packages/webapp/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.tsx
@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { usePaymentReceive } from '@/hooks/query';
import { Features } from '@/constants';
import { useFeatureCan } from '@/hooks/state';
+import { DRAWERS } from '@/constants/drawers';
const PaymentReceiveDetailContext = React.createContext();
@@ -34,7 +35,7 @@ function PaymentReceiveDetailProvider({ paymentReceiveId, ...props }) {
return (
}
/>
diff --git a/packages/webapp/src/containers/Drawers/QuickCreateCustomerDrawer/QuickCustomerFormDrawer.tsx b/packages/webapp/src/containers/Drawers/QuickCreateCustomerDrawer/QuickCustomerFormDrawer.tsx
index 501902e96..ca1a6a2d4 100644
--- a/packages/webapp/src/containers/Drawers/QuickCreateCustomerDrawer/QuickCustomerFormDrawer.tsx
+++ b/packages/webapp/src/containers/Drawers/QuickCreateCustomerDrawer/QuickCustomerFormDrawer.tsx
@@ -13,6 +13,7 @@ import CustomerFormFormik, {
} from '@/containers/Customers/CustomerForm/CustomerFormFormik';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
/**
* Drawer customer form loading wrapper.
@@ -30,11 +31,11 @@ function DrawerCustomerFormLoading({ children }) {
function QuickCustomerFormDrawer({ displayName, closeDrawer, customerId }) {
// Handle the form submit request success.
const handleSubmitSuccess = () => {
- closeDrawer('quick-create-customer');
+ closeDrawer(DRAWERS.QUICK_CREATE_CUSTOMER);
};
// Handle the form cancel action.
const handleCancelForm = () => {
- closeDrawer('quick-create-customer');
+ closeDrawer(DRAWERS.QUICK_CREATE_CUSTOMER);
};
return (
diff --git a/packages/webapp/src/containers/Drawers/QuickCreateItemDrawer/QuickCreateItemDrawerContent.tsx b/packages/webapp/src/containers/Drawers/QuickCreateItemDrawer/QuickCreateItemDrawerContent.tsx
index 66f5d4dfc..8c015043f 100644
--- a/packages/webapp/src/containers/Drawers/QuickCreateItemDrawer/QuickCreateItemDrawerContent.tsx
+++ b/packages/webapp/src/containers/Drawers/QuickCreateItemDrawer/QuickCreateItemDrawerContent.tsx
@@ -4,6 +4,7 @@ import {
DrawerHeaderContent,
DrawerBody,
FormattedMessage as T,
+ Drawer,
} from '@/components';
import QuickCreateItemDrawerForm from './QuickCreateItemDrawerForm';
@@ -15,7 +16,7 @@ export default function QuickCreateItemDrawerContent({ itemName }) {
return (
}
/>
diff --git a/packages/webapp/src/containers/Drawers/QuickCreateItemDrawer/QuickCreateItemDrawerForm.tsx b/packages/webapp/src/containers/Drawers/QuickCreateItemDrawer/QuickCreateItemDrawerForm.tsx
index c6f62736d..b185eacaa 100644
--- a/packages/webapp/src/containers/Drawers/QuickCreateItemDrawer/QuickCreateItemDrawerForm.tsx
+++ b/packages/webapp/src/containers/Drawers/QuickCreateItemDrawer/QuickCreateItemDrawerForm.tsx
@@ -15,6 +15,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
+import { DRAWERS } from '@/constants/drawers';
/**
* Drawer item form loading.
@@ -43,7 +44,7 @@ function QuickCreateItemDrawerForm({
// Handle the form submit request success.
const handleSubmitSuccess = (values, form, submitPayload, response) => {
if (submitPayload.redirect) {
- closeDrawer('quick-create-item');
+ closeDrawer(DRAWERS.QUICK_CREATE_ITEM);
}
if (payload.quickActionEvent) {
addQuickActionEvent(payload.quickActionEvent, {
@@ -53,7 +54,7 @@ function QuickCreateItemDrawerForm({
};
// Handle the form cancel.
const handleFormCancel = () => {
- closeDrawer('quick-create-item');
+ closeDrawer(DRAWERS.QUICK_CREATE_ITEM);
};
return (
diff --git a/packages/webapp/src/containers/Drawers/QuickWriteVendorDrawer/QuickVendorFormDrawer.tsx b/packages/webapp/src/containers/Drawers/QuickWriteVendorDrawer/QuickVendorFormDrawer.tsx
index f674ba49e..c5f6149b7 100644
--- a/packages/webapp/src/containers/Drawers/QuickWriteVendorDrawer/QuickVendorFormDrawer.tsx
+++ b/packages/webapp/src/containers/Drawers/QuickWriteVendorDrawer/QuickVendorFormDrawer.tsx
@@ -16,6 +16,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
+import { DRAWERS } from '@/constants/drawers';
/**
* Drawer vendor form loading wrapper.
@@ -41,7 +42,7 @@ function QuickVendorFormDrawer({
// Handle the form submit request success.
const handleSubmitSuccess = (values, form, submitPayload, response) => {
if (!submitPayload.noRedirect) {
- closeDrawer('quick-write-vendor');
+ closeDrawer(DRAWERS.QUICK_WRITE_VENDOR);
}
if (payload.quickActionEvent) {
addQuickActionEvent(payload.quickActionEvent, {
@@ -51,7 +52,7 @@ function QuickVendorFormDrawer({
};
// Handle the form cancel action.
const handleCancelForm = () => {
- closeDrawer('quick-write-vendor');
+ closeDrawer(DRAWERS.QUICK_WRITE_VENDOR);
};
return (
diff --git a/packages/webapp/src/containers/Drawers/QuickWriteVendorDrawer/QuickWriteVendorDrawerContent.tsx b/packages/webapp/src/containers/Drawers/QuickWriteVendorDrawer/QuickWriteVendorDrawerContent.tsx
index 48aaf7c04..c52676f69 100644
--- a/packages/webapp/src/containers/Drawers/QuickWriteVendorDrawer/QuickWriteVendorDrawerContent.tsx
+++ b/packages/webapp/src/containers/Drawers/QuickWriteVendorDrawer/QuickWriteVendorDrawerContent.tsx
@@ -7,6 +7,7 @@ import {
} from '@/components';
import QuickVendorFormDrawer from './QuickVendorFormDrawer';
+import { DRAWERS } from '@/constants/drawers';
/**
* Quick create/edit vendor drawer.
@@ -15,7 +16,7 @@ export default function QuickWriteVendorDrawerContent({ displayName }) {
return (
}
/>
diff --git a/packages/webapp/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailActionBar.tsx b/packages/webapp/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailActionBar.tsx
index 496dfb385..b3e43b6ed 100644
--- a/packages/webapp/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailActionBar.tsx
+++ b/packages/webapp/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailActionBar.tsx
@@ -23,6 +23,7 @@ import { ReceiptMoreMenuItems } from './components';
import { useReceiptDetailDrawerContext } from './ReceiptDetailDrawerProvider';
import { SaleReceiptAction, AbilitySubject } from '@/constants/abilityOption';
import { safeCallback, compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Receipt details actions bar.
@@ -44,7 +45,7 @@ function ReceiptDetailActionBar({
// Handle edit sale receipt.
const onEditReceipt = () => {
history.push(`/receipts/${receiptId}/edit`);
- closeDrawer('receipt-detail-drawer');
+ closeDrawer(DRAWERS.RECEIPT_DETAILS);
};
// Handle delete sale receipt.
diff --git a/packages/webapp/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailDrawerProvider.tsx
index 20e4887d4..577ef092e 100644
--- a/packages/webapp/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailDrawerProvider.tsx
@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { Features } from '@/constants';
import { useFeatureCan } from '@/hooks/state';
import { useReceipt } from '@/hooks/query';
+import { DRAWERS } from '@/constants/drawers';
// useTransactionsByReference
const ReceiptDetailDrawerContext = React.createContext();
@@ -33,7 +34,7 @@ function ReceiptDetailDrawerProvider({ receiptId, ...props }) {
return (
diff --git a/packages/webapp/src/containers/Drawers/RefundVendorCreditDetailDrawer/RefundVendorCreditDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/RefundVendorCreditDetailDrawer/RefundVendorCreditDrawerProvider.tsx
index be077039e..f808a9ac1 100644
--- a/packages/webapp/src/containers/Drawers/RefundVendorCreditDetailDrawer/RefundVendorCreditDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/RefundVendorCreditDetailDrawer/RefundVendorCreditDrawerProvider.tsx
@@ -3,6 +3,7 @@ import React from 'react';
import intl from 'react-intl-universal';
import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useRefundVendorCreditTransaction } from '@/hooks/query';
+import { DRAWERS } from '@/constants/drawers';
const RefundVendorCreditDrawerContent = React.createContext();
@@ -27,7 +28,7 @@ function RefundVendorCreditDrawerProvider({ refundTransactionId, ...props }) {
return (
diff --git a/packages/webapp/src/containers/Drawers/VendorCreditDetailDrawer/VendorCreditDetailActionsBar.tsx b/packages/webapp/src/containers/Drawers/VendorCreditDetailDrawer/VendorCreditDetailActionsBar.tsx
index 3f56a2fb5..30b76d260 100644
--- a/packages/webapp/src/containers/Drawers/VendorCreditDetailDrawer/VendorCreditDetailActionsBar.tsx
+++ b/packages/webapp/src/containers/Drawers/VendorCreditDetailDrawer/VendorCreditDetailActionsBar.tsx
@@ -25,6 +25,7 @@ import {
} from '@/components';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Vendor credit detail actions bar.
@@ -39,14 +40,13 @@ function VendorCreditDetailActionsBar({
// #withDrawerActions
closeDrawer,
}) {
- const { vendorCreditId, vendorCredit } = useVendorCreditDetailDrawerContext();
-
const history = useHistory();
+ const { vendorCreditId, vendorCredit } = useVendorCreditDetailDrawerContext();
// Handle edit credit note.
const handleEditVendorCredit = () => {
history.push(`/vendor-credits/${vendorCreditId}/edit`);
- closeDrawer('vendor-credit-detail-drawer');
+ closeDrawer(DRAWERS.VENDOR_CREDIT_DETAILS);
};
// Handle delete credit note.
diff --git a/packages/webapp/src/containers/Drawers/VendorCreditDetailDrawer/VendorCreditDetailDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/VendorCreditDetailDrawer/VendorCreditDetailDrawerProvider.tsx
index c53ae707c..942e56b16 100644
--- a/packages/webapp/src/containers/Drawers/VendorCreditDetailDrawer/VendorCreditDetailDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/VendorCreditDetailDrawer/VendorCreditDetailDrawerProvider.tsx
@@ -9,6 +9,7 @@ import {
import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
+import { DRAWERS } from '@/constants/drawers';
const VendorCreditDetailDrawerContext = React.createContext();
@@ -61,7 +62,7 @@ function VendorCreditDetailDrawerProvider({ vendorCreditId, ...props }) {
}
>
{
history.push(`/vendors/${vendorId}/edit`);
- closeDrawer('vendor-detail-drawer');
+ closeDrawer(DRAWERS.VENDOR_DETAILS);
};
// Handle delete vendor.
@@ -63,14 +64,15 @@ function VendorDetailsActionsBar({
openAlert(`vendor-delete`, { contactId: vendorId });
};
+ // Handles clicking on new invoice button.
const handleNewInvoiceClick = () => {
history.push('/bills/new');
- closeDrawer('vendor-detail-drawer');
+ closeDrawer(DRAWERS.VENDOR_DETAILS);
};
const handleNewPaymentClick = () => {
history.push('/payment-mades/new');
- closeDrawer('vendor-detail-drawer');
+ closeDrawer(DRAWERS.VENDOR_DETAILS);
};
const handleEditOpeningBalance = () => {
diff --git a/packages/webapp/src/containers/Drawers/VendorDetailsDrawer/VendorDetailsDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/VendorDetailsDrawer/VendorDetailsDrawerProvider.tsx
index 086fbd625..3d340513e 100644
--- a/packages/webapp/src/containers/Drawers/VendorDetailsDrawer/VendorDetailsDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/VendorDetailsDrawer/VendorDetailsDrawerProvider.tsx
@@ -2,6 +2,7 @@
import React from 'react';
import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useVendor } from '@/hooks/query';
+import { DRAWERS } from '@/constants/drawers';
const VendorDetailDrawerContext = React.createContext();
@@ -23,7 +24,7 @@ function VendorDetailsDrawerProvider({ vendorId, ...props }) {
return (
diff --git a/packages/webapp/src/containers/Drawers/WarehouseTransferDetailDrawer/WarehouseTransferDetailActionsBar.tsx b/packages/webapp/src/containers/Drawers/WarehouseTransferDetailDrawer/WarehouseTransferDetailActionsBar.tsx
index a1522cb08..dbc35f8b7 100644
--- a/packages/webapp/src/containers/Drawers/WarehouseTransferDetailDrawer/WarehouseTransferDetailActionsBar.tsx
+++ b/packages/webapp/src/containers/Drawers/WarehouseTransferDetailDrawer/WarehouseTransferDetailActionsBar.tsx
@@ -11,10 +11,12 @@ import {
import { useWarehouseDetailDrawerContext } from './WarehouseTransferDetailDrawerProvider';
import { DrawerActionsBar, Icon, FormattedMessage as T } from '@/components';
+
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
import { compose } from '@/utils';
/**
@@ -34,7 +36,7 @@ function WarehouseTransferDetailActionsBar({
// Handle edit warehosue transfer.
const handleEditWarehosueTransfer = () => {
history.push(`/warehouses-transfers/${warehouseTransferId}/edit`);
- closeDrawer('warehouse-transfer-detail-drawer');
+ closeDrawer(DRAWERS.WAREHOUSE_TRANSFER_DETAILS);
};
// Handle delete warehouse transfer.
diff --git a/packages/webapp/src/containers/Drawers/WarehouseTransferDetailDrawer/WarehouseTransferDetailDrawerProvider.tsx b/packages/webapp/src/containers/Drawers/WarehouseTransferDetailDrawer/WarehouseTransferDetailDrawerProvider.tsx
index 98049a5e0..15a3b20bb 100644
--- a/packages/webapp/src/containers/Drawers/WarehouseTransferDetailDrawer/WarehouseTransferDetailDrawerProvider.tsx
+++ b/packages/webapp/src/containers/Drawers/WarehouseTransferDetailDrawer/WarehouseTransferDetailDrawerProvider.tsx
@@ -3,6 +3,7 @@ import React from 'react';
import intl from 'react-intl-universal';
import { useWarehouseTransfer } from '@/hooks/query';
import { DrawerHeaderContent, DrawerLoading } from '@/components';
+import { DRAWERS } from '@/constants/drawers';
const WarehouseTransferDetailDrawerContext = React.createContext();
@@ -27,7 +28,7 @@ function WarehouseTransferDetailDrawerProvider({
return (
{
- openDrawer('expense-drawer', {
+ openDrawer(DRAWERS.EXPENSE_DETAILS, {
expenseId: id,
});
};
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('expense-drawer', { expenseId: cell.row.original.id });
+ openDrawer(DRAWERS.EXPENSE_DETAILS, { expenseId: cell.row.original.id });
};
// Display empty status instead of the table.
diff --git a/packages/webapp/src/containers/InventoryAdjustments/InventoryAdjustmentTable.tsx b/packages/webapp/src/containers/InventoryAdjustments/InventoryAdjustmentTable.tsx
index 4f9b72aef..fe275b038 100644
--- a/packages/webapp/src/containers/InventoryAdjustments/InventoryAdjustmentTable.tsx
+++ b/packages/webapp/src/containers/InventoryAdjustments/InventoryAdjustmentTable.tsx
@@ -14,6 +14,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Inventory adjustments datatable.
@@ -53,7 +54,7 @@ function InventoryAdjustmentDataTable({
};
// Handle view detail inventory adjustment.
const handleViewDetailInventoryAdjustment = ({ id }) => {
- openDrawer('inventory-adjustment-drawer', { inventoryId: id });
+ openDrawer(DRAWERS.INVENTORY_ADJUSTMENT_DETAILS, { inventoryId: id });
};
// Inventory adjustments columns.
@@ -75,7 +76,7 @@ function InventoryAdjustmentDataTable({
);
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('inventory-adjustment-drawer', {
+ openDrawer(DRAWERS.INVENTORY_ADJUSTMENT_DETAILS, {
inventoryId: cell.row.original.id,
});
};
diff --git a/packages/webapp/src/containers/Items/ItemsDataTable.tsx b/packages/webapp/src/containers/Items/ItemsDataTable.tsx
index c84525b36..412950d64 100644
--- a/packages/webapp/src/containers/Items/ItemsDataTable.tsx
+++ b/packages/webapp/src/containers/Items/ItemsDataTable.tsx
@@ -22,6 +22,7 @@ import { useItemsListContext } from './ItemsListProvider';
import { useItemsTableColumns, ItemsActionMenuList } from './components';
import { useMemorizedColumnsWidths } from '@/hooks';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Items datatable.
@@ -108,7 +109,7 @@ function ItemsDataTable({
// Handle view detail item.
const handleViewDetailItem = ({ id }) => {
- openDrawer('item-detail-drawer', { itemId: id });
+ openDrawer(DRAWERS.ITEM_DETAILS, { itemId: id });
};
// Cannot continue in case the items has empty status.
@@ -118,7 +119,7 @@ function ItemsDataTable({
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('item-detail-drawer', { itemId: cell.row.original.id });
+ openDrawer(DRAWERS.ITEM_DETAILS, { itemId: cell.row.original.id });
};
return (
diff --git a/packages/webapp/src/containers/Items/ItemsUniversalSearch.tsx b/packages/webapp/src/containers/Items/ItemsUniversalSearch.tsx
index ec998b149..6da6498f3 100644
--- a/packages/webapp/src/containers/Items/ItemsUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Items/ItemsUniversalSearch.tsx
@@ -4,6 +4,8 @@ import intl from 'react-intl-universal';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
+import { DRAWERS } from '@/constants/drawers';
+
import { AbilitySubject, ItemAction } from '@/constants/abilityOption';
/**
@@ -19,7 +21,7 @@ function ItemUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.ITEM) {
- openDrawer('item-detail-drawer', { itemId: resourceId });
+ openDrawer(DRAWERS.ITEM_DETAILS, { itemId: resourceId });
onAction && onAction();
}
return null;
diff --git a/packages/webapp/src/containers/Purchases/Bills/BillUniversalSearch.tsx b/packages/webapp/src/containers/Purchases/Bills/BillUniversalSearch.tsx
index 1861465d0..963216455 100644
--- a/packages/webapp/src/containers/Purchases/Bills/BillUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Purchases/Bills/BillUniversalSearch.tsx
@@ -9,6 +9,7 @@ import { T, Icon, Choose, If } from '@/components';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, BillAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
/**
* Universal search bill item select action.
@@ -23,7 +24,7 @@ function BillUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.BILL) {
- openDrawer('bill-drawer', { billId: resourceId });
+ openDrawer(DRAWERS.BILL_DETAILS, { billId: resourceId });
onAction && onAction();
}
return null;
diff --git a/packages/webapp/src/containers/Purchases/Bills/BillsLanding/BillsTable.tsx b/packages/webapp/src/containers/Purchases/Bills/BillsLanding/BillsTable.tsx
index 1d8b8726a..509265d59 100644
--- a/packages/webapp/src/containers/Purchases/Bills/BillsLanding/BillsTable.tsx
+++ b/packages/webapp/src/containers/Purchases/Bills/BillsLanding/BillsTable.tsx
@@ -24,6 +24,7 @@ import { useBillsListContext } from './BillsListProvider';
import { useMemorizedColumnsWidths } from '@/hooks';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Bills transactions datatable.
@@ -99,12 +100,12 @@ function BillsDataTable({
// Handle view detail bill.
const handleViewDetailBill = ({ id }) => {
- openDrawer('bill-drawer', { billId: id });
+ openDrawer(DRAWERS.BILL_DETAILS, { billId: id });
};
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('bill-drawer', { billId: cell.row.original.id });
+ openDrawer(DRAWERS.BILL_DETAILS, { billId: cell.row.original.id });
};
// Local storage memorizing columns widths.
diff --git a/packages/webapp/src/containers/Purchases/CreditNotes/CreditNotesLanding/VendorsCreditNoteDataTable.tsx b/packages/webapp/src/containers/Purchases/CreditNotes/CreditNotesLanding/VendorsCreditNoteDataTable.tsx
index 5a4a8a6b2..aa371cb25 100644
--- a/packages/webapp/src/containers/Purchases/CreditNotes/CreditNotesLanding/VendorsCreditNoteDataTable.tsx
+++ b/packages/webapp/src/containers/Purchases/CreditNotes/CreditNotesLanding/VendorsCreditNoteDataTable.tsx
@@ -23,6 +23,7 @@ import { useVendorsCreditNoteTableColumns, ActionsMenu } from './components';
import { useVendorsCreditNoteListContext } from './VendorsCreditNoteListProvider';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Vendors Credit note data table.
@@ -78,8 +79,9 @@ function VendorsCreditNoteDataTable({
return ;
}
+ // Handle view vendor credit details.
const handleViewDetailVendorCredit = ({ id }) => {
- openDrawer('vendor-credit-detail-drawer', { vendorCreditId: id });
+ openDrawer(DRAWERS.VENDOR_CREDIT_DETAILS, { vendorCreditId: id });
};
// Handle delete credit note.
@@ -94,7 +96,7 @@ function VendorsCreditNoteDataTable({
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('vendor-credit-detail-drawer', {
+ openDrawer(DRAWERS.VENDOR_CREDIT_DETAILS, {
vendorCreditId: cell.row.original.id,
});
};
diff --git a/packages/webapp/src/containers/Purchases/PaymentMades/PaymentMadeUniversalSearch.tsx b/packages/webapp/src/containers/Purchases/PaymentMades/PaymentMadeUniversalSearch.tsx
index f2518a5dc..baf3f56d2 100644
--- a/packages/webapp/src/containers/Purchases/PaymentMades/PaymentMadeUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Purchases/PaymentMades/PaymentMadeUniversalSearch.tsx
@@ -9,7 +9,6 @@ import { highlightText } from '@/utils';
import { AbilitySubject, PaymentMadeAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
-
/**
* Universal search bill item select action.
*/
@@ -22,7 +21,7 @@ function PaymentMadeUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.PAYMENT_MADE) {
- openDrawer('payment-made-detail-drawer', { paymentMadeId: resourceId });
+ openDrawer(DRAWERS.PAYMENT_MADE_DETAILS, { paymentMadeId: resourceId });
}
return null;
}
diff --git a/packages/webapp/src/containers/Purchases/PaymentMades/PaymentsLanding/PaymentMadesTable.tsx b/packages/webapp/src/containers/Purchases/PaymentMades/PaymentsLanding/PaymentMadesTable.tsx
index cb44a5ed6..56daabb98 100644
--- a/packages/webapp/src/containers/Purchases/PaymentMades/PaymentsLanding/PaymentMadesTable.tsx
+++ b/packages/webapp/src/containers/Purchases/PaymentMades/PaymentsLanding/PaymentMadesTable.tsx
@@ -16,7 +16,6 @@ import PaymentMadesEmptyStatus from './PaymentMadesEmptyStatus';
import withPaymentMade from './withPaymentMade';
import withPaymentMadeActions from './withPaymentMadeActions';
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
-
import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withSettings from '@/containers/Settings/withSettings';
@@ -24,6 +23,7 @@ import withSettings from '@/containers/Settings/withSettings';
import { usePaymentMadesTableColumns, ActionsMenu } from './components';
import { usePaymentMadesListContext } from './PaymentMadesListProvider';
import { useMemorizedColumnsWidths } from '@/hooks';
+import { DRAWERS } from '@/constants/drawers';
/**
* Payment made datatable transactions.
@@ -71,12 +71,12 @@ function PaymentMadesTable({
// Handle view detail payment made.
const handleViewDetailPaymentMade = ({ id }) => {
- openDrawer('payment-made-detail-drawer', { paymentMadeId: id });
+ openDrawer(DRAWERS.PAYMENT_MADE_DETAILS, { paymentMadeId: id });
};
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('payment-made-detail-drawer', {
+ openDrawer(DRAWERS.PAYMENT_MADE_DETAILS, {
paymentMadeId: cell.row.original.id,
});
};
diff --git a/packages/webapp/src/containers/Sales/CreditNotes/CreditNoteUniversalSearch.tsx b/packages/webapp/src/containers/Sales/CreditNotes/CreditNoteUniversalSearch.tsx
index 495af470d..f3b4abffb 100644
--- a/packages/webapp/src/containers/Sales/CreditNotes/CreditNoteUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Sales/CreditNotes/CreditNoteUniversalSearch.tsx
@@ -23,7 +23,7 @@ function CreditNoteUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.CREDIT_NOTE) {
- openDrawer(DRAWERS.CREDIT_NOTE_DETAIL_DRAWER, { creditNoteId: resourceId });
+ openDrawer(DRAWERS.CREDIT_NOTE_DETAILS, { creditNoteId: resourceId });
onAction && onAction();
}
return null;
diff --git a/packages/webapp/src/containers/Sales/CreditNotes/CreditNotesLanding/CreditNotesDataTable.tsx b/packages/webapp/src/containers/Sales/CreditNotes/CreditNotesLanding/CreditNotesDataTable.tsx
index 579a88d59..25c9621d0 100644
--- a/packages/webapp/src/containers/Sales/CreditNotes/CreditNotesLanding/CreditNotesDataTable.tsx
+++ b/packages/webapp/src/containers/Sales/CreditNotes/CreditNotesLanding/CreditNotesDataTable.tsx
@@ -24,6 +24,7 @@ import { useCreditNoteTableColumns, ActionsMenu } from './components';
import { useCreditNoteListContext } from './CreditNotesListProvider';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Credit note data table.
@@ -80,7 +81,7 @@ function CreditNotesDataTable({
}
const handleViewDetailCreditNote = ({ id }) => {
- openDrawer('credit-note-detail-drawer', { creditNoteId: id });
+ openDrawer(DRAWERS.CREDIT_NOTE_DETAILS, { creditNoteId: id });
};
// Handle delete credit note.
@@ -95,7 +96,7 @@ function CreditNotesDataTable({
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('credit-note-detail-drawer', {
+ openDrawer(DRAWERS.CREDIT_NOTE_DETAILS, {
creditNoteId: cell.row.original.id,
});
};
diff --git a/packages/webapp/src/containers/Sales/Estimates/EstimatesLanding/EstimateUniversalSearch.tsx b/packages/webapp/src/containers/Sales/Estimates/EstimatesLanding/EstimateUniversalSearch.tsx
index bbde97ce1..fd69ce7ae 100644
--- a/packages/webapp/src/containers/Sales/Estimates/EstimatesLanding/EstimateUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Sales/Estimates/EstimatesLanding/EstimateUniversalSearch.tsx
@@ -8,6 +8,7 @@ import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, SaleEstimateAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
/**
* Estimate universal search item select action.
@@ -21,7 +22,7 @@ function EstimateUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.ESTIMATE) {
- openDrawer('estimate-detail-drawer', { estimateId: resourceId });
+ openDrawer(DRAWERS.ESTIMATE_DETAILS, { estimateId: resourceId });
}
return null;
}
diff --git a/packages/webapp/src/containers/Sales/Estimates/EstimatesLanding/EstimatesDataTable.tsx b/packages/webapp/src/containers/Sales/Estimates/EstimatesLanding/EstimatesDataTable.tsx
index 0a8972c18..402771604 100644
--- a/packages/webapp/src/containers/Sales/Estimates/EstimatesLanding/EstimatesDataTable.tsx
+++ b/packages/webapp/src/containers/Sales/Estimates/EstimatesLanding/EstimatesDataTable.tsx
@@ -21,6 +21,7 @@ import { ActionsMenu, useEstiamtesTableColumns } from './components';
import { useEstimatesListContext } from './EstimatesListProvider';
import { useMemorizedColumnsWidths } from '@/hooks';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Estimates datatable.
@@ -86,7 +87,7 @@ function EstimatesDataTable({
// Handle view detail estimate.
const handleViewDetailEstimate = ({ id }) => {
- openDrawer('estimate-detail-drawer', { estimateId: id });
+ openDrawer(DRAWERS.ESTIMATE_DETAILS, { estimateId: id });
};
// Handle print estimate.
@@ -96,7 +97,7 @@ function EstimatesDataTable({
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('estimate-detail-drawer', { estimateId: cell.row.original.id });
+ openDrawer(DRAWERS.ESTIMATE_DETAILS, { estimateId: cell.row.original.id });
};
// Local storage memorizing columns widths.
diff --git a/packages/webapp/src/containers/Sales/Invoices/InvoiceUniversalSearch.tsx b/packages/webapp/src/containers/Sales/Invoices/InvoiceUniversalSearch.tsx
index 67326ba05..d2b9124d4 100644
--- a/packages/webapp/src/containers/Sales/Invoices/InvoiceUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Sales/Invoices/InvoiceUniversalSearch.tsx
@@ -9,6 +9,7 @@ import { highlightText } from '@/utils';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, SaleInvoiceAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
/**
* Universal search invoice item select action.
@@ -22,7 +23,7 @@ function InvoiceUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.INVOICE) {
- openDrawer('invoice-detail-drawer', { invoiceId: resourceId });
+ openDrawer(DRAWERS.INVOICE_DETAILS, { invoiceId: resourceId });
}
return null;
}
diff --git a/packages/webapp/src/containers/Sales/Invoices/InvoicesLanding/InvoicesDataTable.tsx b/packages/webapp/src/containers/Sales/Invoices/InvoicesLanding/InvoicesDataTable.tsx
index 1c3adc4df..c2f5a78df 100644
--- a/packages/webapp/src/containers/Sales/Invoices/InvoicesLanding/InvoicesDataTable.tsx
+++ b/packages/webapp/src/containers/Sales/Invoices/InvoicesLanding/InvoicesDataTable.tsx
@@ -25,6 +25,7 @@ import { useInvoicesTableColumns, ActionsMenu } from './components';
import { useInvoicesListContext } from './InvoicesListProvider';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Invoices datatable.
@@ -89,7 +90,7 @@ function InvoicesDataTable({
// Handle view detail invoice.
const handleViewDetailInvoice = ({ id }) => {
- openDrawer('invoice-detail-drawer', { invoiceId: id });
+ openDrawer(DRAWERS.INVOICE_DETAILS, { invoiceId: id });
};
// Handle print invoices.
@@ -99,7 +100,7 @@ function InvoicesDataTable({
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('invoice-detail-drawer', { invoiceId: cell.row.original.id });
+ openDrawer(DRAWERS.INVOICE_DETAILS, { invoiceId: cell.row.original.id });
};
// Local storage memorizing columns widths.
diff --git a/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveUniversalSearch.tsx b/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveUniversalSearch.tsx
index b2940ecb8..34d940e57 100644
--- a/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Sales/PaymentReceives/PaymentReceiveUniversalSearch.tsx
@@ -4,10 +4,14 @@ import intl from 'react-intl-universal';
import { MenuItem } from '@blueprintjs/core';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
-import { AbilitySubject, PaymentReceiveAction } from '@/constants/abilityOption';
+import {
+ AbilitySubject,
+ PaymentReceiveAction,
+} from '@/constants/abilityOption';
import { highlightText } from '@/utils';
import { Icon } from '@/components';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
/**
* Payment receive universal search item select action.
@@ -21,7 +25,7 @@ function PaymentReceiveUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.PAYMENT_RECEIVE) {
- openDrawer('payment-receive-detail-drawer', {
+ openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, {
paymentReceiveId: resourceId,
});
}
diff --git a/packages/webapp/src/containers/Sales/PaymentReceives/PaymentsLanding/PaymentReceivesTable.tsx b/packages/webapp/src/containers/Sales/PaymentReceives/PaymentsLanding/PaymentReceivesTable.tsx
index ccc6efec1..15a8346df 100644
--- a/packages/webapp/src/containers/Sales/PaymentReceives/PaymentsLanding/PaymentReceivesTable.tsx
+++ b/packages/webapp/src/containers/Sales/PaymentReceives/PaymentsLanding/PaymentReceivesTable.tsx
@@ -22,6 +22,7 @@ import withSettings from '@/containers/Settings/withSettings';
import { usePaymentReceivesColumns, ActionsMenu } from './components';
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
import { useMemorizedColumnsWidths } from '@/hooks';
+import { DRAWERS } from '@/constants/drawers';
/**
* Payment receives datatable.
@@ -69,12 +70,12 @@ function PaymentReceivesDataTable({
// Handle view detail payment receive..
const handleViewDetailPaymentReceive = ({ id }) => {
- openDrawer('payment-receive-detail-drawer', { paymentReceiveId: id });
+ openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, { paymentReceiveId: id });
};
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('payment-receive-detail-drawer', {
+ openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, {
paymentReceiveId: cell.row.original.id,
});
};
diff --git a/packages/webapp/src/containers/Sales/Receipts/ReceiptUniversalSearch.tsx b/packages/webapp/src/containers/Sales/Receipts/ReceiptUniversalSearch.tsx
index 19e1d7a71..698b4304d 100644
--- a/packages/webapp/src/containers/Sales/Receipts/ReceiptUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Sales/Receipts/ReceiptUniversalSearch.tsx
@@ -7,6 +7,7 @@ import { Icon, Choose, T } from '@/components';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, SaleReceiptAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
/**
* Receipt universal search item select action.
@@ -21,7 +22,7 @@ function ReceiptUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.RECEIPT) {
- openDrawer('receipt-detail-drawer', { receiptId: resourceId });
+ openDrawer(DRAWERS.RECEIPT_DETAILS, { receiptId: resourceId });
onAction && onAction();
}
return null;
diff --git a/packages/webapp/src/containers/Sales/Receipts/ReceiptsLanding/ReceiptsTable.tsx b/packages/webapp/src/containers/Sales/Receipts/ReceiptsLanding/ReceiptsTable.tsx
index 9b65c01ad..4b50f624e 100644
--- a/packages/webapp/src/containers/Sales/Receipts/ReceiptsLanding/ReceiptsTable.tsx
+++ b/packages/webapp/src/containers/Sales/Receipts/ReceiptsLanding/ReceiptsTable.tsx
@@ -23,6 +23,7 @@ import withSettings from '@/containers/Settings/withSettings';
import { useReceiptsListContext } from './ReceiptsListProvider';
import { useReceiptsTableColumns, ActionsMenu } from './components';
import { useMemorizedColumnsWidths } from '@/hooks';
+import { DRAWERS } from '@/constants/drawers';
/**
* Sale receipts datatable.
@@ -77,7 +78,7 @@ function ReceiptsDataTable({
// Handle view detail receipt.
const handleViewDetailReceipt = ({ id }) => {
- openDrawer('receipt-detail-drawer', { receiptId: id });
+ openDrawer(DRAWERS.RECEIPT_DETAILS, { receiptId: id });
};
// Handle print receipt.
@@ -106,7 +107,7 @@ function ReceiptsDataTable({
}
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('receipt-detail-drawer', { receiptId: cell.row.original.id });
+ openDrawer(DRAWERS.RECEIPT_DETAILS, { receiptId: cell.row.original.id });
};
return (
diff --git a/packages/webapp/src/containers/Vendors/VendorsLanding/VendorsTable.tsx b/packages/webapp/src/containers/Vendors/VendorsLanding/VendorsTable.tsx
index 8a83115ff..785edc750 100644
--- a/packages/webapp/src/containers/Vendors/VendorsLanding/VendorsTable.tsx
+++ b/packages/webapp/src/containers/Vendors/VendorsLanding/VendorsTable.tsx
@@ -23,6 +23,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withSettings from '@/containers/Settings/withSettings';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Vendors table.
@@ -93,12 +94,12 @@ function VendorsTable({
// Handle view detail item.
const handleViewDetailVendor = ({ id }) => {
- openDrawer('vendor-detail-drawer', { vendorId: id });
+ openDrawer(DRAWERS.VENDOR_DETAILS, { vendorId: id });
};
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('vendor-detail-drawer', { vendorId: cell.row.original.id });
+ openDrawer(DRAWERS.VENDOR_DETAILS, { vendorId: cell.row.original.id });
};
// Local storage memorizing columns widths.
diff --git a/packages/webapp/src/containers/Vendors/VendorsUniversalSearch.tsx b/packages/webapp/src/containers/Vendors/VendorsUniversalSearch.tsx
index 3b69d6dd6..84ccdfcb7 100644
--- a/packages/webapp/src/containers/Vendors/VendorsUniversalSearch.tsx
+++ b/packages/webapp/src/containers/Vendors/VendorsUniversalSearch.tsx
@@ -4,6 +4,7 @@ import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, VendorAction } from '@/constants/abilityOption';
import withDrawerActions from '../Drawer/withDrawerActions';
+import { DRAWERS } from '@/constants/drawers';
/**
* Vendor univesal search item select action.
@@ -17,7 +18,7 @@ function VendorUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.VENDOR) {
- openDrawer('vendor-detail-drawer', { vendorId: resourceId });
+ openDrawer(DRAWERS.VENDOR_DETAILS, { vendorId: resourceId });
onAction && onAction();
}
return null;
diff --git a/packages/webapp/src/containers/WarehouseTransfers/WarehouseTransfersLanding/WarehouseTransfersDataTable.tsx b/packages/webapp/src/containers/WarehouseTransfers/WarehouseTransfersLanding/WarehouseTransfersDataTable.tsx
index 2eeefb7ba..99b3736a7 100644
--- a/packages/webapp/src/containers/WarehouseTransfers/WarehouseTransfersLanding/WarehouseTransfersDataTable.tsx
+++ b/packages/webapp/src/containers/WarehouseTransfers/WarehouseTransfersLanding/WarehouseTransfersDataTable.tsx
@@ -21,6 +21,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withSettings from '@/containers/Settings/withSettings';
import { compose } from '@/utils';
+import { DRAWERS } from '@/constants/drawers';
/**
* Warehouse transfers datatable.
@@ -78,7 +79,7 @@ function WarehouseTransfersDataTable({
// Handle view detail.
const handleViewDetailWarehouseTransfer = ({ id }) => {
- openDrawer('warehouse-transfer-detail-drawer', { warehouseTransferId: id });
+ openDrawer(DRAWERS.WAREHOUSE_TRANSFER_DETAILS, { warehouseTransferId: id });
};
// Handle edit warehouse transfer.
@@ -102,7 +103,7 @@ function WarehouseTransfersDataTable({
// Handle cell click.
const handleCellClick = (cell, event) => {
- openDrawer('warehouse-transfer-detail-drawer', {
+ openDrawer(DRAWERS.WAREHOUSE_TRANSFER_DETAILS, {
warehouseTransferId: cell.row.original.id,
});
};