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

@@ -4,6 +4,7 @@ import * as R from 'ramda';
import { ButtonLink } from '../Button'; import { ButtonLink } from '../Button';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
function CustomerDrawerLinkComponent({ function CustomerDrawerLinkComponent({
// #ownProps // #ownProps
@@ -16,7 +17,7 @@ function CustomerDrawerLinkComponent({
}) { }) {
// Handle view customer drawer. // Handle view customer drawer.
const handleCustomerDrawer = (event) => { const handleCustomerDrawer = (event) => {
openDrawer('customer-detail-drawer', { customerId }); openDrawer(DRAWERS.CUSTOMER_DETAILS, { customerId });
event.preventDefault(); event.preventDefault();
}; };

View File

@@ -31,28 +31,28 @@ import { DRAWERS } from '@/constants/drawers';
export default function DrawersContainer() { export default function DrawersContainer() {
return ( return (
<div> <div>
<AccountDrawer name={DRAWERS.ACCOUNT} /> <AccountDrawer name={DRAWERS.ACCOUNT_DETAILS} />
<ManualJournalDrawer name={DRAWERS.JOURNAL} /> <ManualJournalDrawer name={DRAWERS.JOURNAL_DETAILS} />
<ExpenseDrawer name={DRAWERS.EXPENSE} /> <ExpenseDrawer name={DRAWERS.EXPENSE_DETAILS} />
<BillDrawer name={DRAWERS.BILL} /> <BillDrawer name={DRAWERS.BILL_DETAILS} />
<InvoiceDetailDrawer name={DRAWERS.INVOICE} /> <InvoiceDetailDrawer name={DRAWERS.INVOICE_DETAILS} />
<EstimateDetailDrawer name={DRAWERS.ESTIMATE} /> <EstimateDetailDrawer name={DRAWERS.ESTIMATE_DETAILS} />
<ReceiptDetailDrawer name={DRAWERS.RECEIPT} /> <ReceiptDetailDrawer name={DRAWERS.RECEIPT_DETAILS} />
<PaymentReceiveDetailDrawer name={DRAWERS.PAYMENT_RECEIVE} /> <PaymentReceiveDetailDrawer name={DRAWERS.PAYMENT_RECEIVE_DETAILS} />
<PaymentMadeDetailDrawer name={DRAWERS.PAYMENT_MADE} /> <PaymentMadeDetailDrawer name={DRAWERS.PAYMENT_MADE_DETAILS} />
<ItemDetailDrawer name={DRAWERS.ITEM} /> <ItemDetailDrawer name={DRAWERS.ITEM_DETAILS} />
<CustomerDetailsDrawer name={DRAWERS.CUSTOMER} /> <CustomerDetailsDrawer name={DRAWERS.CUSTOMER_DETAILS} />
<VendorDetailsDrawer name={DRAWERS.VENDOR} /> <VendorDetailsDrawer name={DRAWERS.VENDOR_DETAILS} />
<InventoryAdjustmentDetailDrawer name={DRAWERS.INVENTORY_ADJUSTMENT} /> <InventoryAdjustmentDetailDrawer name={DRAWERS.INVENTORY_ADJUSTMENT_DETAILS} />
<CashflowTransactionDetailDrawer name={DRAWERS.CASHFLOW_TRNASACTION} /> <CashflowTransactionDetailDrawer name={DRAWERS.CASHFLOW_TRNASACTION_DETAILS} />
<QuickCreateCustomerDrawer name={DRAWERS.QUICK_CREATE_CUSTOMER} /> <QuickCreateCustomerDrawer name={DRAWERS.QUICK_CREATE_CUSTOMER} />
<QuickCreateItemDrawer name={DRAWERS.QUICK_CREATE_ITEM} /> <QuickCreateItemDrawer name={DRAWERS.QUICK_CREATE_ITEM} />
<QuickWriteVendorDrawer name={DRAWERS.QUICK_WRITE_VENDOR} /> <QuickWriteVendorDrawer name={DRAWERS.QUICK_WRITE_VENDOR} />
<CreditNoteDetailDrawer name={DRAWERS.CREDIT_NOTE} /> <CreditNoteDetailDrawer name={DRAWERS.CREDIT_NOTE_DETAILS} />
<VendorCreditDetailDrawer name={DRAWERS.VENDOR_CREDIT} /> <VendorCreditDetailDrawer name={DRAWERS.VENDOR_CREDIT_DETAILS} />
<RefundCreditNoteDetailDrawer name={DRAWERS.REFUND_CREDIT_NOTE} /> <RefundCreditNoteDetailDrawer name={DRAWERS.REFUND_CREDIT_NOTE_DETAILS} />
<RefundVendorCreditDetailDrawer name={DRAWERS.REFUND_VENDOR_CREDIT} /> <RefundVendorCreditDetailDrawer name={DRAWERS.REFUND_VENDOR_CREDIT_DETAILS} />
<WarehouseTransferDetailDrawer name={DRAWERS.WAREHOUSE_TRANSFER} /> <WarehouseTransferDetailDrawer name={DRAWERS.WAREHOUSE_TRANSFER_DETAILS} />
</div> </div>
); );
} }

View File

@@ -4,6 +4,7 @@ import * as R from 'ramda';
import { ButtonLink } from '../Button'; import { ButtonLink } from '../Button';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
function VendorDrawerLinkComponent({ function VendorDrawerLinkComponent({
// #ownProps // #ownProps
@@ -16,7 +17,7 @@ function VendorDrawerLinkComponent({
}) { }) {
// Handle view customer drawer. // Handle view customer drawer.
const handleVendorDrawer = (event) => { const handleVendorDrawer = (event) => {
openDrawer('vendor-detail-drawer', { vendorId }); openDrawer(DRAWERS.VENDOR_DETAILS, { vendorId });
event.preventDefault(); event.preventDefault();
}; };

View File

@@ -1,25 +1,25 @@
// @ts-nocheck // @ts-nocheck
export enum DRAWERS { export enum DRAWERS {
ACCOUNT = 'account-drawer', ACCOUNT_DETAILS = 'account-drawer',
JOURNAL = 'journal-drawer', JOURNAL_DETAILS = 'journal-drawer',
EXPENSE = 'expense-drawer', EXPENSE_DETAILS = 'expense-drawer',
BILL = 'bill-drawer', BILL_DETAILS = 'bill-drawer',
INVOICE = 'invoice-detail-drawer', INVOICE_DETAILS = 'invoice-detail-drawer',
RECEIPT = 'receipt-detail-drawer', RECEIPT_DETAILS = 'receipt-detail-drawer',
PAYMENT_RECEIVE = 'payment-receive-detail-drawer', PAYMENT_RECEIVE_DETAILS = 'payment-receive-detail-drawer',
PAYMENT_MADE = 'payment-made-drawer', PAYMENT_MADE_DETAILS = 'payment-made-drawer',
ESTIMATE = 'estimate-detail-drawer', ESTIMATE_DETAILS = 'estimate-detail-drawer',
ITEM = 'item-detail-drawer', ITEM_DETAILS = 'item-detail-drawer',
CUSTOMER = 'customer-detail-drawer', CUSTOMER_DETAILS = 'customer-detail-drawer',
VENDOR = 'vendor-detail-drawer', VENDOR_DETAILS = 'vendor-detail-drawer',
INVENTORY_ADJUSTMENT = 'inventory-adjustment-drawer', INVENTORY_ADJUSTMENT_DETAILS = 'inventory-adjustment-drawer',
CASHFLOW_TRNASACTION = 'cashflow-transaction-drawer', CASHFLOW_TRNASACTION_DETAILS = 'cashflow-transaction-drawer',
QUICK_CREATE_CUSTOMER = 'quick-create-customer', QUICK_CREATE_CUSTOMER = 'quick-create-customer',
QUICK_CREATE_ITEM = 'quick-create-item', QUICK_CREATE_ITEM = 'quick-create-item',
QUICK_WRITE_VENDOR = 'quick-write-vendor', QUICK_WRITE_VENDOR = 'quick-write-vendor',
CREDIT_NOTE = 'credit-note-detail-drawer', CREDIT_NOTE_DETAILS = 'credit-note-detail-drawer',
VENDOR_CREDIT = 'vendor-credit-detail-drawer', VENDOR_CREDIT_DETAILS = 'vendor-credit-detail-drawer',
REFUND_CREDIT_NOTE = 'refund-credit-detail-drawer', REFUND_CREDIT_NOTE_DETAILS = 'refund-credit-detail-drawer',
REFUND_VENDOR_CREDIT = 'refund-vendor-detail-drawer', REFUND_VENDOR_CREDIT_DETAILS = 'refund-vendor-detail-drawer',
WAREHOUSE_TRANSFER = 'warehouse-transfer-detail-drawer', WAREHOUSE_TRANSFER_DETAILS = 'warehouse-transfer-detail-drawer',
} }

View File

@@ -25,6 +25,7 @@ import { useMemorizedColumnsWidths } from '@/hooks';
import { useManualJournalsColumns } from './utils'; import { useManualJournalsColumns } from './utils';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Manual journals data-table. * Manual journals data-table.
@@ -79,14 +80,16 @@ function ManualJournalsDataTable({
// Handle view detail journal. // Handle view detail journal.
const handleViewDetailJournal = ({ id }) => { const handleViewDetailJournal = ({ id }) => {
openDrawer('journal-drawer', { openDrawer(DRAWERS.JOURNAL_DETAILS, {
manualJournalId: id, manualJournalId: id,
}); });
}; };
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { 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. // Local storage memorizing columns widths.

View File

@@ -3,6 +3,7 @@ import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes'; import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, ManualJournalAction } from '@/constants/abilityOption'; import { AbilitySubject, ManualJournalAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Universal search manual journal item select action. * Universal search manual journal item select action.
@@ -17,7 +18,7 @@ function JournalUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.MANUAL_JOURNAL) { if (resourceType === RESOURCES_TYPES.MANUAL_JOURNAL) {
openDrawer('journal-drawer', { manualJournalId: resourceId }); openDrawer(DRAWERS.JOURNAL_DETAILS, { manualJournalId: resourceId });
onAction && onAction(); onAction && onAction();
} }
return null; return null;

View File

@@ -5,6 +5,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { AbilitySubject, AccountAction } from '@/constants/abilityOption'; import { AbilitySubject, AccountAction } from '@/constants/abilityOption';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes'; import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { DRAWERS } from '@/constants/drawers';
function AccountUniversalSearchItemSelectComponent({ function AccountUniversalSearchItemSelectComponent({
// #ownProps // #ownProps
@@ -16,7 +17,7 @@ function AccountUniversalSearchItemSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.ACCOUNT) { if (resourceType === RESOURCES_TYPES.ACCOUNT) {
openDrawer('account-drawer', { accountId: resourceId }); openDrawer(DRAWERS.ACCOUNT_DETAILS, { accountId: resourceId });
onAction && onAction(); onAction && onAction();
} }
return null; return null;
@@ -28,8 +29,8 @@ export const AccountUniversalSearchItemSelect = withDrawerActions(
/** /**
* Transformes account item to search item. * Transformes account item to search item.
* @param {*} account * @param {*} account
* @returns * @returns
*/ */
const accountToSearch = (account) => ({ const accountToSearch = (account) => ({
id: account.id, id: account.id,

View File

@@ -23,6 +23,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDialogActions from '@/containers/Dialog/withDialogActions'; import withDialogActions from '@/containers/Dialog/withDialogActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Accounts data-table. * Accounts data-table.
@@ -71,7 +72,7 @@ function AccountsDataTable({
// Handle view detail account. // Handle view detail account.
const handleViewDetailAccount = ({ id }) => { const handleViewDetailAccount = ({ id }) => {
openDrawer('account-drawer', { accountId: id }); openDrawer(DRAWERS.ACCOUNT_DETAILS, { accountId: id });
}; };
// Handle new child button click. // Handle new child button click.
@@ -84,7 +85,7 @@ function AccountsDataTable({
}; };
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { 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. // Local storage memorizing columns widths.
const [initialColumnsWidths, , handleColumnResizing] = const [initialColumnsWidths, , handleColumnResizing] =

View File

@@ -16,6 +16,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeleteAccount } from '@/hooks/query'; import { useDeleteAccount } from '@/hooks/query';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Account delete alerts. * Account delete alerts.
@@ -48,7 +49,7 @@ function AccountDeleteAlert({
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeAlert(name); closeAlert(name);
closeDrawer('account-drawer'); closeDrawer(DRAWERS.ACCOUNT_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -11,6 +11,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { handleDeleteErrors } from '@/containers/Purchases/Bills/BillForm/utils'; import { handleDeleteErrors } from '@/containers/Purchases/Bills/BillForm/utils';
import { useDeleteBill } from '@/hooks/query'; import { useDeleteBill } from '@/hooks/query';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Bill delete alert. * Bill delete alert.
@@ -43,8 +44,7 @@ function BillDeleteAlert({
message: intl.get('the_bill_has_been_deleted_successfully'), message: intl.get('the_bill_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer(DRAWERS.BILL_DETAILS);
closeDrawer('bill-drawer');
}) })
.catch( .catch(
({ ({

View File

@@ -15,6 +15,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Account delete transaction alert. * Account delete transaction alert.
@@ -48,7 +49,7 @@ function AccountDeleteTransactionAlert({
message: intl.get('cash_flow_transaction.delete.alert_message'), message: intl.get('cash_flow_transaction.delete.alert_message'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('cashflow-transaction-drawer'); closeDrawer(DRAWERS.CASHFLOW_TRNASACTION_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -15,6 +15,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeleteCreditNote } from '@/hooks/query'; import { useDeleteCreditNote } from '@/hooks/query';
import { handleDeleteErrors } from '@/containers/Sales/CreditNotes/CreditNotesLanding/utils'; import { handleDeleteErrors } from '@/containers/Sales/CreditNotes/CreditNotesLanding/utils';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Credit note delete alert. * Credit note delete alert.
@@ -46,7 +47,7 @@ function CreditNoteDeleteAlert({
message: intl.get('credit_note.alert.delete_message'), message: intl.get('credit_note.alert.delete_message'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('credit-note-detail-drawer'); closeDrawer(DRAWERS.CREDIT_NOTE_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -11,6 +11,7 @@ import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Refund credit transactions delete alert * Refund credit transactions delete alert
@@ -42,7 +43,7 @@ function RefundCreditNoteDeleteAlert({
message: intl.get('refund_credit_transactions.alert.delete_message'), message: intl.get('refund_credit_transactions.alert.delete_message'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('refund-credit-detail-drawer'); closeDrawer(DRAWERS.REFUND_CREDIT_NOTE_DETAILS);
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {

View File

@@ -15,6 +15,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeleteCustomer } from '@/hooks/query'; import { useDeleteCustomer } from '@/hooks/query';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Customer delete alert. * Customer delete alert.
@@ -47,7 +48,7 @@ function CustomerDeleteAlert({
message: intl.get('the_customer_has_been_deleted_successfully'), message: intl.get('the_customer_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('customer-detail-drawer'); closeDrawer(DRAWERS.CUSTOMER_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -15,6 +15,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Estimate delete alert. * Estimate delete alert.
@@ -47,7 +48,7 @@ function EstimateDeleteAlert({
message: intl.get('the_estimate_has_been_deleted_successfully'), message: intl.get('the_estimate_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('estimate-detail-drawer'); closeDrawer(DRAWERS.ESTIMATE_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -10,6 +10,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeleteExpense } from '@/hooks/query'; import { useDeleteExpense } from '@/hooks/query';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Expense delete alert. * Expense delete alert.
@@ -42,7 +43,7 @@ function ExpenseDeleteAlert({
}), }),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('expense-drawer'); closeDrawer(DRAWERS.EXPENSE_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -16,6 +16,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Invoice delete alert. * Invoice delete alert.
@@ -48,7 +49,7 @@ function InvoiceDeleteAlert({
message: intl.get('the_invoice_has_been_deleted_successfully'), message: intl.get('the_invoice_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('invoice-detail-drawer'); closeDrawer(DRAWERS.INVOICE_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -14,6 +14,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeleteInventoryAdjustment } from '@/hooks/query'; import { useDeleteInventoryAdjustment } from '@/hooks/query';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Inventory Adjustment delete alerts. * Inventory Adjustment delete alerts.
@@ -49,7 +50,7 @@ function InventoryAdjustmentDeleteAlert({
), ),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('inventory-adjustment-drawer'); closeDrawer(DRAWERS.INVENTORY_ADJUSTMENT_DETAILS);
}) })
.catch((errors) => {}) .catch((errors) => {})
.finally(() => { .finally(() => {

View File

@@ -17,6 +17,7 @@ import withItemsActions from '@/containers/Items/withItemsActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Item delete alerts. * Item delete alerts.
@@ -54,7 +55,7 @@ function ItemDeleteAlert({
}); });
// Reset to page number one. // Reset to page number one.
setItemsTableState({ page: 1 }); setItemsTableState({ page: 1 });
closeDrawer('item-detail-drawer'); closeDrawer(DRAWERS.ITEM_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -10,6 +10,7 @@ import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Journal delete alert. * Journal delete alert.
@@ -45,7 +46,7 @@ function JournalDeleteAlert({
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeAlert(name); closeAlert(name);
closeDrawer('journal-drawer'); closeDrawer(DRAWERS.JOURNAL_DETAILS);
}) })
.catch(() => { .catch(() => {
closeAlert(name); closeAlert(name);

View File

@@ -11,6 +11,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { useDeletePaymentMade } from '@/hooks/query'; import { useDeletePaymentMade } from '@/hooks/query';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Payment made delete alert. * Payment made delete alert.
@@ -44,7 +45,7 @@ function PaymentMadeDeleteAlert({
message: intl.get('the_payment_made_has_been_deleted_successfully'), message: intl.get('the_payment_made_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('payment-made-detail-drawer'); closeDrawer(DRAWERS.PAYMENT_MADE_DETAILS);
}) })
.finally(() => { .finally(() => {
closeAlert(name); closeAlert(name);

View File

@@ -15,6 +15,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Payment receive delete alert. * Payment receive delete alert.
@@ -50,7 +51,7 @@ function PaymentReceiveDeleteAlert({
), ),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('payment-receive-detail-drawer'); closeDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS);
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {

View File

@@ -15,6 +15,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Invoice alert. * Invoice alert.
@@ -47,7 +48,7 @@ function NameDeleteAlert({
message: intl.get('the_receipt_has_been_deleted_successfully'), message: intl.get('the_receipt_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('receipt-detail-drawer'); closeDrawer(DRAWERS.RECEIPT_DETAILS);
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {

View File

@@ -10,6 +10,7 @@ import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Refund Vendor transactions delete alert. * Refund Vendor transactions delete alert.
@@ -43,7 +44,7 @@ function RefundVendorCreditDeleteAlert({
), ),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('refund-vendor-detail-drawer'); closeDrawer(DRAWERS.REFUND_VENDOR_CREDIT_DETAILS);
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {

View File

@@ -14,6 +14,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { handleDeleteErrors } from '@/containers/Purchases/CreditNotes/CreditNotesLanding/utils'; import { handleDeleteErrors } from '@/containers/Purchases/CreditNotes/CreditNotesLanding/utils';
import { useDeleteVendorCredit } from '@/hooks/query'; import { useDeleteVendorCredit } from '@/hooks/query';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Vendor Credit delete alert. * Vendor Credit delete alert.
@@ -45,7 +46,7 @@ function VendorCreditDeleteAlert({
message: intl.get('vendor_credits.alert.delete_message'), message: intl.get('vendor_credits.alert.delete_message'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('vendor-credit-detail-drawer'); closeDrawer(DRAWERS.VENDOR_CREDIT_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -16,6 +16,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Vendor delete alert. * Vendor delete alert.
@@ -48,7 +49,7 @@ function VendorDeleteAlert({
message: intl.get('the_vendor_has_been_deleted_successfully'), message: intl.get('the_vendor_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('vendor-detail-drawer'); closeDrawer(DRAWERS.VENDOR_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -14,6 +14,7 @@ import withAlertActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Warehouse transfer delete alert * Warehouse transfer delete alert
@@ -48,7 +49,7 @@ function WarehouseTransferDeleteAlert({
message: intl.get('warehouse_transfer.alert.delete_message'), message: intl.get('warehouse_transfer.alert.delete_message'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('warehouse-transfer-detail-drawer'); closeDrawer(DRAWERS.WAREHOUSE_TRANSFER_DETAILS);
}) })
.catch( .catch(
({ ({

View File

@@ -9,6 +9,7 @@ import {
import { Select } from '@blueprintjs/select'; import { Select } from '@blueprintjs/select';
import { Icon } from '@/components'; import { Icon } from '@/components';
import { DRAWERS } from '@/constants/drawers';
export const CashFlowMenuItems = ({ export const CashFlowMenuItems = ({
text, text,
@@ -53,40 +54,40 @@ export const CashFlowMenuItems = ({
export const handleCashFlowTransactionType = (reference, openDrawer) => { export const handleCashFlowTransactionType = (reference, openDrawer) => {
switch (reference.reference_type) { switch (reference.reference_type) {
case 'SaleReceipt': case 'SaleReceipt':
return openDrawer('receipt-detail-drawer', { return openDrawer(DRAWERS.RECEIPT_DETAILS, {
receiptId: reference.reference_id, receiptId: reference.reference_id,
}); });
case 'Journal': case 'Journal':
return openDrawer('journal-drawer', { return openDrawer(DRAWERS.JOURNAL_DETAILS, {
manualJournalId: reference.reference_id, manualJournalId: reference.reference_id,
}); });
case 'Expense': case 'Expense':
return openDrawer('expense-drawer', { return openDrawer(DRAWERS.EXPENSE_DETAILS, {
expenseId: reference.reference_id, expenseId: reference.reference_id,
}); });
case 'PaymentReceive': case 'PaymentReceive':
return openDrawer('payment-receive-detail-drawer', { return openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, {
paymentReceiveId: reference.reference_id, paymentReceiveId: reference.reference_id,
}); });
case 'BillPayment': case 'BillPayment':
return openDrawer('payment-made-detail-drawer', { return openDrawer(DRAWERS.PAYMENT_MADE_DETAILS, {
paymentMadeId: reference.reference_id, paymentMadeId: reference.reference_id,
}); });
case 'RefundCreditNote': case 'RefundCreditNote':
return openDrawer('refund-credit-detail-drawer', { return openDrawer(DRAWERS.REFUND_CREDIT_NOTE_DETAILS, {
refundTransactionId: reference.reference_id, refundTransactionId: reference.reference_id,
}); });
case 'RefundVendorCredit': case 'RefundVendorCredit':
return openDrawer('refund-vendor-detail-drawer', { return openDrawer(DRAWERS.REFUND_VENDOR_CREDIT_DETAILS, {
refundTransactionId: reference.reference_id, refundTransactionId: reference.reference_id,
}); });
case 'InventoryAdjustment': case 'InventoryAdjustment':
return openDrawer('inventory-adjustment-drawer', { return openDrawer(DRAWERS.INVENTORY_ADJUSTMENT_DETAILS, {
inventoryId: reference.reference_id, inventoryId: reference.reference_id,
}); });
default: default:
return openDrawer('cashflow-transaction-drawer', { return openDrawer(DRAWERS.CASHFLOW_TRNASACTION_DETAILS, {
referenceId: reference.reference_id, referenceId: reference.reference_id,
}); });
} }

View File

@@ -28,6 +28,7 @@ import withDialogActions from '@/containers/Dialog/withDialogActions';
import { AccountDialogAction } from '@/containers/Dialogs/AccountDialog/utils'; import { AccountDialogAction } from '@/containers/Dialogs/AccountDialog/utils';
import { safeCallback } from '@/utils'; import { safeCallback } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
const CASHFLOW_SKELETON_N = 4; const CASHFLOW_SKELETON_N = 4;
@@ -63,7 +64,7 @@ function CashflowBankAccount({
}) { }) {
// Handle view detail account. // Handle view detail account.
const handleViewClick = () => { const handleViewClick = () => {
openDrawer('account-drawer', { accountId: account.id }); openDrawer(DRAWERS.ACCOUNT_DETAILS, { accountId: account.id });
}; };
// Handle delete action account. // Handle delete action account.
const handleDeleteClick = () => { const handleDeleteClick = () => {

View File

@@ -24,6 +24,7 @@ import { useCustomersListContext } from './CustomersListProvider';
import { useMemorizedColumnsWidths } from '@/hooks'; import { useMemorizedColumnsWidths } from '@/hooks';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Customers table. * Customers table.
@@ -108,12 +109,12 @@ function CustomersTable({
// Handle view detail contact. // Handle view detail contact.
const handleViewDetailCustomer = ({ id }) => { const handleViewDetailCustomer = ({ id }) => {
openDrawer('customer-detail-drawer', { customerId: id }); openDrawer(DRAWERS.CUSTOMER_DETAILS, { customerId: id });
}; };
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { const handleCellClick = (cell, event) => {
openDrawer('customer-detail-drawer', { customerId: cell.row.original.id }); openDrawer(DRAWERS.CUSTOMER_DETAILS, { customerId: cell.row.original.id });
}; };
if (isEmptyStatus) { if (isEmptyStatus) {

View File

@@ -2,9 +2,11 @@
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { AbilitySubject, CustomerAction } from '@/constants/abilityOption'; import { AbilitySubject, CustomerAction } from '@/constants/abilityOption';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { DRAWERS } from '@/constants/drawers';
function CustomerUniversalSearchSelectComponent({ function CustomerUniversalSearchSelectComponent({
resourceType, resourceType,
resourceId, resourceId,
@@ -14,7 +16,7 @@ function CustomerUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.CUSTOMER) { if (resourceType === RESOURCES_TYPES.CUSTOMER) {
openDrawer('customer-detail-drawer', { customerId: resourceId }); openDrawer(DRAWERS.CUSTOMER_DETAILS, { customerId: resourceId });
onAction && onAction(); onAction && onAction();
} }
return null; return null;

View File

@@ -2,6 +2,7 @@
import React from 'react'; import React from 'react';
import { useAccount, useAccountTransactions } from '@/hooks/query'; import { useAccount, useAccountTransactions } from '@/hooks/query';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { DRAWERS } from '@/constants/drawers';
const AccountDrawerContext = React.createContext(); const AccountDrawerContext = React.createContext();
@@ -33,7 +34,7 @@ function AccountDrawerProvider({ accountId, name, ...props }) {
return ( return (
<DrawerLoading loading={isAccountLoading || isAccountsLoading}> <DrawerLoading loading={isAccountLoading || isAccountsLoading}>
<DrawerHeaderContent name={'account-drawer'} title={drawerTitle} /> <DrawerHeaderContent name={DRAWERS.ACCOUNT_DETAILS} title={drawerTitle} />
<AccountDrawerContext.Provider value={provider} {...props} /> <AccountDrawerContext.Provider value={provider} {...props} />
</DrawerLoading> </DrawerLoading>
); );

View File

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

View File

@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useBill, useBillLocatedLandedCost } from '@/hooks/query'; import { useBill, useBillLocatedLandedCost } from '@/hooks/query';
import { useFeatureCan } from '@/hooks/state'; import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants'; import { Features } from '@/constants';
import { DRAWERS } from '@/constants/drawers';
const BillDrawerContext = React.createContext(); const BillDrawerContext = React.createContext();
@@ -38,7 +39,7 @@ function BillDrawerProvider({ billId, ...props }) {
return ( return (
<DrawerLoading loading={loading}> <DrawerLoading loading={loading}>
<DrawerHeaderContent <DrawerHeaderContent
name="bill-drawer" name={DRAWERS.BILL_DETAILS}
title={intl.get('bill.drawer.title', { title={intl.get('bill.drawer.title', {
number: bill.bill_number ? `(${bill.bill_number})` : null, 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 withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Bill payment transactions datatable. * Bill payment transactions datatable.
@@ -48,7 +49,7 @@ function BillPaymentTransactionTable({
// Handles edit bill payment transactions. // Handles edit bill payment transactions.
const handleEditBillPaymentTransactions = ({ bill_payment_id }) => { const handleEditBillPaymentTransactions = ({ bill_payment_id }) => {
history.push(`/payment-mades/${bill_payment_id}/edit`); history.push(`/payment-mades/${bill_payment_id}/edit`);
closeDrawer('bill-drawer'); closeDrawer(DRAWERS.BILL_DETAILS);
}; };
return ( return (

View File

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

View File

@@ -4,6 +4,7 @@ import intl from 'react-intl-universal';
import { useCashflowTransaction } from '@/hooks/query'; import { useCashflowTransaction } from '@/hooks/query';
import { DrawerLoading, DrawerHeaderContent } from '@/components'; import { DrawerLoading, DrawerHeaderContent } from '@/components';
import { DRAWERS } from '@/constants/drawers';
const CashflowTransactionDrawerContext = React.createContext(); const CashflowTransactionDrawerContext = React.createContext();
@@ -32,7 +33,7 @@ function CashflowTransactionDrawerProvider({ referenceId, ...props }) {
return ( return (
<DrawerLoading loading={isCashflowTransactionLoading}> <DrawerLoading loading={isCashflowTransactionLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name={'cashflow-transaction-drawer'} name={DRAWERS.CASHFLOW_TRNASACTION_DETAILS}
title={intl.get('cash_flow.drawer.label_transaction', { title={intl.get('cash_flow.drawer.label_transaction', {
number: cashflowTransaction?.transaction_number, number: cashflowTransaction?.transaction_number,
})} })}

View File

@@ -26,6 +26,7 @@ import { CreditNoteAction, AbilitySubject } from '@/constants/abilityOption';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { CreditNoteMenuItem } from './utils'; import { CreditNoteMenuItem } from './utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Credit note detail actions bar. * Credit note detail actions bar.
@@ -47,7 +48,7 @@ function CreditNoteDetailActionsBar({
// Handle edit credit note. // Handle edit credit note.
const handleEditCreditNote = () => { const handleEditCreditNote = () => {
history.push(`/credit-notes/${creditNoteId}/edit`); history.push(`/credit-notes/${creditNoteId}/edit`);
closeDrawer('credit-note-detail-drawer'); closeDrawer(DRAWERS.CREDIT_NOTE_DETAILS);
}; };
const handleRefundCreditNote = () => { const handleRefundCreditNote = () => {

View File

@@ -10,6 +10,7 @@ import {
import { Features } from '@/constants'; import { Features } from '@/constants';
import { useFeatureCan } from '@/hooks/state'; import { useFeatureCan } from '@/hooks/state';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { DRAWERS } from '@/constants/drawers';
const CreditNoteDetailDrawerContext = React.createContext(); const CreditNoteDetailDrawerContext = React.createContext();
@@ -72,7 +73,7 @@ function CreditNoteDetailDrawerProvider({ creditNoteId, ...props }) {
} }
> >
<DrawerHeaderContent <DrawerHeaderContent
name="credit-note-detail-drawer" name={DRAWERS.CREDIT_NOTE_DETAILS}
title={intl.get('credit_note.drawer.title', { title={intl.get('credit_note.drawer.title', {
number: creditNote.credit_note_number, number: creditNote.credit_note_number,
})} })}

View File

@@ -38,6 +38,7 @@ import {
CustomerAction, CustomerAction,
} from '@/constants/abilityOption'; } from '@/constants/abilityOption';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Customer details actions bar. * Customer details actions bar.
@@ -58,22 +59,22 @@ function CustomerDetailsActionsBar({
// Handle new invoice button click. // Handle new invoice button click.
const handleNewInvoiceClick = () => { const handleNewInvoiceClick = () => {
history.push('/invoices/new'); history.push('/invoices/new');
closeDrawer('customer-detail-drawer'); closeDrawer(DRAWERS.CUSTOMER_DETAILS);
}; };
// Handle new receipt button click. // Handle new receipt button click.
const handleNewReceiptClick = () => { const handleNewReceiptClick = () => {
history.push('/receipts/new'); history.push('/receipts/new');
closeDrawer('customer-detail-drawer'); closeDrawer(DRAWERS.CUSTOMER_DETAILS);
}; };
// Handle new payment receive button click. // Handle new payment receive button click.
const handleNewPaymentClick = () => { const handleNewPaymentClick = () => {
history.push('/payment-receives/new'); history.push('/payment-receives/new');
closeDrawer('customer-detail-drawer'); closeDrawer(DRAWERS.CUSTOMER_DETAILS);
}; };
// Handle new estimate button click. // Handle new estimate button click.
const handleNewEstimateClick = () => { const handleNewEstimateClick = () => {
history.push('/estimates/new'); history.push('/estimates/new');
closeDrawer('customer-detail-drawer'); closeDrawer(DRAWERS.CUSTOMER_DETAILS);
}; };
// Handles delete customer click. // Handles delete customer click.
const handleDeleteCustomer = () => { const handleDeleteCustomer = () => {
@@ -82,7 +83,7 @@ function CustomerDetailsActionsBar({
// Handles edit customer click. // Handles edit customer click.
const handleEditContact = () => { const handleEditContact = () => {
history.push(`/customers/${customerId}/edit`); history.push(`/customers/${customerId}/edit`);
closeDrawer('customer-details-drawer'); closeDrawer(DRAWERS.CUSTOMER_DETAILS);
}; };
// Handle edit opening balance click. // Handle edit opening balance click.
const handleEditOpeningBalance = () => { const handleEditOpeningBalance = () => {

View File

@@ -2,6 +2,7 @@
import React from 'react'; import React from 'react';
import { useCustomer } from '@/hooks/query'; import { useCustomer } from '@/hooks/query';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { DRAWERS } from '@/constants/drawers';
const ContactDetailDrawerContext = React.createContext(); const ContactDetailDrawerContext = React.createContext();
@@ -26,7 +27,7 @@ function CustomerDetailsDrawerProvider({ customerId, ...props }) {
return ( return (
<DrawerLoading loading={isCustomerLoading}> <DrawerLoading loading={isCustomerLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="customer-detail-drawer" name={DRAWERS.CUSTOMER_DETAILS}
title={customer?.display_name} title={customer?.display_name}
/> />
<ContactDetailDrawerContext.Provider value={provider} {...props} /> <ContactDetailDrawerContext.Provider value={provider} {...props} />

View File

@@ -25,6 +25,7 @@ import {
} from '@/components'; } from '@/components';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Estimate read-only details actions bar of the drawer. * Estimate read-only details actions bar of the drawer.
@@ -48,7 +49,7 @@ function EstimateDetailActionsBar({
// Handle edit sale estimate. // Handle edit sale estimate.
const handleEditEstimate = () => { const handleEditEstimate = () => {
history.push(`/estimates/${estimateId}/edit`); history.push(`/estimates/${estimateId}/edit`);
closeDrawer('estimate-detail-drawer'); closeDrawer(DRAWERS.ESTIMATE_DETAILS);
}; };
// Handle delete sale estimate. // Handle delete sale estimate.

View File

@@ -5,6 +5,7 @@ import { Features } from '@/constants';
import { useEstimate } from '@/hooks/query'; import { useEstimate } from '@/hooks/query';
import { useFeatureCan } from '@/hooks/state'; import { useFeatureCan } from '@/hooks/state';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { DRAWERS } from '@/constants/drawers';
const EstimateDetailDrawerContext = React.createContext(); const EstimateDetailDrawerContext = React.createContext();
@@ -29,7 +30,7 @@ function EstimateDetailDrawerProvider({ estimateId, ...props }) {
return ( return (
<DrawerLoading loading={isEstimateLoading}> <DrawerLoading loading={isEstimateLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="estimate-detail-drawer" name={DRAWERS.ESTIMATE_DETAILS}
title={intl.get('estimate.drawer.title', { title={intl.get('estimate.drawer.title', {
number: estimate.estimate_number, number: estimate.estimate_number,
})} })}

View File

@@ -21,6 +21,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Expense drawer action bar. * Expense drawer action bar.
@@ -40,7 +41,7 @@ function ExpenseDrawerActionBar({
// Handle the expense edit action. // Handle the expense edit action.
const handleEditExpense = () => { const handleEditExpense = () => {
history.push(`/expenses/${expense.id}/edit`); history.push(`/expenses/${expense.id}/edit`);
closeDrawer('expense-drawer'); closeDrawer(DRAWERS.EXPENSE_DETAILS);
}; };
// Handle the expense delete action. // Handle the expense delete action.

View File

@@ -5,6 +5,7 @@ import { useExpense } from '@/hooks/query';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { Features } from '@/constants'; import { Features } from '@/constants';
import { useFeatureCan } from '@/hooks/state'; import { useFeatureCan } from '@/hooks/state';
import { DRAWERS } from '@/constants/drawers';
const ExpenseDrawerDrawerContext = React.createContext(); const ExpenseDrawerDrawerContext = React.createContext();
@@ -36,7 +37,7 @@ function ExpenseDrawerProvider({ expenseId, ...props }) {
return ( return (
<DrawerLoading loading={isExpenseLoading}> <DrawerLoading loading={isExpenseLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="expense-drawer" name={DRAWERS.EXPENSE_DETAILS}
title={intl.get('expense.drawer.title')} title={intl.get('expense.drawer.title')}
subTitle={ subTitle={
featureCan(Features.Branches) featureCan(Features.Branches)

View File

@@ -3,6 +3,7 @@ import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useInventoryAdjustment } from '@/hooks/query'; import { useInventoryAdjustment } from '@/hooks/query';
import { DRAWERS } from '@/constants/drawers';
const InventoryAdjustmentDrawerContext = React.createContext(); const InventoryAdjustmentDrawerContext = React.createContext();
@@ -25,7 +26,7 @@ function InventoryAdjustmentDrawerProvider({ inventoryId, ...props }) {
return ( return (
<DrawerLoading loading={isAdjustmentsLoading}> <DrawerLoading loading={isAdjustmentsLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="inventory-adjustment-drawer" name={DRAWERS.INVENTORY_ADJUSTMENT_DETAILS}
title={intl.get('inventory_adjustment.details_drawer.title')} title={intl.get('inventory_adjustment.details_drawer.title')}
/> />
<InventoryAdjustmentDrawerContext.Provider value={provider} {...props} /> <InventoryAdjustmentDrawerContext.Provider value={provider} {...props} />

View File

@@ -30,6 +30,7 @@ import {
import { compose } from '@/utils'; import { compose } from '@/utils';
import { BadDebtMenuItem } from './utils'; import { BadDebtMenuItem } from './utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Invoice details action bar. * Invoice details action bar.
@@ -52,7 +53,7 @@ function InvoiceDetailActionsBar({
// Handle edit sale invoice. // Handle edit sale invoice.
const handleEditInvoice = () => { const handleEditInvoice = () => {
history.push(`/invoices/${invoiceId}/edit`); history.push(`/invoices/${invoiceId}/edit`);
closeDrawer('invoice-detail-drawer'); closeDrawer(DRAWERS.INVOICE_DETAILS);
}; };
// Handle convert to invoice. // Handle convert to invoice.
@@ -60,7 +61,7 @@ function InvoiceDetailActionsBar({
history.push(`/credit-notes/new?from_invoice_id=${invoiceId}`, { history.push(`/credit-notes/new?from_invoice_id=${invoiceId}`, {
invoiceId: invoiceId, invoiceId: invoiceId,
}); });
closeDrawer('invoice-detail-drawer'); closeDrawer(DRAWERS.INVOICE_DETAILS);
}; };
// Handle delete sale invoice. // Handle delete sale invoice.

View File

@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { Features } from '@/constants'; import { Features } from '@/constants';
import { useInvoice } from '@/hooks/query'; import { useInvoice } from '@/hooks/query';
import { useFeatureCan } from '@/hooks/state'; import { useFeatureCan } from '@/hooks/state';
import { DRAWERS } from '@/constants/drawers';
const InvoiceDetailDrawerContext = React.createContext(); const InvoiceDetailDrawerContext = React.createContext();
/** /**
@@ -28,7 +29,7 @@ function InvoiceDetailDrawerProvider({ invoiceId, ...props }) {
return ( return (
<DrawerLoading loading={isInvoiceLoading}> <DrawerLoading loading={isInvoiceLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="invoice-detail-drawer" name={DRAWERS.INVOICE_DETAILS}
title={intl.get('invoice_details.drawer.title', { title={intl.get('invoice_details.drawer.title', {
invoiceNumber: invoice.invoice_no, invoiceNumber: invoice.invoice_no,
})} })}

View File

@@ -16,6 +16,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Invoice payment transactions datatable. * Invoice payment transactions datatable.
@@ -54,7 +55,7 @@ function InvoicePaymentTransactionsTable({
// Handles edit payment transactions. // Handles edit payment transactions.
const handleEditPaymentTransactions = ({ payment_receive_id }) => { const handleEditPaymentTransactions = ({ payment_receive_id }) => {
history.push(`/payment-receives/${payment_receive_id}/edit`); history.push(`/payment-receives/${payment_receive_id}/edit`);
closeDrawer('invoice-detail-drawer'); closeDrawer(DRAWERS.INVOICE_DETAILS);
}; };
return ( return (
<Card> <Card>

View File

@@ -23,6 +23,7 @@ import {
} from '@/components'; } from '@/components';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Item action-bar of readonly details drawer. * Item action-bar of readonly details drawer.
@@ -42,7 +43,7 @@ function ItemDetailActionsBar({
// Handle edit item. // Handle edit item.
const handleEditItem = () => { const handleEditItem = () => {
history.push(`/items/${itemId}/edit`); history.push(`/items/${itemId}/edit`);
closeDrawer('item-detail-drawer'); closeDrawer(DRAWERS.ITEM_DETAILS);
}; };
// Handle delete item. // Handle delete item.

View File

@@ -3,6 +3,7 @@ import React from 'react';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useItem } from '@/hooks/query'; import { useItem } from '@/hooks/query';
import { inactiveStatus } from './utlis'; import { inactiveStatus } from './utlis';
import { DRAWERS } from '@/constants/drawers';
const ItemDetailDrawerContext = React.createContext(); const ItemDetailDrawerContext = React.createContext();
@@ -30,7 +31,7 @@ function ItemDetailDrawerProvider({ itemId, ...props }) {
return ( return (
<DrawerLoading loading={isItemLoading}> <DrawerLoading loading={isItemLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="item-detail-drawer" name={DRAWERS.ITEM_DETAILS}
title={inactiveStatus(item)} title={inactiveStatus(item)}
/> />
<ItemDetailDrawerContext.Provider value={provider} {...props} /> <ItemDetailDrawerContext.Provider value={provider} {...props} />

View File

@@ -12,6 +12,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Bill payment transactions data table. * Bill payment transactions data table.
@@ -48,7 +49,7 @@ function BillPaymentTransactions({
// Handles edit payment transactions. // Handles edit payment transactions.
const handleEditPaymentTransactions = ({ bill_id }) => { const handleEditPaymentTransactions = ({ bill_id }) => {
history.push(`/bills/${bill_id}/edit`); history.push(`/bills/${bill_id}/edit`);
closeDrawer('item-detail-drawer'); closeDrawer(DRAWERS.ITEM_DETAILS);
}; };
return ( return (
<DataTable <DataTable

View File

@@ -13,6 +13,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Esimtate payment transactions. * Esimtate payment transactions.
@@ -26,6 +27,7 @@ function EstimatePaymentTransactions({
}) { }) {
const history = useHistory(); const history = useHistory();
// Estimate transactions table columns.
const columns = useEstimateTransactionsColumns(); const columns = useEstimateTransactionsColumns();
const { itemId } = useItemDetailDrawerContext(); const { itemId } = useItemDetailDrawerContext();
@@ -49,7 +51,7 @@ function EstimatePaymentTransactions({
// Handles edit payment transactions. // Handles edit payment transactions.
const handleEditPaymentTransactions = ({ estimate_id }) => { const handleEditPaymentTransactions = ({ estimate_id }) => {
history.push(`/estimates/${estimate_id}/edit`); history.push(`/estimates/${estimate_id}/edit`);
closeDrawer('item-detail-drawer'); closeDrawer(DRAWERS.ITEM_DETAILS);
}; };
return ( return (

View File

@@ -16,6 +16,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Invoice payment transactions. * Invoice payment transactions.
@@ -52,7 +53,7 @@ function InvoicePaymentTransactions({
// Handles edit payment transactions. // Handles edit payment transactions.
const handleEditPaymentTransactions = ({ invoice_id }) => { const handleEditPaymentTransactions = ({ invoice_id }) => {
history.push(`/invoices/${invoice_id}/edit`); history.push(`/invoices/${invoice_id}/edit`);
closeDrawer('item-detail-drawer'); closeDrawer(DRAWERS.ITEM_DETAILS);
}; };
return ( return (
<DataTable <DataTable

View File

@@ -12,6 +12,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Receipt payment transactions. * Receipt payment transactions.
@@ -48,7 +49,7 @@ function ReceiptPaymentTransactions({
// Handles edit payment transactions. // Handles edit payment transactions.
const handleEditPaymentTransactions = ({ receipt_id }) => { const handleEditPaymentTransactions = ({ receipt_id }) => {
history.push(`/receipts/${receipt_id}/edit`); history.push(`/receipts/${receipt_id}/edit`);
closeDrawer('item-detail-drawer'); closeDrawer(DRAWERS.ITEM_DETAILS);
}; };
return ( return (

View File

@@ -22,6 +22,7 @@ import { useManualJournalDrawerContext } from './ManualJournalDrawerProvider';
import { ManualJournalAction, AbilitySubject } from '@/constants/abilityOption'; import { ManualJournalAction, AbilitySubject } from '@/constants/abilityOption';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Manual journal action bar. * Manual journal action bar.
@@ -39,7 +40,7 @@ function ManualJournalDrawerActionBar({
// Handle edit manual journal action. // Handle edit manual journal action.
const handleEditManualJournal = () => { const handleEditManualJournal = () => {
history.push(`/manual-journals/${manualJournalId}/edit`); history.push(`/manual-journals/${manualJournalId}/edit`);
closeDrawer('journal-drawer'); closeDrawer(DRAWERS.JOURNAL_DETAILS);
}; };
// Handle manual journal delete action. // Handle manual journal delete action.

View File

@@ -3,6 +3,7 @@ import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { useJournal } from '@/hooks/query'; import { useJournal } from '@/hooks/query';
import { DrawerLoading, DrawerHeaderContent } from '@/components'; import { DrawerLoading, DrawerHeaderContent } from '@/components';
import { DRAWERS } from '@/constants/drawers';
const ManualJournalDrawerContext = React.createContext(); const ManualJournalDrawerContext = React.createContext();
@@ -31,7 +32,7 @@ function ManualJournalDrawerProvider({ manualJournalId, ...props }) {
return ( return (
<DrawerLoading loading={isJournalLoading}> <DrawerLoading loading={isJournalLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name={'journal-drawer'} name={DRAWERS.JOURNAL_DETAILS}
title={intl.get('manual_journal.drawer.title', { title={intl.get('manual_journal.drawer.title', {
number: manualJournal?.journal_number, number: manualJournal?.journal_number,
})} })}

View File

@@ -24,6 +24,7 @@ import {
} from '@/components'; } from '@/components';
import { PaymentMadeAction, AbilitySubject } from '@/constants/abilityOption'; import { PaymentMadeAction, AbilitySubject } from '@/constants/abilityOption';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Payment made - Details panel - actions bar. * Payment made - Details panel - actions bar.
@@ -42,7 +43,7 @@ function PaymentMadeDetailActionsBar({
// Handle edit payment made. // Handle edit payment made.
const handleEditPaymentMade = () => { const handleEditPaymentMade = () => {
history.push(`/payment-mades/${paymentMadeId}/edit`); history.push(`/payment-mades/${paymentMadeId}/edit`);
closeDrawer('payment-made-detail-drawer'); closeDrawer(DRAWERS.PAYMENT_MADE_DETAILS);
}; };
// Handle delete payment made. // Handle delete payment made.

View File

@@ -21,9 +21,13 @@ import {
FormattedMessage as T, FormattedMessage as T,
DrawerActionsBar, DrawerActionsBar,
} from '@/components'; } from '@/components';
import { PaymentReceiveAction, AbilitySubject } from '@/constants/abilityOption'; import {
PaymentReceiveAction,
AbilitySubject,
} from '@/constants/abilityOption';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Payment receive actions bar. * Payment receive actions bar.
@@ -46,7 +50,7 @@ function PaymentReceiveActionsBar({
// Handle edit payment receive. // Handle edit payment receive.
const handleEditPaymentReceive = () => { const handleEditPaymentReceive = () => {
history.push(`/payment-receives/${paymentReceiveId}/edit`); history.push(`/payment-receives/${paymentReceiveId}/edit`);
closeDrawer('payment-receive-detail-drawer'); closeDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS);
}; };
// Handle delete payment receive. // Handle delete payment receive.

View File

@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { usePaymentReceive } from '@/hooks/query'; import { usePaymentReceive } from '@/hooks/query';
import { Features } from '@/constants'; import { Features } from '@/constants';
import { useFeatureCan } from '@/hooks/state'; import { useFeatureCan } from '@/hooks/state';
import { DRAWERS } from '@/constants/drawers';
const PaymentReceiveDetailContext = React.createContext(); const PaymentReceiveDetailContext = React.createContext();
@@ -34,7 +35,7 @@ function PaymentReceiveDetailProvider({ paymentReceiveId, ...props }) {
return ( return (
<DrawerLoading loading={isPaymentLoading}> <DrawerLoading loading={isPaymentLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="payment-receive-detail-drawer" name={DRAWERS.PAYMENT_RECEIVE_DETAILS}
title={intl.get('payment_receive.drawer.title', { title={intl.get('payment_receive.drawer.title', {
number: paymentReceive.payment_receive_no, number: paymentReceive.payment_receive_no,
})} })}

View File

@@ -7,6 +7,7 @@ import {
} from '@/components'; } from '@/components';
import QuickCustomerFormDrawer from './QuickCustomerFormDrawer'; import QuickCustomerFormDrawer from './QuickCustomerFormDrawer';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Quick create/edit customer drawer. * Quick create/edit customer drawer.
@@ -15,7 +16,7 @@ export default function QuickCreateCustomerDrawerContent({ displayName }) {
return ( return (
<React.Fragment> <React.Fragment>
<DrawerHeaderContent <DrawerHeaderContent
name="quick-create-customer" name={DRAWERS.QUICK_CREATE_CUSTOMER}
title={<T id={'create_a_new_customer'} />} title={<T id={'create_a_new_customer'} />}
/> />
<DrawerBody> <DrawerBody>

View File

@@ -13,6 +13,7 @@ import CustomerFormFormik, {
} from '@/containers/Customers/CustomerForm/CustomerFormFormik'; } from '@/containers/Customers/CustomerForm/CustomerFormFormik';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Drawer customer form loading wrapper. * Drawer customer form loading wrapper.
@@ -30,11 +31,11 @@ function DrawerCustomerFormLoading({ children }) {
function QuickCustomerFormDrawer({ displayName, closeDrawer, customerId }) { function QuickCustomerFormDrawer({ displayName, closeDrawer, customerId }) {
// Handle the form submit request success. // Handle the form submit request success.
const handleSubmitSuccess = () => { const handleSubmitSuccess = () => {
closeDrawer('quick-create-customer'); closeDrawer(DRAWERS.QUICK_CREATE_CUSTOMER);
}; };
// Handle the form cancel action. // Handle the form cancel action.
const handleCancelForm = () => { const handleCancelForm = () => {
closeDrawer('quick-create-customer'); closeDrawer(DRAWERS.QUICK_CREATE_CUSTOMER);
}; };
return ( return (

View File

@@ -4,6 +4,7 @@ import {
DrawerHeaderContent, DrawerHeaderContent,
DrawerBody, DrawerBody,
FormattedMessage as T, FormattedMessage as T,
Drawer,
} from '@/components'; } from '@/components';
import QuickCreateItemDrawerForm from './QuickCreateItemDrawerForm'; import QuickCreateItemDrawerForm from './QuickCreateItemDrawerForm';
@@ -15,7 +16,7 @@ export default function QuickCreateItemDrawerContent({ itemName }) {
return ( return (
<React.Fragment> <React.Fragment>
<DrawerHeaderContent <DrawerHeaderContent
name="quick-create-item" name={DRAWER.QUICK_CREATE_ITEM}
title={<T id={'create_a_new_item'} />} title={<T id={'create_a_new_item'} />}
/> />
<DrawerBody> <DrawerBody>

View File

@@ -15,6 +15,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withDashboardActions from '@/containers/Dashboard/withDashboardActions'; import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
import { useDrawerContext } from '@/components/Drawer/DrawerProvider'; import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Drawer item form loading. * Drawer item form loading.
@@ -43,7 +44,7 @@ function QuickCreateItemDrawerForm({
// Handle the form submit request success. // Handle the form submit request success.
const handleSubmitSuccess = (values, form, submitPayload, response) => { const handleSubmitSuccess = (values, form, submitPayload, response) => {
if (submitPayload.redirect) { if (submitPayload.redirect) {
closeDrawer('quick-create-item'); closeDrawer(DRAWERS.QUICK_CREATE_ITEM);
} }
if (payload.quickActionEvent) { if (payload.quickActionEvent) {
addQuickActionEvent(payload.quickActionEvent, { addQuickActionEvent(payload.quickActionEvent, {
@@ -53,7 +54,7 @@ function QuickCreateItemDrawerForm({
}; };
// Handle the form cancel. // Handle the form cancel.
const handleFormCancel = () => { const handleFormCancel = () => {
closeDrawer('quick-create-item'); closeDrawer(DRAWERS.QUICK_CREATE_ITEM);
}; };
return ( return (

View File

@@ -16,6 +16,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withDashboardActions from '@/containers/Dashboard/withDashboardActions'; import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
import { useDrawerContext } from '@/components/Drawer/DrawerProvider'; import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Drawer vendor form loading wrapper. * Drawer vendor form loading wrapper.
@@ -41,7 +42,7 @@ function QuickVendorFormDrawer({
// Handle the form submit request success. // Handle the form submit request success.
const handleSubmitSuccess = (values, form, submitPayload, response) => { const handleSubmitSuccess = (values, form, submitPayload, response) => {
if (!submitPayload.noRedirect) { if (!submitPayload.noRedirect) {
closeDrawer('quick-write-vendor'); closeDrawer(DRAWERS.QUICK_WRITE_VENDOR);
} }
if (payload.quickActionEvent) { if (payload.quickActionEvent) {
addQuickActionEvent(payload.quickActionEvent, { addQuickActionEvent(payload.quickActionEvent, {
@@ -51,7 +52,7 @@ function QuickVendorFormDrawer({
}; };
// Handle the form cancel action. // Handle the form cancel action.
const handleCancelForm = () => { const handleCancelForm = () => {
closeDrawer('quick-write-vendor'); closeDrawer(DRAWERS.QUICK_WRITE_VENDOR);
}; };
return ( return (

View File

@@ -7,6 +7,7 @@ import {
} from '@/components'; } from '@/components';
import QuickVendorFormDrawer from './QuickVendorFormDrawer'; import QuickVendorFormDrawer from './QuickVendorFormDrawer';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Quick create/edit vendor drawer. * Quick create/edit vendor drawer.
@@ -15,7 +16,7 @@ export default function QuickWriteVendorDrawerContent({ displayName }) {
return ( return (
<React.Fragment> <React.Fragment>
<DrawerHeaderContent <DrawerHeaderContent
name="quick-create-customer" name={DRAWERS.QUICK_CREATE_CUSTOMER}
title={<T id={'create_a_new_vendor'} />} title={<T id={'create_a_new_vendor'} />}
/> />

View File

@@ -23,6 +23,7 @@ import { ReceiptMoreMenuItems } from './components';
import { useReceiptDetailDrawerContext } from './ReceiptDetailDrawerProvider'; import { useReceiptDetailDrawerContext } from './ReceiptDetailDrawerProvider';
import { SaleReceiptAction, AbilitySubject } from '@/constants/abilityOption'; import { SaleReceiptAction, AbilitySubject } from '@/constants/abilityOption';
import { safeCallback, compose } from '@/utils'; import { safeCallback, compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Receipt details actions bar. * Receipt details actions bar.
@@ -44,7 +45,7 @@ function ReceiptDetailActionBar({
// Handle edit sale receipt. // Handle edit sale receipt.
const onEditReceipt = () => { const onEditReceipt = () => {
history.push(`/receipts/${receiptId}/edit`); history.push(`/receipts/${receiptId}/edit`);
closeDrawer('receipt-detail-drawer'); closeDrawer(DRAWERS.RECEIPT_DETAILS);
}; };
// Handle delete sale receipt. // Handle delete sale receipt.

View File

@@ -5,6 +5,7 @@ import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { Features } from '@/constants'; import { Features } from '@/constants';
import { useFeatureCan } from '@/hooks/state'; import { useFeatureCan } from '@/hooks/state';
import { useReceipt } from '@/hooks/query'; import { useReceipt } from '@/hooks/query';
import { DRAWERS } from '@/constants/drawers';
// useTransactionsByReference // useTransactionsByReference
const ReceiptDetailDrawerContext = React.createContext(); const ReceiptDetailDrawerContext = React.createContext();
@@ -33,7 +34,7 @@ function ReceiptDetailDrawerProvider({ receiptId, ...props }) {
return ( return (
<DrawerLoading loading={isReceiptLoading}> <DrawerLoading loading={isReceiptLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="receipt-detail-drawer" name={DRAWERS.RECEIPT_DETAILS}
title={intl.get('receipt.drawer.title', { title={intl.get('receipt.drawer.title', {
number: receipt.receipt_number, number: receipt.receipt_number,
})} })}

View File

@@ -3,6 +3,7 @@ import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useRefundCreditTransaction } from '@/hooks/query'; import { useRefundCreditTransaction } from '@/hooks/query';
import { DRAWERS } from '@/constants/drawers';
const RefundCreditNoteDrawerContext = React.createContext(); const RefundCreditNoteDrawerContext = React.createContext();
@@ -27,7 +28,7 @@ function RefundCreditNoteDrawerProvider({ refundTransactionId, ...props }) {
return ( return (
<DrawerLoading loading={isRefundCreditTransaction}> <DrawerLoading loading={isRefundCreditTransaction}>
<DrawerHeaderContent <DrawerHeaderContent
name="refund-credit-detail-drawer" name={DRAWERS.REFUND_CREDIT_NOTE_DETAILS}
title={intl.get('refund_credit.drawer.title')} title={intl.get('refund_credit.drawer.title')}
/> />
<RefundCreditNoteDrawerContext.Provider value={provider} {...props} /> <RefundCreditNoteDrawerContext.Provider value={provider} {...props} />

View File

@@ -3,6 +3,7 @@ import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useRefundVendorCreditTransaction } from '@/hooks/query'; import { useRefundVendorCreditTransaction } from '@/hooks/query';
import { DRAWERS } from '@/constants/drawers';
const RefundVendorCreditDrawerContent = React.createContext(); const RefundVendorCreditDrawerContent = React.createContext();
@@ -27,7 +28,7 @@ function RefundVendorCreditDrawerProvider({ refundTransactionId, ...props }) {
return ( return (
<DrawerLoading loading={isRefundVendorTransaction}> <DrawerLoading loading={isRefundVendorTransaction}>
<DrawerHeaderContent <DrawerHeaderContent
name="refund-vendor-detail-drawer" name={DRAWERS.REFUND_VENDOR_CREDIT_DETAILS}
title={intl.get('refund_vendor_credit.drawer.title')} title={intl.get('refund_vendor_credit.drawer.title')}
/> />
<RefundVendorCreditDrawerContent.Provider value={provider} {...props} /> <RefundVendorCreditDrawerContent.Provider value={provider} {...props} />

View File

@@ -25,6 +25,7 @@ import {
} from '@/components'; } from '@/components';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Vendor credit detail actions bar. * Vendor credit detail actions bar.
@@ -39,14 +40,13 @@ function VendorCreditDetailActionsBar({
// #withDrawerActions // #withDrawerActions
closeDrawer, closeDrawer,
}) { }) {
const { vendorCreditId, vendorCredit } = useVendorCreditDetailDrawerContext();
const history = useHistory(); const history = useHistory();
const { vendorCreditId, vendorCredit } = useVendorCreditDetailDrawerContext();
// Handle edit credit note. // Handle edit credit note.
const handleEditVendorCredit = () => { const handleEditVendorCredit = () => {
history.push(`/vendor-credits/${vendorCreditId}/edit`); history.push(`/vendor-credits/${vendorCreditId}/edit`);
closeDrawer('vendor-credit-detail-drawer'); closeDrawer(DRAWERS.VENDOR_CREDIT_DETAILS);
}; };
// Handle delete credit note. // Handle delete credit note.

View File

@@ -9,6 +9,7 @@ import {
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useFeatureCan } from '@/hooks/state'; import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants'; import { Features } from '@/constants';
import { DRAWERS } from '@/constants/drawers';
const VendorCreditDetailDrawerContext = React.createContext(); const VendorCreditDetailDrawerContext = React.createContext();
@@ -61,7 +62,7 @@ function VendorCreditDetailDrawerProvider({ vendorCreditId, ...props }) {
} }
> >
<DrawerHeaderContent <DrawerHeaderContent
name="vendor-credit-detail-drawer" name={DRAWERS.VENDOR_CREDIT_DETAILS}
title={intl.get('vendor_credit.drawer_vendor_credit_detail', { title={intl.get('vendor_credit.drawer_vendor_credit_detail', {
vendorNumber: vendorCredit.vendor_credit_number, vendorNumber: vendorCredit.vendor_credit_number,
})} })}

View File

@@ -35,6 +35,7 @@ import {
VendorAction, VendorAction,
} from '../../../constants/abilityOption'; } from '../../../constants/abilityOption';
import { safeCallback, compose } from '@/utils'; import { safeCallback, compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Vendor details actions bar. * Vendor details actions bar.
@@ -55,7 +56,7 @@ function VendorDetailsActionsBar({
// Handle edit vendor. // Handle edit vendor.
const onEditContact = () => { const onEditContact = () => {
history.push(`/vendors/${vendorId}/edit`); history.push(`/vendors/${vendorId}/edit`);
closeDrawer('vendor-detail-drawer'); closeDrawer(DRAWERS.VENDOR_DETAILS);
}; };
// Handle delete vendor. // Handle delete vendor.
@@ -63,14 +64,15 @@ function VendorDetailsActionsBar({
openAlert(`vendor-delete`, { contactId: vendorId }); openAlert(`vendor-delete`, { contactId: vendorId });
}; };
// Handles clicking on new invoice button.
const handleNewInvoiceClick = () => { const handleNewInvoiceClick = () => {
history.push('/bills/new'); history.push('/bills/new');
closeDrawer('vendor-detail-drawer'); closeDrawer(DRAWERS.VENDOR_DETAILS);
}; };
const handleNewPaymentClick = () => { const handleNewPaymentClick = () => {
history.push('/payment-mades/new'); history.push('/payment-mades/new');
closeDrawer('vendor-detail-drawer'); closeDrawer(DRAWERS.VENDOR_DETAILS);
}; };
const handleEditOpeningBalance = () => { const handleEditOpeningBalance = () => {

View File

@@ -2,6 +2,7 @@
import React from 'react'; import React from 'react';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { useVendor } from '@/hooks/query'; import { useVendor } from '@/hooks/query';
import { DRAWERS } from '@/constants/drawers';
const VendorDetailDrawerContext = React.createContext(); const VendorDetailDrawerContext = React.createContext();
@@ -23,7 +24,7 @@ function VendorDetailsDrawerProvider({ vendorId, ...props }) {
return ( return (
<DrawerLoading loading={isVendorLoading}> <DrawerLoading loading={isVendorLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="vendor-detail-drawer" name={DRAWERS.VENDOR_DETAILS}
title={vendor?.display_name} title={vendor?.display_name}
/> />
<VendorDetailDrawerContext.Provider value={provider} {...props} /> <VendorDetailDrawerContext.Provider value={provider} {...props} />

View File

@@ -11,10 +11,12 @@ import {
import { useWarehouseDetailDrawerContext } from './WarehouseTransferDetailDrawerProvider'; import { useWarehouseDetailDrawerContext } from './WarehouseTransferDetailDrawerProvider';
import { DrawerActionsBar, Icon, FormattedMessage as T } from '@/components'; import { DrawerActionsBar, Icon, FormattedMessage as T } from '@/components';
import withDialogActions from '@/containers/Dialog/withDialogActions'; import withDialogActions from '@/containers/Dialog/withDialogActions';
import withAlertsActions from '@/containers/Alert/withAlertActions'; import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
import { compose } from '@/utils'; import { compose } from '@/utils';
/** /**
@@ -34,7 +36,7 @@ function WarehouseTransferDetailActionsBar({
// Handle edit warehosue transfer. // Handle edit warehosue transfer.
const handleEditWarehosueTransfer = () => { const handleEditWarehosueTransfer = () => {
history.push(`/warehouses-transfers/${warehouseTransferId}/edit`); history.push(`/warehouses-transfers/${warehouseTransferId}/edit`);
closeDrawer('warehouse-transfer-detail-drawer'); closeDrawer(DRAWERS.WAREHOUSE_TRANSFER_DETAILS);
}; };
// Handle delete warehouse transfer. // Handle delete warehouse transfer.

View File

@@ -3,6 +3,7 @@ import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { useWarehouseTransfer } from '@/hooks/query'; import { useWarehouseTransfer } from '@/hooks/query';
import { DrawerHeaderContent, DrawerLoading } from '@/components'; import { DrawerHeaderContent, DrawerLoading } from '@/components';
import { DRAWERS } from '@/constants/drawers';
const WarehouseTransferDetailDrawerContext = React.createContext(); const WarehouseTransferDetailDrawerContext = React.createContext();
@@ -27,7 +28,7 @@ function WarehouseTransferDetailDrawerProvider({
return ( return (
<DrawerLoading loading={isWarehouseTransferLoading}> <DrawerLoading loading={isWarehouseTransferLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="warehouse-transfer-detail-drawer" name={DRAWERS.WAREHOUSE_TRANSFER_DETAILS}
title={intl.get('warehouse_transfer.drawer.title', { title={intl.get('warehouse_transfer.drawer.title', {
number: warehouseTransfer.transaction_number number: warehouseTransfer.transaction_number
? `(${warehouseTransfer.transaction_number})` ? `(${warehouseTransfer.transaction_number})`

View File

@@ -1,4 +1,5 @@
// @ts-nocheck // @ts-nocheck
import { DRAWERS } from '@/constants/drawers';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes'; import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
@@ -14,7 +15,7 @@ function ExpenseUniversalSearchItemSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.EXPENSE) { if (resourceType === RESOURCES_TYPES.EXPENSE) {
openDrawer('expense-drawer', { expenseId: resourceId }); openDrawer(DRAWERS.EXPENSE_DETAILS, { expenseId: resourceId });
} }
return null; return null;
} }

View File

@@ -22,6 +22,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withSettings from '@/containers/Settings/withSettings'; import withSettings from '@/containers/Settings/withSettings';
import { ActionsMenu, useExpensesTableColumns } from './components'; import { ActionsMenu, useExpensesTableColumns } from './components';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Expenses datatable. * Expenses datatable.
@@ -87,14 +88,14 @@ function ExpensesDataTable({
// Handle view detail expense. // Handle view detail expense.
const handleViewDetailExpense = ({ id }) => { const handleViewDetailExpense = ({ id }) => {
openDrawer('expense-drawer', { openDrawer(DRAWERS.EXPENSE_DETAILS, {
expenseId: id, expenseId: id,
}); });
}; };
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { 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. // Display empty status instead of the table.

View File

@@ -14,6 +14,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Inventory adjustments datatable. * Inventory adjustments datatable.
@@ -53,7 +54,7 @@ function InventoryAdjustmentDataTable({
}; };
// Handle view detail inventory adjustment. // Handle view detail inventory adjustment.
const handleViewDetailInventoryAdjustment = ({ id }) => { const handleViewDetailInventoryAdjustment = ({ id }) => {
openDrawer('inventory-adjustment-drawer', { inventoryId: id }); openDrawer(DRAWERS.INVENTORY_ADJUSTMENT_DETAILS, { inventoryId: id });
}; };
// Inventory adjustments columns. // Inventory adjustments columns.
@@ -75,7 +76,7 @@ function InventoryAdjustmentDataTable({
); );
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { const handleCellClick = (cell, event) => {
openDrawer('inventory-adjustment-drawer', { openDrawer(DRAWERS.INVENTORY_ADJUSTMENT_DETAILS, {
inventoryId: cell.row.original.id, inventoryId: cell.row.original.id,
}); });
}; };

View File

@@ -22,6 +22,7 @@ import { useItemsListContext } from './ItemsListProvider';
import { useItemsTableColumns, ItemsActionMenuList } from './components'; import { useItemsTableColumns, ItemsActionMenuList } from './components';
import { useMemorizedColumnsWidths } from '@/hooks'; import { useMemorizedColumnsWidths } from '@/hooks';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Items datatable. * Items datatable.
@@ -108,7 +109,7 @@ function ItemsDataTable({
// Handle view detail item. // Handle view detail item.
const handleViewDetailItem = ({ id }) => { const handleViewDetailItem = ({ id }) => {
openDrawer('item-detail-drawer', { itemId: id }); openDrawer(DRAWERS.ITEM_DETAILS, { itemId: id });
}; };
// Cannot continue in case the items has empty status. // Cannot continue in case the items has empty status.
@@ -118,7 +119,7 @@ function ItemsDataTable({
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { const handleCellClick = (cell, event) => {
openDrawer('item-detail-drawer', { itemId: cell.row.original.id }); openDrawer(DRAWERS.ITEM_DETAILS, { itemId: cell.row.original.id });
}; };
return ( return (

View File

@@ -4,6 +4,8 @@ import intl from 'react-intl-universal';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes'; import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { DRAWERS } from '@/constants/drawers';
import { AbilitySubject, ItemAction } from '@/constants/abilityOption'; import { AbilitySubject, ItemAction } from '@/constants/abilityOption';
/** /**
@@ -19,7 +21,7 @@ function ItemUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.ITEM) { if (resourceType === RESOURCES_TYPES.ITEM) {
openDrawer('item-detail-drawer', { itemId: resourceId }); openDrawer(DRAWERS.ITEM_DETAILS, { itemId: resourceId });
onAction && onAction(); onAction && onAction();
} }
return null; return null;

View File

@@ -9,6 +9,7 @@ import { T, Icon, Choose, If } from '@/components';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes'; import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, BillAction } from '@/constants/abilityOption'; import { AbilitySubject, BillAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Universal search bill item select action. * Universal search bill item select action.
@@ -23,7 +24,7 @@ function BillUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.BILL) { if (resourceType === RESOURCES_TYPES.BILL) {
openDrawer('bill-drawer', { billId: resourceId }); openDrawer(DRAWERS.BILL_DETAILS, { billId: resourceId });
onAction && onAction(); onAction && onAction();
} }
return null; return null;

View File

@@ -24,6 +24,7 @@ import { useBillsListContext } from './BillsListProvider';
import { useMemorizedColumnsWidths } from '@/hooks'; import { useMemorizedColumnsWidths } from '@/hooks';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Bills transactions datatable. * Bills transactions datatable.
@@ -99,12 +100,12 @@ function BillsDataTable({
// Handle view detail bill. // Handle view detail bill.
const handleViewDetailBill = ({ id }) => { const handleViewDetailBill = ({ id }) => {
openDrawer('bill-drawer', { billId: id }); openDrawer(DRAWERS.BILL_DETAILS, { billId: id });
}; };
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { 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. // Local storage memorizing columns widths.

View File

@@ -23,6 +23,7 @@ import { useVendorsCreditNoteTableColumns, ActionsMenu } from './components';
import { useVendorsCreditNoteListContext } from './VendorsCreditNoteListProvider'; import { useVendorsCreditNoteListContext } from './VendorsCreditNoteListProvider';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Vendors Credit note data table. * Vendors Credit note data table.
@@ -78,8 +79,9 @@ function VendorsCreditNoteDataTable({
return <VendorsCreditNoteEmptyStatus />; return <VendorsCreditNoteEmptyStatus />;
} }
// Handle view vendor credit details.
const handleViewDetailVendorCredit = ({ id }) => { const handleViewDetailVendorCredit = ({ id }) => {
openDrawer('vendor-credit-detail-drawer', { vendorCreditId: id }); openDrawer(DRAWERS.VENDOR_CREDIT_DETAILS, { vendorCreditId: id });
}; };
// Handle delete credit note. // Handle delete credit note.
@@ -94,7 +96,7 @@ function VendorsCreditNoteDataTable({
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { const handleCellClick = (cell, event) => {
openDrawer('vendor-credit-detail-drawer', { openDrawer(DRAWERS.VENDOR_CREDIT_DETAILS, {
vendorCreditId: cell.row.original.id, vendorCreditId: cell.row.original.id,
}); });
}; };

View File

@@ -9,7 +9,6 @@ import { highlightText } from '@/utils';
import { AbilitySubject, PaymentMadeAction } from '@/constants/abilityOption'; import { AbilitySubject, PaymentMadeAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
/** /**
* Universal search bill item select action. * Universal search bill item select action.
*/ */
@@ -22,7 +21,7 @@ function PaymentMadeUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.PAYMENT_MADE) { if (resourceType === RESOURCES_TYPES.PAYMENT_MADE) {
openDrawer('payment-made-detail-drawer', { paymentMadeId: resourceId }); openDrawer(DRAWERS.PAYMENT_MADE_DETAILS, { paymentMadeId: resourceId });
} }
return null; return null;
} }

View File

@@ -16,7 +16,6 @@ import PaymentMadesEmptyStatus from './PaymentMadesEmptyStatus';
import withPaymentMade from './withPaymentMade'; import withPaymentMade from './withPaymentMade';
import withPaymentMadeActions from './withPaymentMadeActions'; import withPaymentMadeActions from './withPaymentMadeActions';
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization'; import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
import withAlertsActions from '@/containers/Alert/withAlertActions'; import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withSettings from '@/containers/Settings/withSettings'; import withSettings from '@/containers/Settings/withSettings';
@@ -24,6 +23,7 @@ import withSettings from '@/containers/Settings/withSettings';
import { usePaymentMadesTableColumns, ActionsMenu } from './components'; import { usePaymentMadesTableColumns, ActionsMenu } from './components';
import { usePaymentMadesListContext } from './PaymentMadesListProvider'; import { usePaymentMadesListContext } from './PaymentMadesListProvider';
import { useMemorizedColumnsWidths } from '@/hooks'; import { useMemorizedColumnsWidths } from '@/hooks';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Payment made datatable transactions. * Payment made datatable transactions.
@@ -71,12 +71,12 @@ function PaymentMadesTable({
// Handle view detail payment made. // Handle view detail payment made.
const handleViewDetailPaymentMade = ({ id }) => { const handleViewDetailPaymentMade = ({ id }) => {
openDrawer('payment-made-detail-drawer', { paymentMadeId: id }); openDrawer(DRAWERS.PAYMENT_MADE_DETAILS, { paymentMadeId: id });
}; };
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { const handleCellClick = (cell, event) => {
openDrawer('payment-made-detail-drawer', { openDrawer(DRAWERS.PAYMENT_MADE_DETAILS, {
paymentMadeId: cell.row.original.id, paymentMadeId: cell.row.original.id,
}); });
}; };

View File

@@ -23,7 +23,7 @@ function CreditNoteUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.CREDIT_NOTE) { if (resourceType === RESOURCES_TYPES.CREDIT_NOTE) {
openDrawer(DRAWERS.CREDIT_NOTE_DETAIL_DRAWER, { creditNoteId: resourceId }); openDrawer(DRAWERS.CREDIT_NOTE_DETAILS, { creditNoteId: resourceId });
onAction && onAction(); onAction && onAction();
} }
return null; return null;

View File

@@ -24,6 +24,7 @@ import { useCreditNoteTableColumns, ActionsMenu } from './components';
import { useCreditNoteListContext } from './CreditNotesListProvider'; import { useCreditNoteListContext } from './CreditNotesListProvider';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Credit note data table. * Credit note data table.
@@ -80,7 +81,7 @@ function CreditNotesDataTable({
} }
const handleViewDetailCreditNote = ({ id }) => { const handleViewDetailCreditNote = ({ id }) => {
openDrawer('credit-note-detail-drawer', { creditNoteId: id }); openDrawer(DRAWERS.CREDIT_NOTE_DETAILS, { creditNoteId: id });
}; };
// Handle delete credit note. // Handle delete credit note.
@@ -95,7 +96,7 @@ function CreditNotesDataTable({
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { const handleCellClick = (cell, event) => {
openDrawer('credit-note-detail-drawer', { openDrawer(DRAWERS.CREDIT_NOTE_DETAILS, {
creditNoteId: cell.row.original.id, creditNoteId: cell.row.original.id,
}); });
}; };

View File

@@ -8,6 +8,7 @@ import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, SaleEstimateAction } from '@/constants/abilityOption'; import { AbilitySubject, SaleEstimateAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Estimate universal search item select action. * Estimate universal search item select action.
@@ -21,7 +22,7 @@ function EstimateUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.ESTIMATE) { if (resourceType === RESOURCES_TYPES.ESTIMATE) {
openDrawer('estimate-detail-drawer', { estimateId: resourceId }); openDrawer(DRAWERS.ESTIMATE_DETAILS, { estimateId: resourceId });
} }
return null; return null;
} }

View File

@@ -21,6 +21,7 @@ import { ActionsMenu, useEstiamtesTableColumns } from './components';
import { useEstimatesListContext } from './EstimatesListProvider'; import { useEstimatesListContext } from './EstimatesListProvider';
import { useMemorizedColumnsWidths } from '@/hooks'; import { useMemorizedColumnsWidths } from '@/hooks';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Estimates datatable. * Estimates datatable.
@@ -86,7 +87,7 @@ function EstimatesDataTable({
// Handle view detail estimate. // Handle view detail estimate.
const handleViewDetailEstimate = ({ id }) => { const handleViewDetailEstimate = ({ id }) => {
openDrawer('estimate-detail-drawer', { estimateId: id }); openDrawer(DRAWERS.ESTIMATE_DETAILS, { estimateId: id });
}; };
// Handle print estimate. // Handle print estimate.
@@ -96,7 +97,7 @@ function EstimatesDataTable({
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { 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. // Local storage memorizing columns widths.

View File

@@ -9,6 +9,7 @@ import { highlightText } from '@/utils';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes'; import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, SaleInvoiceAction } from '@/constants/abilityOption'; import { AbilitySubject, SaleInvoiceAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Universal search invoice item select action. * Universal search invoice item select action.
@@ -22,7 +23,7 @@ function InvoiceUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.INVOICE) { if (resourceType === RESOURCES_TYPES.INVOICE) {
openDrawer('invoice-detail-drawer', { invoiceId: resourceId }); openDrawer(DRAWERS.INVOICE_DETAILS, { invoiceId: resourceId });
} }
return null; return null;
} }

View File

@@ -25,6 +25,7 @@ import { useInvoicesTableColumns, ActionsMenu } from './components';
import { useInvoicesListContext } from './InvoicesListProvider'; import { useInvoicesListContext } from './InvoicesListProvider';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Invoices datatable. * Invoices datatable.
@@ -89,7 +90,7 @@ function InvoicesDataTable({
// Handle view detail invoice. // Handle view detail invoice.
const handleViewDetailInvoice = ({ id }) => { const handleViewDetailInvoice = ({ id }) => {
openDrawer('invoice-detail-drawer', { invoiceId: id }); openDrawer(DRAWERS.INVOICE_DETAILS, { invoiceId: id });
}; };
// Handle print invoices. // Handle print invoices.
@@ -99,7 +100,7 @@ function InvoicesDataTable({
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { 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. // Local storage memorizing columns widths.

View File

@@ -4,10 +4,14 @@ import intl from 'react-intl-universal';
import { MenuItem } from '@blueprintjs/core'; import { MenuItem } from '@blueprintjs/core';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes'; import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, PaymentReceiveAction } from '@/constants/abilityOption'; import {
AbilitySubject,
PaymentReceiveAction,
} from '@/constants/abilityOption';
import { highlightText } from '@/utils'; import { highlightText } from '@/utils';
import { Icon } from '@/components'; import { Icon } from '@/components';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Payment receive universal search item select action. * Payment receive universal search item select action.
@@ -21,7 +25,7 @@ function PaymentReceiveUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.PAYMENT_RECEIVE) { if (resourceType === RESOURCES_TYPES.PAYMENT_RECEIVE) {
openDrawer('payment-receive-detail-drawer', { openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, {
paymentReceiveId: resourceId, paymentReceiveId: resourceId,
}); });
} }

View File

@@ -22,6 +22,7 @@ import withSettings from '@/containers/Settings/withSettings';
import { usePaymentReceivesColumns, ActionsMenu } from './components'; import { usePaymentReceivesColumns, ActionsMenu } from './components';
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider'; import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
import { useMemorizedColumnsWidths } from '@/hooks'; import { useMemorizedColumnsWidths } from '@/hooks';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Payment receives datatable. * Payment receives datatable.
@@ -69,12 +70,12 @@ function PaymentReceivesDataTable({
// Handle view detail payment receive.. // Handle view detail payment receive..
const handleViewDetailPaymentReceive = ({ id }) => { const handleViewDetailPaymentReceive = ({ id }) => {
openDrawer('payment-receive-detail-drawer', { paymentReceiveId: id }); openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, { paymentReceiveId: id });
}; };
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { const handleCellClick = (cell, event) => {
openDrawer('payment-receive-detail-drawer', { openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, {
paymentReceiveId: cell.row.original.id, paymentReceiveId: cell.row.original.id,
}); });
}; };

View File

@@ -7,6 +7,7 @@ import { Icon, Choose, T } from '@/components';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes'; import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, SaleReceiptAction } from '@/constants/abilityOption'; import { AbilitySubject, SaleReceiptAction } from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions'; import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Receipt universal search item select action. * Receipt universal search item select action.
@@ -21,7 +22,7 @@ function ReceiptUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.RECEIPT) { if (resourceType === RESOURCES_TYPES.RECEIPT) {
openDrawer('receipt-detail-drawer', { receiptId: resourceId }); openDrawer(DRAWERS.RECEIPT_DETAILS, { receiptId: resourceId });
onAction && onAction(); onAction && onAction();
} }
return null; return null;

View File

@@ -23,6 +23,7 @@ import withSettings from '@/containers/Settings/withSettings';
import { useReceiptsListContext } from './ReceiptsListProvider'; import { useReceiptsListContext } from './ReceiptsListProvider';
import { useReceiptsTableColumns, ActionsMenu } from './components'; import { useReceiptsTableColumns, ActionsMenu } from './components';
import { useMemorizedColumnsWidths } from '@/hooks'; import { useMemorizedColumnsWidths } from '@/hooks';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Sale receipts datatable. * Sale receipts datatable.
@@ -77,7 +78,7 @@ function ReceiptsDataTable({
// Handle view detail receipt. // Handle view detail receipt.
const handleViewDetailReceipt = ({ id }) => { const handleViewDetailReceipt = ({ id }) => {
openDrawer('receipt-detail-drawer', { receiptId: id }); openDrawer(DRAWERS.RECEIPT_DETAILS, { receiptId: id });
}; };
// Handle print receipt. // Handle print receipt.
@@ -106,7 +107,7 @@ function ReceiptsDataTable({
} }
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { const handleCellClick = (cell, event) => {
openDrawer('receipt-detail-drawer', { receiptId: cell.row.original.id }); openDrawer(DRAWERS.RECEIPT_DETAILS, { receiptId: cell.row.original.id });
}; };
return ( return (

View File

@@ -23,6 +23,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withSettings from '@/containers/Settings/withSettings'; import withSettings from '@/containers/Settings/withSettings';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Vendors table. * Vendors table.
@@ -93,12 +94,12 @@ function VendorsTable({
// Handle view detail item. // Handle view detail item.
const handleViewDetailVendor = ({ id }) => { const handleViewDetailVendor = ({ id }) => {
openDrawer('vendor-detail-drawer', { vendorId: id }); openDrawer(DRAWERS.VENDOR_DETAILS, { vendorId: id });
}; };
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { 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. // Local storage memorizing columns widths.

View File

@@ -4,6 +4,7 @@ import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from '@/constants/resourcesTypes'; import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
import { AbilitySubject, VendorAction } from '@/constants/abilityOption'; import { AbilitySubject, VendorAction } from '@/constants/abilityOption';
import withDrawerActions from '../Drawer/withDrawerActions'; import withDrawerActions from '../Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Vendor univesal search item select action. * Vendor univesal search item select action.
@@ -17,7 +18,7 @@ function VendorUniversalSearchSelectComponent({
openDrawer, openDrawer,
}) { }) {
if (resourceType === RESOURCES_TYPES.VENDOR) { if (resourceType === RESOURCES_TYPES.VENDOR) {
openDrawer('vendor-detail-drawer', { vendorId: resourceId }); openDrawer(DRAWERS.VENDOR_DETAILS, { vendorId: resourceId });
onAction && onAction(); onAction && onAction();
} }
return null; return null;

View File

@@ -21,6 +21,7 @@ import withAlertsActions from '@/containers/Alert/withAlertActions';
import withSettings from '@/containers/Settings/withSettings'; import withSettings from '@/containers/Settings/withSettings';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
/** /**
* Warehouse transfers datatable. * Warehouse transfers datatable.
@@ -78,7 +79,7 @@ function WarehouseTransfersDataTable({
// Handle view detail. // Handle view detail.
const handleViewDetailWarehouseTransfer = ({ id }) => { const handleViewDetailWarehouseTransfer = ({ id }) => {
openDrawer('warehouse-transfer-detail-drawer', { warehouseTransferId: id }); openDrawer(DRAWERS.WAREHOUSE_TRANSFER_DETAILS, { warehouseTransferId: id });
}; };
// Handle edit warehouse transfer. // Handle edit warehouse transfer.
@@ -102,7 +103,7 @@ function WarehouseTransfersDataTable({
// Handle cell click. // Handle cell click.
const handleCellClick = (cell, event) => { const handleCellClick = (cell, event) => {
openDrawer('warehouse-transfer-detail-drawer', { openDrawer(DRAWERS.WAREHOUSE_TRANSFER_DETAILS, {
warehouseTransferId: cell.row.original.id, warehouseTransferId: cell.row.original.id,
}); });
}; };